一種單片機(jī)獨(dú)立按鍵檢測(cè)思路
#include
main()
{
unsigned char sw;
//unsigned char P1;
//unsigned char P3;
unsigned int t;
while(1)
{
sw=P3|0xf0;
switch(sw)
{
case 0xfe:P1=0xfe;
break ;
for (t=0;t<<60000;t++);
case 0xfd:P1=0xf9;
for (t=0;t<<60000;t++);
break;
case 0xfb:P1=0xc7;
break;
case 0xf7:P1=0x0f;
for (t=0;t<<60000;t++);
break;
default: P1=0xff;
for (t=0;t<<60000;t++);
break;
}
}
}
評(píng)論