Digital tube display circuit diagram
51 MCU program code:
#include
#define UCHAR unsigned char
#define UINT unsigned int
sbit KEY=P3^2;
UCHAR table[16] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
UINT context;
void inittime(void)
{
KEY=1;
conter=0;
TMOD=0x09;
TH0=0X00;
TL0=0X00;
EA=1;
ET0=1;
TR0=0;
}
void Delay_1ms(UCHAR i) //1ms delay
{
UCHAR x,j;
for(j=0;j
Keywords:MCU
Reference address:Single chip timer T0 measures external pulse time C51 program
for(x=0;x<=148;x++);
}
void segdisplay(void)
{
P0 = 0; //Blanking
P2 = 4; //The 7th digital tube display
P0 = table[(conter / 10000)%10]; //Get the tens digit of i here
Delay_1ms(5); //Display the next number after 0.5 seconds delay
P0 = 0; //Blank
P2 = 5; //The 8th digital tube display
P0 = table[conter /100% 10]; //Get the unit digit of i here
Delay_1ms(5);
P0 = 0; //Blanking
P2 = 6; //The 7th digital tube display
P0 = table[(conter / 10)%10]; //Get the tens digit of i here
Delay_1ms(5); //Display the next number after 0.5 seconds delay
P0 = 0; //Blank
P2 = 7; //The 8th digital tube display
P0 = table[conter % 10]; //Get the unit digit of i here
Delay_1ms(5);
P0=0;
}
void main()
{
inittime();
while(1)
{
segdisplay();
if(KEY==1)
TR0=0;
if(KEY==0)
TR0=1;
conter=TH0*256+TL0;
}
}
Previous article:51 single chip microcomputer drives dot matrix display digital program + circuit
Next article:T2 serial digital tube display C51 program + circuit diagram
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
MoreDaily News
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
Guess you like
- Is there any software that can edit 16*16 dot matrix modeling?
- What does it mean to use series resistors for isolation? Can series resistors also play an isolating role?
- How to convert OUT file to hexadecimal format?
- [National Technology N32WB452 Review] III. Hardware touch debugging and DVP image acquisition
- Common mode inductor location
- Sub-library: SensorTile.Box development platform
- Share the solution to listen to music while charging an Android phone (listen and play while charging)
- Things you didn't know about Einstein
- Solution to insufficient RAM space in DSP28335
- [Understanding of FSM finite state machine of LSM6DSOX] -- Introduction to state machine instructions, with [Chinese version instruction set]