那个高手帮我看看啊!!!
#include<reg51.h>#define uchar unsigned char
#define uint unsigned int
uchar code dsy[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79, 0x71};
uchar pre_keyno=16;
keyno=16;
void delay(uint z)
{
uint x;
uchar y;
for(x=z;x>0;x++)
for(y=110;y>0;y++);
}
void key-scan()
{
uchar temp;
p1=0x0f; //行为0查列
delay(1);
temp=p1^0x0f;
}
switch(temp)
{
case 1: keyno=0;break;
case 2: keyno=1;break;
case 4: keyno=2;break;
case 8: keyno=3;break;
default:keyno=16;
}
p1=0xfe;
delay(1);
temp=p1>>4^0x0f; //列为0查行
switch(temp)
{
case 1: keyno+=0;break;
case 2: keyno+=4;break;
case 4: keyno+=8;break;
case 8: keyno+=12;break;
}
void main()
{
p0=0x00;
while(1);
}
}