If you have a timer that reminds you when the time you set is up, you no longer have to worry about forgetting to cook on the gas stove, causing the food to burn or the water to dry up, or taking a nap too long. This article introduces a countdown timer made with the AT89C205l microcontroller. The timer can be set from 1 to 99 minutes. When the time is up, it will use a beep alarm to remind you, and the remaining time will be displayed with a digital tube during the timing process.
Circuit working principle:
Countdown Timer The circuit is shown in the figure. The circuit consists of a single-chip microcomputer circuit, a digital display circuit and an alarm circuit.
AT89C2051, X1, R1, C1 and other components constitute the single-chip microcomputer circuit. Rl and C1 constitute the reset circuit of the single-chip microcomputer. At the moment the power is turned on, due to the charging process of C1 by the power voltage, the reset terminal 1 pin of the single-chip microcomputer AT89C2051 obtains a high-level reset pulse, making the single-chip microcomputer enter the initial state.
The digital tubes DS1, DS2, transistors VT2, VT3, resistors R3~R11, etc. form a digital display circuit. Two digital tubes display minutes and tenths respectively. Since each digital tube has seven stroke segment AG display units (the decimal point DP is not used here), the conventional driving method requires 7×2=14 I/O lines, which is obviously not enough for AT89C2051. Therefore, the dynamic scanning display method is used here to solve this problem, which only requires 7+2=9 I/O lines. Dynamic scanning display is to connect the same-named ends of the seven stroke segments A~G of the two digital tubes together, and the common end COM of each digital tube is independently controlled by the I/0 line. When AT89C2051 sends the font code to the font output port, all digital tubes receive the same font code, but which bit is displayed depends on the COM end, and the COM end is controlled by P3.5 and P3.7 ports. P3.5 and P3.7 ports use a time-sharing method to control the COM ends of the two digital tubes in turn through VT2 and VT3, so that the two digital tubes light up in turn. Since the P1 port of AT89C2051 can inject a large current, a common anode digital tube is used here.
In the process of scanning by turns, the lighting time of each digital tube is very short. Due to the phenomenon of human visual persistence, although the digital tubes are not actually lit at the same time, the impression given is that it is a set of stable display data without flickering.
The light-emitting diode VD1 indicates the working status. It flashes during the timing period and does not display during the rest of the time. VT1, R2, sp1, etc. form an alarm circuit, which sounds an alarm when the timing ends.
The main program flow chart is shown in the figure. The program is written in assembly language. The program consists of modules such as the main program, timing interrupt subroutine, digital display subroutine, and delay subroutine. The main program consists of keyboard processing, alarm and other parts.
Due to the dynamic scanning display method, although the circuit is simplified and the IO line is saved, it takes up more CPU time, so it is necessary to use the method of calling the timer interrupt to reduce the CPU burden. The timer timing is 60ms, and calling 1000 times is 1 minute. The delay subroutine is mainly used for display subroutine and alarm program to call, and the delay time is 0.5ms. The delay time determines the refresh frequency of the digital display and the audio frequency of the alarm, both of which are 1000Hz.
The output of the glyph code uses P1.1~P1.7 of the port, P1.0 is empty, and the data output by port P1 is obtained by looking up the table. The corresponding relationship between the data bit and the glyph is shown in the attached table. Because the digital tube is a common positive type, the pen segment is bright when the corresponding output bit is 0. The memory units 20h and 21h are used as the storage units of the quantile and tenth digits respectively, and their values are used as the address values of the table lookup. In the table, P1.0 is empty, and its value is 1.
The dynamic scanning display is completed by the digital display subroutine. When the quantile is sent to the P1 port, P3.5 outputs a low level, vT3 is turned on, and the digital tube DS2 displays the quantile; when the tenth digit is sent to the P1 port, P3.7 outputs a low level, vT2 is turned on, and the digital tube displays the tenth digit. In this way, the two-digit time can be displayed by taking turns. Due to the use of the dynamic scanning display method, the digital display subroutine must also be called in time-sharing in the keyboard processing, alarm and other parts of the main program. Only in this way can the digital time be displayed correctly for operation.
The printed circuit board uses a universal circuit board, ICl uses an AT89C2051 microcontroller, a 12MHz quartz crystal, D1 and D2 use common anode LED digital tubes, and a passive electromagnetic buzzer with an impedance of 16Ω. The parameters of the remaining components are shown in the first page.
Before installation, compile the assembly source program into the target file, i.e., the HEX file, and then use the programmer to write the HEX file into the AT89C205 1 chip.
When setting the timing time, press s1 or s2 once to increase the corresponding digit by 1. When it reaches 9, press it again to return to 0. If you do not release it after pressing it, the digits will continue to flip, jumping one number every 0.2 seconds. Release it when it reaches the number you need.
Note: The initial value of the timing time after power-on is 00. You can modify the program to adjust this initial value as needed. For example, if you want to adjust the initial value to 45 minutes, you only need to modify the 9th and 10th lines of the program to mov 20h, #5h and mov 21h, #4h.
Previous article:Design of Sine Wave Output Inverter
Next article:Application of ICL7135 and PIC microcontroller in temperature transmitter
- Popular Resources
- Popular amplifiers
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- 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
- Altium Designer 19.1.6, Reports BOM does not generate the BOM table, and AD19 will be stuck. What is the reason?
- Do you really know the impact of AC coupling capacitors?
- [Digi-Key Innovation Design Competition] Material Unboxing + ESP32-S3-BOX
- EEWORLD University - Code reuse demonstration using TI SimpleLink? MCU platform
- STM32 RTC registers
- Inductance calculation formula
- [NXP Rapid IoT Review] + Recommendation for NXP Rapid IoT to connect the differential ADC input port of KW64 to the expansion port
- [Allwinner V853 heterogeneous AI intelligent vision development board review] "mkimage command not found" error solution...
- Live broadcast with prizes | Sign up for TI's June Embedded Processing Live Theme Week to get a glimpse of new products in industrial scenarios!
- [MSP430] Practical ADC use, internal temperature measurement use