会单片机得帮俺解释下这段16路代码,TK
include <reg51.h>#define uchar unsigned char
uchar a,b,c;
sfr key=0x90;
bit fkey=0;
delay(uchar t )
{
uchar i,j;
for (i=0;i<t;i++)
for (j=0;j<120;j++)
;
}
main()
{
while(1)
{
P2=0x01;
key=0x0f;
if(key !=0x0f)
{
delay(20);
if(key !=0x0f)
{
a=key;
}
key=0xf0;
c=key;
a=a|c;
if(fkey==0)
{
switch(a)
{
case 0xee:{P0=0x3f;fkey=1;break;}
case 0xed:{P0=0x06;fkey=1;break;}
case 0xeb:{P0=0x5b;fkey=1;break;}
case 0xe7:{P0=0x4f;fkey=1;break;}
case 0xde:{P0=0x66;fkey=1;break;}
case 0xdd:{P0=0x6d;fkey=1;break;}
case 0xdb:{P0=0x7d;fkey=1;break;}
case 0xd7:{P0=0x07;fkey=1;break;}
case 0xbe:{P0=0x7f;fkey=1;break;}
case 0xbd:{P0=0x67;fkey=1;break;}
case 0xbb:{P0=0x77;fkey=1;break;}
case 0xb7:{P0=0x7c;fkey=1;break;}
case 0x7e:{P0=0x39;fkey=1;break;}
case 0x7d:{P0=0x5e;fkey=1;break;}
case 0x7b:{P0=0x79;fkey=1;break;}
case 0x77:{P0=0x71;fkey=1;break;}
default: break;
}
}
}
}
}
哭了都,不知道是有什么功能,接什么口
唉,就是对C有点研究
就被同学拉去做什么单片机抢答器。。。。。。。。。