楼主参考一下 //* An external 8MHx crystal is required between XT2 and XT2OUT , and
// an external 32kHz crystal is required between XIN and XOUT. *//
volatile unsigned int i;
WDTCTL = WDTPW+WDTHOLD; // Stop WDT
BCSCTL1 &= ~XT2OFF; // Activate XT2 high freq xtal
BCSCTL3 |= XT2S_2; // 3 ?16MHz crystal or resonator
// Wait for xtal to stabilize
do
{
IFG1 &= ~OFIFG; // Clear OSCFault flag
for (i = 0x47FF; i > 0; i--); // Time for flag to set
}
while ((IFG1 & OFIFG)); // OSCFault flag still set?
BCSCTL2 |= SELM_2; // MCLK = XT2 HF XTAL (safe)