However, when using digital tube output, if no delay statement is added, the display will always be confusing, and sometimes the numbers cannot be distinguished at all.
If there is a 1ms delay after the data is transmitted, the display confusion will improve.
At the same time, it is found that the longer the delay time, the better the display effect. However, of course, the corresponding display stability will also decrease, that is, the digital tube flickers.
The program has used the "Eliminate" statement in the reference book after sending the segment selection data:
1 dula=1; 2 P0=table[k]; 3 dula=0; 4 P0=0xff; //"disappear"
But this statement is only effective when there is a delay. If I don't write a delay statement, the display will still be confusing.
Although the delay in the display process will not affect the interrupt timing, I don't want to rely on the delay written by the for statement.
So I tried many methods to solve this problem. My goal was to make the digital tube display normally without writing delay statements.
I have tried sending data to P0 first, then opening the latch, and then closing it immediately.
like:
1 P0=table[k]; 2 dula=1; 3 dula=0;
But the problem remains
I also tried locking the other latch (i.e. sending a low level once) before opening any latch, but it still didn't work.
Finally, I found that I needed to add this code before outputting the data:
1 P0=0xff; 2 wela=1; 3 wela=0; 4 P0=0x00; 5 dula=1; 6 dula=0; //initialize to eliminate interference
After adding this code, the digital tube display is no longer chaotic. The function of the statement is similar to initializing the contents of the latch.
After two days of research, I finally figured out the trick. Now I share it with you: (Please indicate the source if you reprint it)
The fundamental reason why the digital tube has a "shadow" is that the segment selection and bit selection data cannot be delivered at the same time.
To explain it in detail: After I changed the value of the bit selection (changed the digital tube to be displayed), I changed the value of the segment selection (changed the number to be displayed). In the meantime, there was a small time interval, the value of the bit selection changed, but the value of the segment selection did not change. In other words, I changed the digital tube to be displayed, but this digital tube displayed the number of the previous digital tube! Thinking of this, I was enlightened! Of course, vice versa, if you select the segment first and then the bit selection, there will be the same problem. Please think about it yourself.
So it is not difficult to explain the role of the above code, which is to display the previous digital tube as blank (or not select any digital tube) before output.
So obviously this initialization code can be simplified, but it depends on whether you select the segment first or the bit first. If you select the bit first, then you have to clear the segment selection data.
1 P0=0x00; 2 dula=1; 3 dula=0;
The same is true in reverse. If you select the segment first, then clear the bit selection data.
Someone asked a similar question on Baidu Encyclopedia, which I quote here for your reference:
Experience summary: The display of the digital tube, the segment selection data and the bit selection data should be close together, and no other statements should be mixed in between. In other words, calculation should be done first, and data should be transmitted all at once at the end.
Previous article:89S51 single chip microcomputer realizes the timing program with error of several microseconds
Next article:51 MCU learning summary example
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- 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
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- 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)
- MSP430__SD card FAT16 reading and writing program based on MSP430 learning and development system
- This week's highlights
- MicroPython version 1.13 released
- How to create a compilation environment for the SINA33 development board
- What are the main parameters of electronic components? What are their respective characteristics?
- Regarding the issue of analog quantity acquisition, please ask the seniors
- [RVB2601 Creative Application Development] MP3 Player
- 【IoT Development Notes】Gizwits Cloud Device Transplantation RT-Thread
- Semiconductor Industry Online Member System Questionnaire Survey Come and participate to win a 50 yuan Jingdong card! It can be done in 3 minutes~
- DC charging efficiency issues