Two-color handsless clock design with AT89S51v as the control core

Publisher:东土大唐88Latest update time:2023-05-24 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Two-color handsless clock design with AT89S51 microcontroller as the control core

Figure 1 Main structural module


2.LED light module

The placement of the LED lights in the clock is shown in Figure 2:

Two-color handsless clock design with AT89S51 microcontroller as the control core

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.

Two-color handsless clock design with AT89S51 microcontroller as the control core

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.

Two-color handsless clock design with AT89S51 microcontroller as the control core

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.

Two-color handsless clock design with AT89S51 microcontroller as the control core

Figure 5 Workflow diagram


2. System program

Two-color handsless clock design with AT89S51 microcontroller as the control core

Two-color handsless clock design with AT89S51 microcontroller as the control core

Two-color handsless clock design with AT89S51 microcontroller as the control core

Two-color handsless clock design with AT89S51 microcontroller as the control core

Two-color handsless clock design with AT89S51 microcontroller as the control core

Two-color handsless clock design with AT89S51 microcontroller as the control core

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.


Reference address:Two-color handsless clock design with AT89S51v as the control core

Previous article:AT89C51 microcontroller and 74LS164 dynamic display interface
Next article:51 Microcontroller Programming Development (1) C Language Basics 1

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号