[LaunchPad] 时钟的初应用

 1 #include "io430g2553.h"

 2 

 3 void main(void)

 4 {

 5    volatile unsigned int i;

 6    

 7    WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer

 8 

 9  //------------------------------------------

10  //ACLK = n/a , MCLK = DCO/8 , SMLK = DCO/8 

11 BCSCTL1=CALBC1_16MHZ ; //Setrange

12 DCOCTL=CALDCO_16MHZ; //设置DCO模式

13 BCSCTL2|=SELM_0 + DIVM_3 + DIVS_3;

14 

15 //-------------------------------------------

16 //ACLK = VLO , MCLK = VLO/8 , SMLK = VLO/8

17 /*

18 BCSCTL3 |= LFXT1S_2 ; //ACLK = VLO   

19 IFG1 &= ~OFIFG;

20 BCSCTL2|= SELM_3 + DIVM_3 + SELS + DIVS_3;

21 */

22 

23 

24 //__bis_SR_register(SCG1+SCG0); // 关闭 DCO

25 

26 

27   P1OUT |= 0xff; 

28   P1DIR |= 0xff;                            // Set P1.0 to output direction

29   

30   

31   P1DIR_bit.P3 = 0; 

32   P1REN_bit.P3 = 1;

33 

34   for (;;)

35   {

36    

37     if(P1IN_bit.P3)

38     {

39     P1OUT_bit.P6 = P1OUT_bit.P0;

40     P1OUT_bit.P0 = ~P1OUT_bit.P0;

41     }

42     

43     for(i=5000;i>0;i--);

44    

45   }

46 }

外接32kHz晶振,无法起振,不知是何情况

你可能感兴趣的:(HP)