MSP430开发环境MSPGCC + Codeblocks


保存。
5)新建一个项目。File->New->project->Empty project
一般我都只勾选Release,不要Debug


7)新建空白文件,并添加到项目中File->New->Empty file
输入测试代码。我的LaunchPad代码(没注释的,见笑了):
#include
void delay(int duration)
{
volatile int d = duration;
while((d--) > 0)
{
}
}
int main(void)
{
WDTCTL = WDTPW | WDTHOLD;
P1OUT = 0x00;
P1DIR = 0x41;
while(1)
{
P1OUT = 0x40;
delay(5000);
P1OUT = 0x01;
delay(5000);
}
return 0;
}
提醒一下:delay函数里面的变量要加上volatile修饰。
评论