我在用到MSP430F6733单片机时看到有
UCSCTL3 |= SELREF_2; // Set DCO FLL reference = REFO
UCSCTL4 |= SELA_2; // Set ACLK = REFO
__bis_SR_register(SCG0); // Disable the FLL control loop
UCSCTL0 = 0x0000; // Set lowest possible DCOx, MODx
UCSCTL1 = DCORSEL_5; // Select DCO range 16MHz operation
UCSCTL2 = FLLD_1 | 243; // Set DCO Multiplier for 8MHz
然后还有
// Setup LFXT1
UCSCTL6 &= ~(XT1OFF); // XT1 On
UCSCTL6 |= XCAP_3; // Internal load cap
// Loop until XT1 fault flag is cleared
do
{
UCSCTL7 &= ~XT1LFOFFG; // Clear XT1 fault flags
} while (UCSCTL7 & XT1LFOFFG); // Test XT1 fault flag
// Initialize DCO to 2.45MHz
__bis_SR_register(SCG0); // Disable the FLL control loop
UCSCTL0 = 0x0000; // Set lowest possible DCOx, MODx
UCSCTL1 = DCORSEL_5; // Set RSELx for DCO = 4.9 MHz
UCSCTL2 = FLLD_1 | 243; // Set DCO Multiplier for 2.45MHz
这两个区别在于选择DCO的时钟源不同,那 UCSCTL1 = DCORSEL_5; 设置DCO范围为什么会不一样,
fDCO(5,0) DCO frequency (5, 0) DCORSELx = 5, DCOx = 0, MODx = 0 2.5 6.0 MHz 这是表上查的,到底是怎么个算法啊,求大师讲解。
|