// 时钟初始化程序
void Clock_Init()
{
unsigned char i;
P5SEL=0X0C;
P7SEL=0X00;
//_bis_SR_register(SCG0);
UCSCTL6=0X4001; //打开XT2,XT1,SMCLK
UCSCTL4|=SELM_5+SELS_5; //MCLK,SMCLK都选择XT2
UCSCTL5|=DIVS_3+DIVM_0; //MCLK不分频,SMCLK8分频
do
{
UCSCTL7 &= ~(XT2OFFG); // Clear XT1 & DCO fault flags
SFRIFG1 &= ~OFIFG; // Clear OSC Fault flag
for (i = 0xFF; i > 0; i--) ; // Time for flag to set
}while ( (SFRIFG1 & OFIFG) );
} |