用的5438A
DCO采用默认设置,也就是默认1.048MHz频率不变,SMCLK、MCLK采用DCODIV,ACLK设置为使用DCODIV。量一下频率,发现三个时钟都变成了263kHz左右的频率,不是1MHz了。这是为什么呢?
程序:
WDTCTL = WDTPW + WDTHOLD;
P11SEL |= 0x07;
P11DIR |= 0x07;
P4OUT &=~ 0x01;
P4DIR |= 0x01;
UCSCTL4 |= SELA__DCOCLK; while (1)
{P4OUT ^= 0x01;
__delay_cycles(60000); }
Lina Lian:
John C Smith,
请用下面的例程再测试一下,看看结果怎么样?
#include <msp430.h>
int main(void){ WDTCTL = WDTPW+WDTHOLD; // Stop WDT P1DIR |= BIT0; // P1.0 output P11DIR |= 0x07; // ACLK, MCLK, SMCLK set out to pins P11SEL |= 0x07; // P11.0,1,2 for debugging purposes.
while(1) { P1OUT ^= BIT0; // Toggle P1.0 __delay_cycles(60000); // Delay }}