#include <reg51.h>
#define unreset e==1
sbit e=P2^0;
unsigned int number[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
void delay(unsigned int i)
{
unsigned int k;
for(k=0;k<i;k++);
}
void main()
{
unsigned char a;
P1=0xff;
P2=0xff;
while(1)
{
a=P1;
if(a==P1)
{
delay(1100);//°′¼üÏû¶¶
if(P1==a)
{
switch(a)
{
case 0xfe:P0=0XF9;while(unreset); break;//1oţ
case 0xfd:P0=0XA4;while(unreset); break;//2oÅ
case 0xfb:P0=0XB0;while(unreset); break;//3oÅ
case 0xf7:P0=0X99;while(unreset); break;//4oÅ
case 0xef:P0=0X92;while(unreset); break;//5oÅ
case 0xDf:P0=0X82;while(unreset); break;//6oÅ
case 0xBf:P0=0XF8;while(unreset); break;//7oÅ
case 0X7F:P0=0X80;while(unreset); break;//8oÅ
default:P0=0xff;
}
}
}
}
}
|