#include <msp430x14x.h>
#define CPU_F ((double)8000000)
#define delay_us(x) __delay_cycles((long)(CPU_F*(double)x/1000000.0))
#define delay_ms(x) __delay_cycles((long)(CPU_F*(double)x/1000.0))
#define uchar unsigned char
#define uint unsigned int
#define ulong unsigned long
void delayms(uint xms);
uchar key_checkin;
void main(void)
{
WDTCTL=WDTPW+WDTHOLD; // Stop watchdog timer to prevent time out reset
P2SEL=0x00; //P2普通IO功能
P2DIR&=0x7f; // 01111111
P5SEL=0x00; //P2普通IO功能
P5DIR=0xff; // 11111111
while(1)
{
key_checkin=P2IN;
key_checkin&=0xf0;
if(key_checkin!=0xf0)
{
delayms(20);
key_checkin=P2IN;
key_checkin&=0xf0;
if(key_checkin!=0xf0)
{
while(key_checkin!=0xf0); //等待按键释放
P5OUT=0xff;
}
}
}
}
void delayms(uint xms)
{
uint i,j;
for(i=xms;i>0;i--)
for(j=110;j>0;j--);
}
请问这个程序有什么错误,为何下载到板子上没有反应呢???