#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
#define Dig P0
sbit gA=P2^2;
sbit gB=P2^3;
sbit gC=P2^4;
uchar count,num;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f};
void main()
{
count=0;
num=0;
gA=1;gB=1;gC=1;
TMOD=0X01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
//EA=1;
//ET0=1;
TR0=1;
//TF0=0;
P0=table[0];
while(1)
{
while(~TF0)
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
TF0=0;
count++;
if(count==20)
{
count=0;
num++;
if(num==10)
num=0;
P0=table[num];
}
}
}
|