#include "msp430g2231.h"
void Gpio_Init()初始化GPIO的LED灯
{
P1DIR=0xc1;
P1OUT=0x00;
}
void delay()
{
unsigned int x;
x=100;
while(x--);
}
void main()
{
WDTCTL = WDTPW + WDTHOLD; 禁用看门狗
BCSCTL3 |= LFXT1S_2; 使用低速
IFG1 &= ~OFIFG;
__bis_SR_register(SCG1 + SCG0);
BCSCTL2 |= SELM_3 + DIVM_3;
Gpio_Init();
开始闪烁了
while(1)
{
P1OUT=0x00;
delay();
P1OUT=0xc1;
delay();
}
} |