您用的1XXX系列的设置方式,4XXX的设置供参考:
#include "msp430x44x.h"
void main(void)
{
unsigned int i;
WDTCTL = WDTPW + WDTHOLD; // stop watchdog timer
FLL_CTL0 |= XCAP18PF; // set load capacitance for 32k xtal
FLL_CTL1 = FLL_CTL1 & ~XT2OFF; // clear bit = high freq xtal on
do // loop until flag is clear
{
FLL_CTL0 = FLL_CTL0 & ~XT2OF; // clear high freq oscillator fault flag
for (i = 50000; i; i--); // delay for crystal to start and FLL to lock
}
while (FLL_CTL0 & XT2OF); // test high freq oscillator fault flag
// if flag remained clear then -
FLL_CTL1 = SELS; // switch SMCLK = HF xtal
P1DIR = 0x32; // P1.1, P1.4 & P1.5 to outputs
P1SEL = 0x32; // P1.1, P1.4 & P1.5 functions to output
// MCLK, SMCLK & ACLK
while(1); // loop in place
}
相关资料可以登陆
www.lierda.com 网站的“资料库”里搜索“C语言”或“汇编语言”查询。