只有本站会员才能查看附件,请 登录
写一段程序如下:
程序代码:
void Read_Key() interrupt 0
{
unsigned char Key_1,Key_2,Key;
unsigned char i;
Buzz_Start();
P1=0x0F;
if(P1!=0x0F)
{
Delay();
if(P1!=0x0F)
{
Key_1=P1&0x0F;
}
}
P1=0xF0;
if(P1!=0xF0)
{
Delay();
if(P1!=0xF0)
{
Key_2=P1&0xF0;
}
}
Key=Key_1|Key_2;
for(i=0;i<10;i++)
{
if(Key==Key_Code[i])
{
WDat(Num_TAB[i]);
}
}
while((P1&0xF0)!=0xF0);
Buzz_Stop();
}
{
unsigned char Key_1,Key_2,Key;
unsigned char i;
Buzz_Start();
P1=0x0F;
if(P1!=0x0F)
{
Delay();
if(P1!=0x0F)
{
Key_1=P1&0x0F;
}
}
P1=0xF0;
if(P1!=0xF0)
{
Delay();
if(P1!=0xF0)
{
Key_2=P1&0xF0;
}
}
Key=Key_1|Key_2;
for(i=0;i<10;i++)
{
if(Key==Key_Code[i])
{
WDat(Num_TAB[i]);
}
}
while((P1&0xF0)!=0xF0);
Buzz_Stop();
}