|
single 18:53:06
#include<reg52.h>
sbit add0=P1^0;
sbit add1=P1^1;
sbit add2=P1^2;
sbit add3=P1^3;
sbit eva=P1^4;
sbit keyin1=P2^4;
sbit keyin2=P2^5;
sbit keyin3=P2^6;
sbit keyin4=P2^7;
unsigned char code ledchar[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};
void main()
{
bit backup=1;
unsigned char count=0;
eva=0;
add3=1;
add2=0;
add1=0;
add0=0;
P2=0xf7;
P0=ledchar[count];
while(1)
{
if(keyin4!=backup)
{
if(backup==0)
{ count++;
if(count>=10)
count=0;
P0=ledchar[count];
}
backup=keyin4;
}
}
}
|
|