Schematic diagram of microcontroller clock circuit

Publisher:qin199099Latest update time:2014-04-09 Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Schematic diagram of microcontroller clock circuit

The following uses an actual clock circuit to illustrate the software programming method of the timer. The clock is the most common timing tool that displays hours, minutes, and seconds as units. It is a typical application representative. The
minimum timing unit of the clock is seconds, but if a single-chip timer is used for timing, if a 6.0MHz crystal oscillator is used, even if it works in working mode 1, the maximum timing time can only reach 131ms, so we can take each timing time as 125ms, so that the timer overflows 8 times (125ms╳8=1000ms) to get the minimum timing unit of seconds. It is easy to achieve 8 counts using software methods.
Timer 1 is used in the circuit, working in working mode 1, and the timer performs 125ms timing. Use the interrupt method to

The number of overflows accumulates, and when it reaches 8 times, 1 second is obtained.
To realize the carry of minutes and hours in the accumulation of a clock, multiple bases are used. The carry of seconds, minutes and hours is in decimal, while the carry of seconds to minutes and the carry of minutes to hours are in sexagesimal. There is a twelve-hour system or a twenty-four-hour system every day, which are duodecimal and twentieth-century respectively. From seconds to minutes and from minutes to hours can be realized by software accumulation and numerical comparison methods.
In the internal RAM of the single-chip microcomputer, a display buffer needs to be set. The displayed hour, minute and second values ​​are taken from the display buffer. Four units are set in the RAM as display buffers, namely 7AH, 7BH and 7CH. In order to facilitate the description of the circuit and principle, the second value is not displayed here. The carry of seconds is realized by flashing the minute value. In this way, there are four LEDs to display the hour and minute values ​​respectively. At the same time, the clock needs to be calibrated. In the program, a display code table needs to be set. The value to be displayed sends the real code value for display to the LED through the table lookup instruction. In the circuit, the micro switches of P3.4 and P3.5 of the single-chip microcomputer AT89C2051 are connected to realize the correction of hours and minutes. Each time the hour or minute value is pressed, 1 is added. The value is accumulated by pressing it continuously to realize the calibration of the clock.
A buzzer is also set in the circuit for simple time reporting. For example, it can be set to get up at 7:30 in the morning and get up at 1:30 in the afternoon. Each time it rings for 1 minute, 1 second, and stops for 2 seconds, instead of ringing continuously. This program uses the 12-hour system. For this reason, the corresponding flags should be set in the program to facilitate the recognition of the main program. There are also several related flags in the timing program, which mainly control the direction of the program flow. The program has made detailed comments, which will not be repeated here (see Appendix).

In Figure 5, the hardware circuit still uses the low-cost AT89C2051 microcontroller as the microprocessor unit. This chip is compatible with the C51 instruction system. Programs written on the C51 can be easily transplanted to this chip without any modification.

As the field bit drive output of LED, the "carry" of the second uses the fractional value flashing prompt, which is on for 0.5 seconds and off for 0.5 seconds. P3.1-P3.3 is used for bit drive, and the display is displayed in a dynamic scanning mode. The display time of each LED can be between 10-25ms. The scanning frequency cannot be too high, otherwise the display time of each LED is too short and the brightness is too low, which is not easy to watch. It is better to make the naked eye not feel the LED flickering. For the sake of intuitiveness, the drive output does not use integrated circuits, but uses discrete components-transistors, but the working principle is the same.
This circuit structure determines that the LED uses a common anode digital tube, which can use LQ5101BS ordinary light-emitting diodes, and the driving transistor can use the easily available 2SA1015 and 2SC1815 models. Of course, low-power transistors such as S9012, S9013, S9014, 2N5401, 2N5555 can also be used. There are no special requirements for other devices. To facilitate the experiment, the single-chip microcomputer AT89C2051 can use a DIP20P socket. After the program is compiled and debugged, it can be burned into the AT89C2051. It is worth mentioning that the AT89C2051 is a Falsh program memory, and the program can be erased and written repeatedly, which is very convenient for experiments.

Keywords:MCU Reference address:Schematic diagram of microcontroller clock circuit

Previous article:Other extinguishing super regenerative receiving circuit
Next article:RF Input Stage Circuit

Recommended ReadingLatest update time:2024-11-16 15:35

51 MCU plays music (I): buzzer
buzzer Buzzers are divided into active (vibration) and passive. Active buzzers cannot control the frequency, so passive buzzers can only play music. Passive buzzers need to control the input signal to make sounds. The simplest way is to input a square wave signal. By controlling the frequency of the square wave throug
[Microcontroller]
51 MCU plays music (I): buzzer
Introduction to the Principle of 51 Single Chip Microcomputer
A single-chip microcomputer is a control chip, a miniature computer, and with the addition of a crystal oscillator, memory, address latch, logic gate, seven-segment decoder (display), buttons (similar to a keyboard), expansion chips, interfaces, etc., that is a single-chip microcomputer system. The following is an i
[Microcontroller]
Introduction to the Principle of 51 Single Chip Microcomputer
Introduction to 51 MCU——LCD1602
1. Introduction to LCD1602 LCD (short for Liquid Crystal Display) liquid crystal display. The structure of LCD is to place a liquid crystal box between two parallel glass substrates, set TFT (thin film transistor) on the lower substrate glass, and set color filter on the upper substrate glass. The signal and voltage
[Microcontroller]
Introduction to 51 MCU——LCD1602
What are the differences in the P0~P3 port structures of the MCS-51 microcontroller?
What are the differences in the structure of the P0 to P3 ports of the MCS-51 microcontroller? What should be paid attention to when using them as general I/O ports to input data? Answer: P2 port is a dual-function port. It is a general I/O port and a high 8-bit address port when accessing external memory in bus mod
[Microcontroller]
Introduction to high-precision and low-cost temperature measurement solutions based on single-chip microcomputers
  This article introduces a digital temperature sensor SD5075 with an I2C communication interface to achieve temperature measurement function. The software and hardware design schemes are described. The temperature resolution of the temperature measurement device is 0.1℃, and the typical error of the temperature measur
[Microcontroller]
Introduction to high-precision and low-cost temperature measurement solutions based on single-chip microcomputers
Intel's Silicon Labs launches OLEA U310 automotive SoC, which can replace six standard MCUs
On June 12, Silicon Mobility, a company in the electric vehicle motor control field, released the automotive field programmable control unit OLEA U310, claiming that a single OLEA U310 SoC can replace up to 6 standard MCUs. Silicon Mobility is a French company that specializes in the design of motor control chi
[Automotive Electronics]
Intel's Silicon Labs launches OLEA U310 automotive SoC, which can replace six standard MCUs
How to quickly get started with microcontrollers? What are the self-study tutorials for microcontrollers?
How to quickly get started with microcontroller development? Baidu has a lot of advertisements, and then there are messy articles, which is dizzying. At the top of the list are training institutions, followed by a lot of articles. Some suggest self-study, some suggest enrolling in classes for training, some suggest le
[Microcontroller]
SEPTNY256 single chip microcomputer switching power supply and its application
1 Performance characteristics of TNY256   ·Built-in automatic restart circuit, no external components required. Once output short circuit or control loop open circuit failure occurs, the duty cycle can be reduced to protect the chip.   ·In the input DC high-voltage circuit, there is no need to use a clamp protectio
[Microcontroller]
Latest Analog Electronics Articles
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号