#include<STC12C5A60S2.H>
a[10]={0x03,0x9f,0x25,0x0d,0x99,0x49,0x41,0x1f,0x01,0x09};
sbit KEY1=P2^0;
sbit KEY2=P2^1;
void delay(unsigned int i)
{
unsigned int j;
while(i--)
for(j=600;j>0;j--);
}
void init()
{
P1=0xff;
P0M0=0xff;
P0M1=0x00;
KEY1=KEY2=1;
}
void main(void)
{
unsigned int j;
unsigned char i;
unsigned int k=1;
unsigned char s[4];
init();
while(1)
{
while(k%=9999)
{
if(k<1000) s[0]=0xff; else s[0]=a[k/1000];
if(k<100) s[1]=0xff; else s[1]=a[k%1000/100];
if(k<10) s[2]=0xff; else s[2]=a[k%100/10];
s[3]=a[k%10];
j=50;
while(j--)
{
for(i=0;i<4;i++)
{
P0=0x01<<i;
P1=s[i];
delay(5);
}
}
k++;
}
}
}
|