2016 International Conference on Manufacturing Construction and Energy Engineering (MCEE) ISBN: 978-1-60595-374-8 Based on a Single Chip Microcomputer to Realize Electronic Clock Design and Analysis Shu-Hua Bai and Su-Ling Li Abstract: The clock, since the beginning of the day of human invention, it has become an essential thing in people's life, but with the continuous development of the times and science and technology, people pay more and more attention to the time concept, so the higher the accuracy of time. So we need to design a new type of electronic clock. Electronic clock is the use of digital circuit to display seconds, minutes, when the device, compared with the traditional mechanical clock, it has a time accurate, intuitive display, no mechanical transmission device, etc., so it is widely used. With the continuous improvement of people's living environment, and the beautification of the digital electronic clock can be seen in many occasions. Among them, in order to achieve the use of single-chip electronic clock is the most common, its main features are: programming flexible, easy to expand the electronic clock function, the use of electronic clock issued a variety of control signals, high accuracy. This paper mainly introduces the method of realizing the electronic clock with the timer counter in the chip microcomputer. The design consists of a single chip microcomputer electronic clock with the necessary circuit, which is based on AT89S52 chip and LED digital tube. Compared with the traditional mechanical watch, it has a more powerful and perfect function. Its time period is 24 hours, it is marked with "59 seconds", in addition, it also has the function of the school. Keywords: Single chip computer, electronic clock, assembly 1. The development of contemporary digital clock 1.1 We know electronic clock has a long history, from the electric clock of 19 years of the republic of China, began in the mid - design of domestic transistors, semiconductor tubular bells, quartz clocks to research began in the late 70s, and today we used in the intelligent electronic clock. Electronic clock before there are many drawbacks, the bulky 1 Shuhua Bai lecturer, master, research direction: information processing, ideological and political management, Nanchang Institute of Technology. Nanchang, Jiangxi 330044, China. 2 Su Ling Li, Nanchang Institute of Technology. 207
appearance, on the function has a walking dead place, when time is not long, the accuracy is not high faults. Now both in appearance, and on the function, electronic clock had greatly improved. 1.2 It should be said that the clock timing function and human behavior and activities have close relations, then the effect of clock, there are a lot of people in your life, because you want to work and forget the time, thus miss out on important arrangement or plan, cause irreparable loss, repent at leisure. We want to develop good concept of time, you need electronic clock reminds us. Therefore, electronic clock has become essential in People's Daily life, it has a very wide range of applications, applied to the family and the station, wharf, theater, office and other public places, to people's life, study, work, entertainment, bring great convenience. 1.3 Design basic idea and main content, design an electronic product, first understand it can realize the function, the most basic function is to realize the time clock system, design of digital electronic clock here, it can realize the function of timing and the school, to electronic clock with electric automatic timing, design a button to reset the clock and the three keys to adjust time. The hardware design is simple, mainly including: monolithic integrated circuit, key circuit, driver circuit, and the LED display four parts. Microcontroller AT89C51 chip, it does not need to external expansion program storage, design circuit is very simple. Because only four buttons, so adopt independent type button makes the design more simple. Is displayed, minutes and seconds add two separators, using 8 bit digital tube, use commonly used 74 ls244 to drive the LED digital tube display characters. Simple digital clock can be realized when the school and hour function, the software using C language to achieve, mainly includes the main program, the key input program, display program, program timer and interrupt routine software modules. The original application to join the schematic diagram, simulation of electronic clock, in seconds, minutes and seconds count and display. Including 60 seconds and can be divided into hexadecimal, counting for 24 hexadecimal. Can be realized through key clock reset and minutes and seconds, when the correction. 2. The overall design of simple digital clock system With microcontroller technology as the core, and fully apply various peripheral circuit components, design one through the display shows the time (hours, minutes, seconds) electronic clock display solution scheme 1: static display is when the CPU will display the word, or field code to output display can show to display the character, if the CPU not to rewrite it, it will continue; Static display hardware overhead is large, complex circuit, slow speed information refresh. Scheme 2: dynamic display is a one to take turns to light display individual bits (scan). For each display, every once in a while to light a; Dynamic display energy consumption is small, but the program is relatively complex. Dynamic display hardware connection is simple and fast information refresh. Because of this design is to display of time, such as the static display, is occupied by the 208
I/O port is more, the circuit is complex, so the choice is the second scheme, adopt the dynamic display. 3. The hardware design and analysis of the electronic clock 3.1 Hardware design principle, the clock circuit is the core of AT89C51, its internal wipe again and again read only with 2 KB Flash program memory data and 128 bytes of random access memory (RAM), without external program memory. Computer clock without a lot of operations and store data, the existing 128 b on chip RAM has been able to meet the requirements, also need not extended RAM. System equipped with eight LED digital tube display and three independent type key, P0 mouth was used as the keyboard interface circuit, P1 and P3 mouth as segment code and bit code output, and in the field code output to 74 ls245 chip, with the chip to drive the LED digital tube display. Using P0.0, P0.1 and P0.2 as the key input port. 3.2 The minimum clock circuit and reset circuit are the single chip microcomputer minimum essential in the single chip microcomputer application system clock circuit diagram, as shown in figure 3-1: XTAL1 and XTAL2 are the input and output of reverse amplifier. The reverse amplifier can be configured to the on-chip oscillator. Crystal and ceramic oscillations can be adopted. Such as driven by external clock source device, XTAL2 should not be answered. More input to the internal clock signal through a binary frequency trigger, so the external clock signal pulse width do not have any requirements, but must ensure that the pulse width of high and low level requirements. +5V C1 RST R1 TA98S51 Figure 3-1. MCU clock circuit diagram. Figure 3-2. On the reset circuit. Reset is to make the single chip microcomputer or other components in the system in a certain number of initial state. Reset the microcontroller's job is to start, when the microcontroller RST pin into high level and keep the two machine cycle, single chip microcomputer internal hold reset operation (continues to maintain a high level, if the pin MCU is in loop reset state). Practical applications, the reset operation there are two basic forms: one kind is on electric reset, another kind is to electricity and reset buttons are effective. Because of this design USES is power on reset, so here just introduced the 209
electric reset and shown in the figure 3-2 below: On electric reset request after turning on the power supply, microcomputer automatic reset operation. Commonly used on electric reset as shown in the above. Electric moment on the RST pin for high level, as the capacitor C1 charging, high level of RST pin will gradually decline. 3.3 The principle diagram of the single-chip microcomputer to realize electronic clock system. AT89C51 P1 mouth access three buttons, pair, minutes and seconds to adjust. P0 port output field code, control to display character, external 74 ls245 chip, drive LED display. P3 output bit code, to control to display, its principle diagram is shown in figure 3-3. 19 18 9 U1 XTAL1 XTAL2 RST P0.0/AD0 P0.1/AD1 P0.2/AD2 P0.3/AD3 P0.4/AD4 P0.5/AD5 P0.6/AD6 P0.7/AD7 39 38 37 36 35 34 33 32 D0 D1 D2 D3 D4 D5 D6 D7 D0 D1 D2 D3 D4 D5 D6 D7 2 3 4 5 6 7 8 9 U2 A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 18 17 16 15 14 13 12 11 S0 S1 S2 S3 S4 S5 S6 S7 29 30 31 PSEN ALE EA P2.0/A8 P2.1/A9 P2.2/A10 P2.3/A11 P2.4/A12 P2.5/A13 P2.6/A14 P2.7/A15 21 22 23 24 25 26 27 28 19 1 CE AB/BA 74LS245 1 2 3 4 5 6 7 8 P1.0/T2 P1.1/T2EX P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 P3.0/RXD P3.1/TXD P3.2/INT0 P3.3/INT1 P3.4/T0 P3.5/T1 P3.6/WR P3.7/RD 10 11 12 13 14 15 16 17 B1 B2 B3 B4 B5 B6 B7 B8 AT89C52 Figure 3-3. System schematic diagram. When plugged into a power supply, digital electronic clock timing starts in seconds. Running state, press the control button S - SET, adjust seconds; Press the M - SET to adjust minute; Press the H - the SET of hours to adjust. So, through three key pair, to adjust the minutes and seconds, respectively, so as to realize adjustable. 4. Conclusion Because the types of MCU, and models of mixed, this also is the difficulty, so the MCS - 51 series products, is a typical method of learning. For similar microcontroller programming of assembly process, is also a very interesting process. Introduced from the first application circuit, and introduces their application method, so that can quickly grasp their application. In order to complete a single chip design work, must, in turn, do the following work: 1, the hardware circuit design, assembly and debugging; 2, the writing of the application software, debugging; 3, complete application software debugging, curing and offline run. And we should try to be in the hardware system design: 1, as far as possible choose typical circuit, the routine use of method and is in 210
line with the single chip microcomputer; 2, under the premise that fully meet the requirements of system function, make allowance for secondary development. 3, the hardware structure design and software design consideration together; 4, related parts must strive to match the performance of the whole system; 5, should have the reliability and anti-jamming hardware design; 6, give full consideration to MCU belt drive capacity. References [1]. Zhu Yongjin editor, such as the single-chip computer application technology, labor, social security of China Publishing House. [2]. Peng Dongming. WeiYouChun editor, the SCM experiment tutorial, University of Science and Technology Press. [3]. Zhu Gujian editor, the single-chip microcomputer principle and application, Mechanical Industry Publishing House. [4]. Hu Hancai editor, the single chip microcomputer principle and interface technology, Tsinghua University Press. [5]. Zhang Wei editor, the single-chip microcomputer principle and application, Mechanical Industry Publishing House. 211