#include "msp430x54x.h"
#define uint unsigned int
#define uchar unsigned char
void port_init();
void delay(uint x);
uchar t=0,u=0;
void main()
{
WDTCTL = WDTPW + WDTHOLD; // 关闭看门狗
port_init();
while(1)
{
if(t==200)
{
t=0;
P9OUT =~P9OUT;
}
}
}
void port_init()
{
P5DIR |= 0x16;
P5OUT = 0x10;
P1DIR |= 0xf0;
P1OUT |= 0xf0;
P8DIR = 0xff;
P8OUT = 0xff;
P9DIR |= 0x0f;
P9OUT |= 0xff;
TA0CTL=0x02c2;
TA0EX0=0x0007;
TA0R=(65536-20000);
TAIFG=0;
}
void delay(uint x)
{
uint a,b;
for(a=x;a>0;a--)
for(b=110;b>0;b--);
}
#progma vector=TIMER0_A0_VECTOR //(Error[Pe011]: unrecognized preprocessing directive)
__interrupt void Timer0_A0()
{
TA0R=(65536-20000);
TAIFG=0; //(Error[Pe137]: expression must be a modifiable lvalue )
t++;
}
括号里是错误原因,该怎么改,求指教!
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>