Digital tube display principle
Digital tubes are divided into common cathode and common anode according to different internal connections. There are 8 LEDs inside the eight-segment digital tube. If you want to display a specific font, you only need to control the corresponding LED to light up and the other LEDs to turn off.
Static and dynamic display
Static display:
There are two working modes of LED displays: static display mode and dynamic display mode. The characteristic of static display is that the segment selection of each digital tube must be connected to a 9-bit data line to maintain the displayed glyph code. After the glyph code is sent once, the displayed glyph can be maintained until a new glyph code is sent.
Disadvantages: More IO ports are used.
dynamic display
The characteristic of dynamic display is that the segment selection lines of all digital tubes are connected in parallel, and the bit selection lines control which digital tube is effective. The selected digital tube adopts dynamic scanning display. The so-called dynamic scanning display is to send glyph codes and corresponding bit selections to each digital tube in turn. It uses the afterglow of the luminescent tube and the persistence of human vision to make people feel as if all the digital tubes are displaying at the same time.
How the 74HC573 latch works
Chip document query website: https://www.alldatasheet.com/
The role of pull-up resistors
Pull-up is to clamp the uncertain signal to a high level through a resistor, and the resistor also acts as a current limiter. In the same way, the lower level also clamps the uncertain signal at a low level through a resistor.
When the P0 port is used as an input or output port, it is in open-drain mode after power-on reset. There is no pull-up resistor inside the P0 port, so the I/0 port must be connected to an external pull-up resistor of 10K-4.7K.
Light up the single digit "1"
#include #include #define uint unsigned int #define uchar unsigned char sbit DU = P2^6;//digital tube segment selection sbit WE = P2^7;//Nigital tube segment selection void main(){ // The main function itself will loop WE = 1; //Open bit select latch P0 = 0XFE; // 1111 1110 strobe the first digital tube // P0 = 0X00; // 0000 0000 means strobing all digital tubes WE = 0; //Latch bit selection data DU = 1; //Open segment selection latch P0 = 0X06; // 0000 0110 displays "1" DU = 0; //Latch segment selection data while(1){ // P0 = 0X01; // When the value in the latch is locked, the value of the digital tube cannot be modified directly. You need to open the bit selection latch to modify it. } } Light up the two-digit number "2" #include #include #define uint unsigned int #define uchar unsigned char sbit DU = P2^6;//digital tube segment selection sbit WE = P2^7;//Nigital tube segment selection void main(){ // The main function itself will loop WE = 1; //Open bit select latch P0 = 0XFC; // 1111 1100 strobe the first and second digital tubes // P0 = 0X00; // 0000 0000 means strobing all digital tubes WE = 0; //Latch bit selection data DU = 1; //Open segment selection latch P0 = 0X5B; // 0101 1011 displays "2" DU = 0; //Latch segment selection data while(1){ // P0 = 0X01; // When the value in the latch is locked, the value of the digital tube cannot be modified directly. The latch needs to be opened to modify it. } } Light up the three-digit number "3" #include #include #define uint unsigned int #define uchar unsigned char sbit DU = P2^6;//digital tube segment selection sbit WE = P2^7;//Nigital tube segment selection void main(){ // The main function itself will loop WE = 1; //Open bit select latch P0 = 0XF8; // 1111 1000 selects the first, second and third digital tubes // P0 = 0X00; // 0000 0000 means strobing all digital tubes WE = 0; //Latch bit selection data DU = 1; //Open segment selection latch P0 = 0X4F; // 0100 1111 displays "3" DU = 0; //Latch segment selection data while(1){ // P0 = 0X01; // When the value in the latch is locked, the value of the digital tube cannot be modified directly. The latch needs to be opened to modify it. } } Light up the last digit "8" of the digital tube #include #include #define uint unsigned int #define uchar unsigned char sbit DU = P2^6;//digital tube segment selection sbit WE = P2^7;//Nigital tube segment selection void main(){ // The main function itself will loop WE = 1; //Open bit select latch P0 = 0X7F; // 1111 1000 strobes the eighth digital tube // P0 = 0X00; // 0000 0000 means strobing all digital tubes WE = 0; //Latch bit selection data DU = 1; //Open segment selection latch P0 = 0X7F; // 0111 1111 displays "8" DU = 0; //Latch segment selection data while(1){ // P0 = 0X01; // When the value in the latch is locked, the value of the digital tube cannot be modified directly. The latch needs to be opened to modify it. } } Make the third (from left to right) digital tube display the number 6 #include #include #define uint unsigned int #define uchar unsigned char sbit DU = P2^6;//digital tube segment selection sbit WE = P2^7;//Nigital tube segment selection void main(){ // The main function itself will loop P0 = 0X00; //Clear broken code WE = 1; //Open bit select latch P0 = 0X03; // 0000 0011 Strobe the 3rd, 4th, 5th, 6th, 7th and 8th digital tubes // P0 = 0X00; // 0000 0000 means strobing all digital tubes WE = 0; //Latch bit selection data DU = 1; //Open segment selection latch P0 = 0X7D; // The corresponding digital tube letter acdefg of 0111 1101 displays "6" DU = 0; //Latch segment selection data }
Previous article:STC89C52 microcontroller digital tube dynamic display
Next article:STC89C52 microcontroller buzzer
Recommended ReadingLatest update time:2024-11-16 10:35
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- 【NXP Rapid IoT Review】+ Bluetooth Operation (3 Receiving Data)
- When the MCU is running, the contents stored in the EEPROM are all changed to FF. What is the reason?
- Xunwei-3399 development board QT system-using openssh
- How does a dishwasher achieve water level control?
- CC2530 General Purpose I/O
- RFID technology realizes the scale of hotel management
- [Qinheng RISC-V core CH582] SPI driver ST7735
- stm32 pwm wave control
- Zynq UltraScale+MPSOC Development Board Feature List
- Practical RF training tutorials for engineers