The following is a C program example of countdown and countdown to illustrate the application of the LED digital display function display(x).
(1) Hardware circuit
Use the PIC16F84A 4-digit LED digital display circuit to make a 2-digit digital tube (the other two digits are not used) 99-0 countdown and countdown display. The countdown is in seconds and the countdown is in minutes. As long as there is a display function display(), the format of the counting and timing program is the same.
(2) The C source program listing for 99~0 (in minutes) is as follows. The program name is pic13.c.
Note: a For the above C source program, you only need to change the unsigned integer variable d (unsignedint d) in the display function display(x) from 5700 to 95 to turn it into a countdown program from 99 to 0 in seconds, because the value of d determines the time of the unit digit displayed by the digital tube (it is unique).
b. If you want to use the above program and have strict requirements on the accuracy of timing (minutes or seconds), you can fine-tune the integer variable d value (57000) based on the standard clock to achieve high-precision minute or second timing.
c. All the C source programs of the above PIC microcontrollers are executable and can be used by beginners without any worries.
Previous article:DS1302 device interface code on PIC microcontroller
Next article:PIC microcontroller pin interrupt program design skills
Recommended ReadingLatest update time:2024-11-16 17:44
- 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
- Today's Live Broadcast | Outlook for DLP Technology in AR HUD and In-Vehicle Display Applications
- Award-winning live broadcast: Focus on "TI FPD-Link III automotive chipset" Ideal solution for automotive video transmission
- Playing with Zynq Serial 1——Zynq Linux boot process
- 【AT-START-F425 Review】Overclocking Performance of AT32F425
- I can't access GitHub anymore, what should I do? I can't access it at all
- [Mill MYB-YT507 development board trial experience] opencv face detection
- TouchGFX application development based on STM32CubeMX on STM32H7A3 processor - HelloWorld!
- How large a fifo capacity can ep4ce6 achieve?
- Introduction to the causes of TPS79633KTTR voltage instability
- Bicycle modification series: colorful taillights