Two-digit digital tube dynamic display C language program + circuit diagram
2020-12-16 10:44:28
51 single chip microcomputer digital tube driver written in c language The following is the circuit diagram:
#include
#define uint unsigned int
void delay7ms(void) //误差 -0.217013888891us
{
unsigned char a,b;
for(b=208;b>0;b--)
for(a=14;a>0;a--);
}
void delay2ms(void) //误差 -0.217013888889us
{
unsigned char a,b;
for(b=80;b>0;b--)
for(a=10;a>0;a--);
}
#define uint unsigned int
void delay7ms(void) //误差 -0.217013888891us
{
unsigned char a,b;
for(b=208;b>0;b--)
for(a=14;a>0;a--);
}
void delay2ms(void) //误差 -0.217013888889us
{
unsigned char a,b;
for(b=80;b>0;b--)
for(a=10;a>0;a--);
}
void main(void)
{
uint led[10]={0xc0,0xf9,0xa4, 0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
uint m,n=0,a=0;
for(m=0;m<=10;m++)
{
while(a<30)
{
if(m==10)
{
m=0;
n++ ;
if(n==10)
n=0;
}
{
uint led[10]={0xc0,0xf9,0xa4, 0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
uint m,n=0,a=0;
for(m=0;m<=10;m++)
{
while(a<30)
{
if(m==10)
{
m=0;
n++ ;
if(n==10)
n=0;
}
P0=led[m];
P2=0x40;
delay7ms();
P2=0x00;
delay2ms();
P0=led[n];
P2=0x80;
delay7ms();
P2=0x00;
delay2ms();
a++;
}
a=0;
P2=0x40;
delay7ms();
P2=0x00;
delay2ms();
P0=led[n];
P2=0x80;
delay7ms();
P2=0x00;
delay2ms();
a++;
}
a=0;
}
}
}
-
The working principle of wireless remote control switch[2020/12/16]
-
4 car remote control ic with the same frequency, toy ic, microcontroller development, program development, mcu development, software development, small appliance ic[2020/12/16]
-
Counter MCU development[2020/12/16]
-
Detailed steps of making a self-made infrared remote control switch (two self-made infrared remote control switch methods)-Full text[2020/12/16]