The circuit is very simple, I won't draw a picture, the four-digit digital tube is connected through two 74hc595, one 595 is responsible for segment selection, and the other 595 is responsible for bit selection. The timer interrupt of the microcontroller is used to realize the 0-100 digital cycle display. The program has passed my test.
Reference address:Timer interrupt 0~100 seconds
#include#define uint unsigned int #define uchar unsigned char sbit rck=P0^0; sbit sck=P0^1; sbit si=P0^2; uchar num[]={0x80,0xed,0x42,0x48,0x2c,0x18,0x10,0xcc,0x00,0x08}; uint b=0,i=0,j=0,k; void write_595(uchar x) // Initialize the 595 chip { for(k=0;k<8;k++) //shift register { x>>=1; sck=0; si=CY; sck=1; } } void date_danpianji()//Initialize the MCU timer { EA=1; //General interrupt enabled ET1=1; //Timer on TMOD=0X10; //Select timer working mode TH1=(65536-33333)/256; //Division is assigned to the upper eight bits TL1=(65536-33333)%256; //The remainder is assigned to the eighth bit TR1=1; //Start the timer } void main()//main function { date_danpianji(); //Call timer interrupt while(1) // loop { if(b==20) //Check if the interrupt function satisfies b==20, if so, execute { b=0; i++; if(i==10) { i=0; j++; if(j==10)j=0; } } write_595(num[j]); write_595(num[i]); rck = 0 ; rck = 1 ; } } void ext() interrupt 3 using 1 //timer interrupt { TH1=(65536-33333)/256; TL1=(65536-33333)%256; b++; }
Previous article:1602 LCD 8-bit data port dynamic display
Next article:Wireless identification device debugging experience
- Popular Resources
- Popular amplifiers
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
- 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
Guess you like
- CC2640R2: How to use the chip's internal Bootloader to burn the program
- Proteus emulation of micropython method
- What is the principle of the reading pen? How does it improve the accuracy of reading?
- Where is the lucky star? ——"Keysight Technology Double 11 Instrument Flash Sale"
- My design is equivalent to changing the original manual control to automatic control. The overall design idea is as follows, but at this stage it is still...
- Play with the Internet of Things and make a smart greenhouse model!
- I used the AD18STM32 library to import the chip, but the chip pins are incomplete
- MSP430 interrupt nesting mechanism
- IIC Protocol Analysis
- Award Ceremony | How do you purchase or select electronic components?