Home > other >  Of 51 single-chip digital tube dynamic display technology
Of 51 single-chip digital tube dynamic display technology

Time:10-18

I want tome in 51 MCU development version of science and technology to achieve the dynamic display of digital tube, but why I can't achieve this function? Thank you, I'm a small small white ah
# include

Sbit LSA=P2 ^ 2;
Sbit LSB=P2 ^ 3;
sbit LSC=P2^4;

Unsigned char code led1 [10]={x5b x3f 0, 0 x06, 0, 0, x4f x66 0, 0 x6d, 0 x7d, 0 x07, 0 x7f, 0 x6f};
Unsigned char led2 [8]={0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00};

Void main ()
{
Unsigned char I=0;
Unsigned int CNT=0;
Unsigned long SEC=0;

LSA=0;
LSB=0;
LSC=0;
TMOD=0 x01;
XFC TH0=0;
X67 TL0=0;
TR0=1;

While (1)
{
If (TF0==1)
{
TF0=0;
XFC TH0=0;
X67 TL0=0;
Cnt++;
If (cnt>
=1000){
CNT=0;
Sec++;
Led2 [0]=led1 [10] the SEC %;
Led2 [1]=led1/SEC/10% 10;
Led2 [2]=led1/SEC/100% 10;
Led2 [3]=led1/SEC/1000% 10;
Led2 [4]=led1/SEC/10000% 10;
Led2 [5]=led1/SEC/100000% 10;
Led2 [6]=led1/SEC/1000000% 10;
Led2 [7]=led1/SEC/10000000% 10;
}
If (I==0)
{the LSA=0; LSB=0; LSC=0; i++; P0=led2 [0]; }
Else if (I==1)
{the LSA=0; LSB=0; LSC=1; i++; P0=led2 [1]; }
Else if (I==2)
{the LSA=0; LSB=1; LSC=0; i++; P0=led2 [2]; }
Else if (I==3)
{the LSA=0; LSB=1; LSC=1; i++; P0=led2 [3]. }
Else if (I==4)
{the LSA=1; LSB=0; LSC=0; i++; P0=led2 [4]; }
Else if (I==5)
{the LSA=1; LSB=0; LSC=1; i++; P0=led2 [5]; }
Else if (I==6)
{the LSA=1; LSB=1; LSC=0; i++; P0=led2 [6]. }
Else if (I==7)
{the LSA=1; LSB=1; LSC=1; i++; P0=led2 [7]; }

}
}
}

CodePudding user response:

General buy board is not provided in the code examples?
The code is written by yourself? Provided in or normal?
In the end of the program + unsigned char yan=255; While (yan -); And proved

CodePudding user response:

This is written by myself, I try, thank you
  • Related