1. Proteus simulation diagram
The left side is a common cathode tube, which lights up at a high level; the right side is a common anode digital tube, which lights up at a low level
2.keli code
#include sbit key1=P3^0; sbit key2=P3^1; int CC_num[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; int CC_I=0,CA_I=0; void delay_ms(int ms) { int i,j; for(i=0;i } void key1_exam() { if(key1 == 0) { //Button delay debounce delay_ms(20); if(key1 == 0) { if(CC_I>=9) { CC_I=0; } else { CC_I++; } P1=CC_num[CC_I]; } while(!key1); } } void key2_exam() { if(key2 == 0) { //Button delay debounce delay_ms(20); if(key2 == 0) { if(CA_I>=9) { CA_I=0; } else { CA_I++; } P2=~CC_num[CA_I]; } while(!key2); } } int main() { P1=CC_num[CC_I]; P2=~CC_num[CA_I]; while(1) { key1_exam(); key2_exam(); } }
Previous article:89C51 single chip microcomputer key control digital tube dynamic display 0~9
Next article:89C51 MCU timer 0, 1 control LED 1, 0.5 seconds flashing
- 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
- 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
- MSP430F5529&LCD1602 Program
- Ultra-wideband technology: the nemesis of shadows and blind spots in wireless technology
- RF Basics - Professional Terminology
- MSP430 MCU Example 12-4X4 Matrix Keyboard Key Value Display
- Qorvo Online Design Conference-The new Wi-Fi 6 standard is changing the connectivity environment
- BLDC back EMF is a bit weird
- How do I set the impedance of the differential line in ALTIUM19?
- EEWORLD University Hall----Live Replay: Introduction to Keysight's New Optical Communication Test Solution
- A complete list of filter circuits, save it for future use!
- How to choose FPGA development board