#include<reg51.h>
char code led1[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,0x58,0x5e,0x79,0x71};
char code led2[]={0x73,0x79};
char code key1[]={0xee,0xde,0xbe,0x7e,0xed,0xdd,0xbd,0x7d,
0xed,0xdb,0xbb,0x7b,0xe7,0xd7,0xb7,0x77};
char code key2[]={0xef,0xdf,0xbf,0x7f};
void main()
{
char i,j;
P0=0x00;
while(1)
{
for(i=0;i<4;i++)
{
P2=key2[i];
if((P2&0x0f)!=0x0f)
{
for(j=0;j<16;j++)
if(P2==key1[j])
P0=led1[j];
}
}
}
}
protues仿真显示效果为什么按键会自己变化