With the continuous development of the economy, people's requirements for the quality of life are constantly improving. In terms of electronic technology, manufacturers have also continuously introduced various electronic products to meet people's needs, and the electronic perpetual calendar conforms to people's requirements for time. However, in addition to displaying the time, the traditional electronic perpetual calendar has relatively simple functions and has gradually lost the market. In view of this situation, the electronic perpetual calendar introduced in this article uses the control technology based on the AT89C51 single-chip microcomputer, and combines the voice recording and playback module ISD1420 and infrared remote control technology, so that it has the functions of remote control time adjustment, voice timekeeping, etc. It has a certain novelty It is more convenient to use and has a certain market prospect.
1. The overall design of the voice electronic calendar system
The overall design block diagram of the system is shown in Figure 1. The hardware structure of this system is mainly composed of the main control chip AT89C51 single-chip microcomputer, the infrared receiving circuit composed of the integrated infrared receiving head, the real-time clock chip DS1302, the voice recording and playback chip ISD1420 and the digital tube display drive circuit. The system uses the real-time clock chip DS1302 to generate time information such as year, month, day, hour, minute, second, week, etc. The time information is processed by the single-chip microcomputer and sent to the digital tube display drive circuit; the infrared receiving circuit is used to receive and demodulate infrared The control signal sent by the remote control is recognized by the single-chip microcomputer to issue a time adjustment or voice timekeeping command; the voice recording and playback chip ISD1420 receives the playback command and combines the stored voice data according to the voice information address sent by the microcontroller The corresponding voice information realizes the voice timekeeping function.
2. Selection of key components in the electronic calendar system
2.1 AT89C51 MCU
AT89C51 is a 51 series single chip microcomputer produced by ATMEL. Its internal resources and port definitions are compatible with MCS-51 single chip microcomputer. In addition, the built-in flashROM of the chip allows repeated programming and writing more than 1000 times, which is suitable for use in the development stage.
2.2 Serial clock chip DS1302
DS1302 is a clock chip with real-time clock/calendar and 31-byte static RAM introduced by DALLAS. It communicates with the microcontroller through a serial interface. The real-time clock/calendar circuit provides time information such as seconds, minutes, hours, days, weeks, months, years, etc. The number of days in a month and the number of days in a leap year can be adjusted automatically, and the clock operation is determined by the AM/PM flag to use 24 or 12 hours Time format. Synchronous serial communication can be adopted between DS1302 and the single-chip microcomputer. Only 3 wires of reset line RST, I/O data line and SCLK serial clock line are required to complete data communication. The DS1302 data transmission method has single-byte and multi-byte transmission methods. According to the timing of the control command word and data transmission, the single-chip microcomputer can reset the time and read the real-time time of the DS1302. The power consumption of DS1302 is very low when working, and the power is less than 1mW when keeping data and clock information. DS1302 is widely used in product fields such as telephones, faxes, portable instruments, and battery-powered instruments.
2.3 Voice recording and playback chip ISD1420
The ISD1420 chip adopts CMOS technology, the single-chip recording and playback time is 20 seconds, and the sound quality is good. After the recording and playback operation is over, the chip automatically enters a low-power and power-saving mode with only 0.5uA power consumption. The sampling frequency of the chip is from 5.3, 6.4 to 8.0KHz, the on-chip information can be stored for 100 years (no backup power supply is required), and the single EEPROM can record repeatedly 100,000 times.
The recording and playback operation of ISD1420 is controlled by /REC, /PLAYE, /PLAYL, and /RELED. /REC is the recording control terminal, low level is effective. As long as /REC goes low, the chip starts recording. When /REC becomes high or the memory is full, the recording cycle ends, and the chip automatically writes an end mark (EOM), so that subsequent playback operations can be stopped in time to achieve the function of segmented recording. /PLAYE is the edge-triggered playback end. When a falling edge occurs, the chip starts to play. Play the sound until the EOM mark or the end of the memory, after which the chip automatically enters the power saving state. After the recording or playback ends, the chip automatically enters the power-saving state. When the recording indicator (/RECLED) is in the recording state, this end is low and the LED can be driven. In addition, when the playback encounters the EOM mark, this terminal outputs a low-level pulse.
2.4 Integrated infrared receiver
The receiving part of the infrared remote control system uses an integrated infrared receiver LT0038 to receive the control signal sent by the TV remote control. LT0038 is a plastic integrated infrared receiver. It is an integrated circuit that integrates infrared reception, amplification and shaping. It can complete all the work from infrared reception to output compatible with TTL level signals without any external components. When the infrared signal is low, it is high level. It is suitable for various infrared remote control systems and infrared data transmission. There are many dedicated chips for remote control transmitters, which can be divided into two categories: pulse width modulation and pulse phase modulation according to the encoding format. In this system, the remote control of the TV is directly used as the transmitting part, and the codes of its buttons are directly used.
3. Hardware design of electronic calendar
(1) Display part: In order to reduce the occupation of the port of the single-chip microcomputer and meet the requirements of the driving current of the digital tube, the system uses the serial-parallel conversion chip 74LS164 as the driving chip, and outputs to the serial port of the single-chip microcomputer when the single-chip microcomputer is in working mode 0 The data is serial-parallel converted and used as the segment code of the digital tube to drive the digital tube to display data. As the perpetual calendar uses more than a dozen digital tubes, two 74LS164 expansions are used here to drive the upper and lower two sets of digital tubes respectively. The nixie tube display adopts dynamic scanning technology, and the P0 port is used to light up the nixie tubes one by one.
(2) Clock interface part: The SCLK, RST, and I/O ports of the serial clock chip are respectively connected to P1.0, P1.1, and P1.2 of the microcontroller. According to the sequence diagram of DS1302 data transmission, use software simulation to complete serial data transmission. The VCC2 of DS1302 is connected to a 3.6V lithium battery as a backup power supply after the main power supply fails.
(3) Infrared remote control receiving interface part: the output terminal of the integrated infrared receiving head is connected to the external interrupt 0 port of the microcontroller. When the remote control sends a control command, the integrated infrared receiving head demodulates the received signal, decodes and sends it to the microcontroller Send an interrupt request to make the microcontroller respond to the command request from the remote control.
(4) Voice recording and playback interface: The P2 port of the single-chip microcomputer is connected to A0-A7 of ISD1420 as the address selection line. ISD1420's /PLAYL, /REC, /RELED are respectively connected to the P1.5, P1.6, and P1.7 ports of the microcontroller. When recording, the single-chip microcomputer sends out the address of the ISD1420 recording and playback voice through the P2 port, and sets the /REC port to low level through the P1.6 port, the ISD1420 starts recording from the specified address, and when the P1.6 port is cleared, the recording stops, ISD1420 EOM is automatically added internally. When playing sound, the single-chip microcomputer outputs the address of the specified playback segment from the P2 port, and sets /PLAYL to low level through the P1.5 port. ISD1420 starts to play from the specified address, and when it encounters the end of segment mark EOM Stop, the single-chip microcomputer uses the EOM mark output from the RECLED to start sending out the playback address of the next segment, so that continuous playback can realize the function of voice timekeeping.
4. Software design of electronic calendar system
The software design of the system is realized by single-chip C language programming. It mainly includes several program modules including DS1302 and MCU interface program, MCU response to infrared remote control signal interrupt processing program, MCU control IS1420 voice recording and playback program and MCU serial output to 74LS164 display driver and other program modules. The serial clock chip DS1302 and the interface program of the single-chip microcomputer and the serial port of the single-chip microcomputer are in working mode. The serial-to-parallel conversion program through 74LS164 has been introduced in various books, and this article will not repeat the introduction. This article mainly introduces the processing principle of the single-chip microcomputer in response to infrared remote control signals and decoding, and the preparation of the voice recording and playback program by the single-chip microcomputer controlling ISD1420.
4.1 External remote control signal encoding composition solution MCU decoding design
Usually, the signal of the infrared remote control is modulated on a 38KHZ carrier. There are many types of coding forms used in the signal. The more common ones are PWM code (pulse width modulation code) and PPM code (pulse position modulation code). The remote control used in this system is in the form of PPM code. The remote control code pulse signal is usually composed of pilot code, system code, system inverse code, function code and function inverse code.
The pilot code is composed of a high level with a width of 9ms and a low level with a width of 4.5ms. The system code is also called the identification code, which is mainly used to distinguish different control systems and prevent misoperation. Function code is also called instruction code, which represents the corresponding control function. The addition of the system's inverse code and the function's inverse code is to correct the errors generated during the transmission process and improve the anti-interference performance. The single-chip circuit first detects the 8-bit data code of each button in the TV remote control, and then determines the function of each button according to the data code. The function of each number key in the remote control is reserved here, and the channel plus and minus keys are used as the timing time plus and minus setting function, and the on-off key is used as the voice timekeeping control key. In this way, the function key pressed by the operator is identified in the external interrupt processing program of the one-chip computer, and then the corresponding processing program is executed.
4.2 Single-chip microcomputer controls the voice timekeeping program of ISD1420
In the voice recording and playback chip ISD1420, the voice morphemes that require real-time time reporting are recorded in advance by segment. After the split analysis of all sentences, the following 17 fields and morphemes are required: beep (00), zero (01), one (02), two (03) ), three (04), four (05), five (06), six (07), seven (08), eight (09), nine (0A), ten (0B), minute (0C), second (0D) ), point (0E), Beijing (0F), time (10). When recording, the address interval between two adjacent voice segments is 8, that is, the recording time of each voice segment is controlled within 1 second, and the 17 fields and morphemes used are distributed in the 17-second recording interval, without exceeding ISD1420 has a maximum recording time of twenty seconds. The following example illustrates the realization of the voice timekeeping function through the microcontroller program. Assuming that the current time is 16:47, we need the chime from the voice circuit to be "beep, 16:47 Beijing time". The single-chip microcomputer in the circuit splits the internal hour and sub-unit data, and generates the following code internally according to the segment number and command format of the voice segment in the voice chip: 00 0F 10 0B 07 0E 05 0B 08 0C. The above data are expressed in hexadecimal notation, "00" means "beep", "0F" means "Beijing", "10" means "time", "0B" "07" "0E" "05" "0B" "08" and "0C" respectively indicate "ten", "six", "dot", "four", "ten", "seven" and "minute". In this way, as long as the above-mentioned speech segments are played out in sequence, the synthesis and playback of the sentences are completed.
The electronic perpetual calendar implemented in this design uses a single-chip microcomputer as the main control chip, an external voice recording and playback chip ISD1420, an integrated infrared receiver and a clock chip DS1302, so that the perpetual calendar not only has the characteristics of accurate timing and easy expansion of functions, but also has remote control debugging , The voice timekeeping function makes the product convenient, interesting and vivid, suitable for home timekeeping and timekeeping applications. Through software debugging and hardware testing, all parts of the system have achieved the expected functions. In addition, changes based on the voice circuit design can also be applied to industrial measurement control, water conservancy monitoring, public security alarm systems, smart phone systems, taximeters, bank reporting systems, highway toll systems and other systems.