#include<msp430x44x.h>
volatile int tick=0;//被不同线程访问
void main(void)
{WDTCTL=WDTPW+WDTHOLD;//关看门狗
IE2=BTIE;//使能基本定时器中断
BTCTL=BTSSEL+BT_fCLK2_DIV256;//设置控制寄存器
_EINT();//使能中断指令ENIT后面的指令总会被执行,中断请求悬而未决的时间也能执行
while(1)
{
if(tick==327)
{
tick=0;
}
}
}
#pragma vector=BASICTIMER_VECTOR
_interrupt void BasicTimerInt(void)//基本定时器中断
{
tick+=1;
}
调试信息
main.c
Error[Pe077]: this declaration has no storage class or type specifier E:MSPTEST449simulator_BasicTimerIntmain.c 17
Warning[Pe609]: this kind of pragma may not be used here E:MSPTEST449simulator_BasicTimerIntmain.c 16
Error[Pe065]: expected a ";" E:MSPTEST449simulator_BasicTimerIntmain.c 17
Warning[Pe012]: parsing restarts here after previous syntax error E:MSPTEST449simulator_BasicTimerIntmain.c 20
Error while running C/C++ compiler
Done. 2 error(s), 2 warning(s)
此帖出自
小平头技术问答
一周热门 更多>