#include "msp430g2231.h"
void Gpio_Init()
{
P1DIR=0xc1;
P1OUT=0x00;
}
void delay()
{
unsigned int x;
x=10000;
while(x--);
}
void main()
{
WDTCTL = WDTPW + WDTHOLD;
if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF)
{
while(1);
}
BCSCTL1 = CALBC1_1MHZ;
DCOCTL = CALDCO_1MHZ; 使用DCO作为MCLK
BCSCTL3 |= LFXT1S_2;
IFG1 &= ~OFIFG;
BCSCTL2 |= SELM_0 + DIVM_3; 启用DCO/8的频率
Gpio_Init();
while(1)
{
P1OUT=0x00;
delay();
P1OUT=0xc1;
delay();
}
} |