#include<reg51.h>
#define SEG7 P2
unsigned char code DIG_CODE[17]={
0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
0x7f,0x6f};
sbit LSA=P3^0;
sbit LSB=P3^1;
sbit LSC=P3^2;
void Delay8000us(int c) //@12.000MHz
{
unsigned char i, j;
i = 94;
j = 95;
do
{
while (--j);
} while (--i);
}
void main()
{
unsigned char Num;
while(1)
{
for(Num=0;Num<100;Num++)
{
LSA=0;LSB=1;LSC=1;
SEG7=DIG_CODE[Num%100/10];
Delay8000us(1);
LSA=1;LSB=1;LSC=1;
SEG7=DIG_CODE[Num%10];
Delay8000us(1);
}
}
}
|