This article proposes a design scheme for a two-color handless clock based on a single-chip microcomputer. The hardware of this solution uses AT89S51 microcontroller as the control core, uses 74LS154 (4-16 line decoder) to expand the I/O port to control the display of the clock, and uses 12 red LED lights to indicate hours and 12 green LED lights to indicate minutes. Changes every 5 minutes.
Only two LED lights are on at the same time, which is energy-saving, convenient, easy to identify, and full of personality.
1. Overall structure
1. Main structure module
This design is divided into three modules: core control, display control and time adjustment. The main structure is shown in Figure 1.
Figure 1 Main structural module
2.LED light module
The placement of the LED lights in the clock is shown in Figure 2:
Figure 2 (Red LED light indicates hours, green LED light indicates minutes)
2. Hardware circuit design
1. Main control circuit
The main control circuit is controlled by AT89S51 microcontroller, 74LS154 (4-16 decoder) is used for I/O port expansion, and an 11.0952MHz crystal oscillator is used. AT89S51 has four groups of I/O port lines P0, P1, P2 and P3, each group has 8 ports. This design uses three groups of lines P1, P2 and P3. The P1.0~P1.3 ports are connected to the 74LS154 input port. The 74LS154 (0~11) The output ports are each connected to a red LED light to control the hour display. The P2.0~P2.3 ports are connected to the 74LS154 input port. The 74LS154 (0~11) output ports are each connected to a green LED light to control the hour display. Minutes displayed. Under the control of the program, a two-color handless clock with only two lights on at the same time is realized, where red represents the hour and green represents the minute. For example, at 1:10, 1 red LED light is on and 2 green LED lights are on. Its main control circuit is shown in Figure 3.
Figure 3 Main control circuit
2. Driver and LED display circuit
Use 24 ports of 74LS154 (2 pieces) to control the on and off of 24 LED light-emitting diodes. When the port outputs low level, the LED light is on, otherwise, the LED light is off. Use a DC 5V power supply to power AT89S51 and 24 LED lights, and control each LED light on and off through the program to display the time. Its driving circuit is shown in Figure 4.
3. Software design
1. Workflow
The workflow is shown in Figure 5. The description is as follows:
T0 of AT89S51 works in the timing state. The P1 port controls the hour display, and the P2 port controls the minute display. T0 is timed for 60ms each time, and the cycle is 5000 times, that is, the timer is 5min. The output value of the P2 port is increased by 1. The minute display jumps one grid, and the minute jumps every time. 12 grids (1 hour), the P1 port value adds 1, the hour display jumps one grid, P2 port sends 0, and the cycle starts again. When the hour display jumps 12 grids (12 hours), P1 port sends 0 and the cycle starts again. INT0 and INT1 interrupts are used for hour and minute adjustment respectively.
Figure 5 Workflow diagram
2. System program
4. Summary
The two-color handless clock designed in this article based on a single-chip microcomputer only keeps two LED lights on at the same time, which consumes less money, is more energy-saving, and the two-color display is easier to identify.
Previous article:AT89C51 microcontroller and 74LS164 dynamic display interface
Next article:51 Microcontroller Programming Development (1) C Language Basics 1
- 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
- A First Look at TouchGFX (Part 2)
- ATX switching power supply standby circuit
- I2C-24C04 and buzzer This program problem
- Domestic featured new products: Yuanchuangda releases multiple RF power devices
- Power Monitor by AnalogySemi
- Capacitor ESD testing
- About the mapping of GPIO pins of FPGA development board and expansion modules
- [DIY] How to make a children's toy called "Story Chicken" using Raspberry Pi 3B+
- Disassemble the scanning galvanometer of the laser marking machine to see the internal circuit
- How is the microcontroller PWM to 4-20mA circuit usually implemented?