只是想测试下按键
#include <reg52.h>
#define uchar unsigned char #define uint unsigned int uchar eo; uchar key; uchar input; sbit wdi=P1^7; sbit led1=P1^4; sbit led2=P1^5;
void main () { //P1=0x0F; P1=0X00; eo=P1&0x08; while(1) { if(eo==0X08) { input=P1&0x07; switch(input) { case 0: key=8;led1=1;break; case 1: key=7;led1=0;break; case 2: key=6;led1=1;break; case 3: key=5;led1=0;break; case 4: key=4;led2=1;break; case 5: key=3;led2=0;break; case 6: key=2;led2=1;break; case 7: key=1;led2=0;break; default :break; } } wdi=!wdi; } }
单片机为AT89C55WD
现在是按键无反应
请大侠指教 |