This design consists of four modules: data display module, temperature acquisition module, time processing module and adjustment setting module.
The core of the system uses the STC89C52 single-chip microcomputer; the data display module uses an LCD liquid crystal display; the temperature acquisition module uses the DS18B20 temperature sensor, which uses a single bus transmission and has an internal A/D conversion, making it very convenient to use; the time processing module uses the DS1302 clock chip, which can time the year, month, day, weekday, hour, minute, and second, and also has multiple functions such as leap year compensation; the adjustment setting module includes four buttons: mode selection button, function selection button, adjustment plus button, and adjustment minus button.
The electronic perpetual calendar of this project is a specific application of single-chip microcomputer control technology. The main research contents include the following aspects:
1) When selecting an electronic perpetual calendar chip, focus on devices that are easy to use, have single-chip storage, low power consumption, and are resistant to power outages.
2) Design peripheral circuits and microcontroller interface circuits based on the selected electronic perpetual calendar chip.
3) When designing the hardware, the structure should be as simple, practical and easy to implement as possible, making the system circuit as simple as possible.
4) Complete the soldering of components on the development board according to the circuit diagram.
5) Based on the designed hardware circuit, write the microcontroller program to control the STC89C52 chip.
6) Through programming, compiling and debugging, download the program to the microcontroller to run it and realize the functions of this design.
7) When designing hardware circuits and software programs, the main considerations are to improve the friendliness of the human-computer interface and facilitate user operation.
There are many ways to make a single-chip electronic calendar, and there are also many devices and technologies to choose from. Therefore, the overall design of the system should fully consider the environment in which the system is used, while meeting the system's functions. The selected structure should be simple to use and easy to implement, and the selection of devices should focus on appropriate parameters, stable performance, low power consumption and low cost.
According to the requirements of system design, it is preliminarily determined that the system consists of six modules: power module, clock module, display module, keyboard interface module, temperature measurement module and alarm module. The circuit system block diagram is shown in Figure 1.
1 DS1302 interface circuit design
The interface circuit and working principle of the clock chip DS1302: Vcc1 is the backup power supply and Vcc2 is the main power supply.
VCC1 provides low power and low power battery backup in single power and battery powered systems. VCC2 provides main power in dual power systems. In this application, VCC1 is connected to the backup power supply to save time information and data in the absence of main power.
2 DS18B20 interface circuit design
The digital temperature sensor DS18B20 is used in this system, which has the characteristics of high measurement accuracy and simple circuit connection. This type of sensor only needs one data line for data transmission, which is connected to the DQ port of DS18B20 with P3.7, Vcc connected to the power supply, and GND connected to the ground.
The operating current of DS18B20 is about 1mA, VCC is generally 5V, then the resistance R=5V/1mA=5KΩ. The resistors currently used are generally not adjustable resistors, but fixed resistance values, and there are only a few models on the market.
If the DS18B20 is connected to a power supply, it needs a pull-up resistor to work stably. This resistor is usually large, so we choose a 10K resistor to pull it up to a high level to protect the subsequent circuit.
3 LCD1602 and MCU interface circuit design
D0~D7 of LCD are respectively connected to P0 port of microcontroller as data line. Because there is no pull-up resistor inside P0 port, a 4.7K pull-up resistor is added externally; P2.5-P2.7 are respectively connected to RS, RW and E control pins of LCD; RV1 is used to adjust the gray scale of LCD display; BLK and BLA are cathode and anode of backlight, and the backlight will be turned on when connected to corresponding electrical levels.
The third pin of 1602 is connected to a series resistor of 10K and 1.5K to play a voltage divider role, which can adjust the brightness contrast between the first and second rows. The 16th pin is connected to a transistor to amplify the function, so that the backlight of the LCD can be turned on, so that the perpetual calendar can be viewed at night.
4. Key module circuit design
This system uses 4 buttons, one of which is used for manual reset of the system, and the other 4 are independent buttons. This connection method is simple to query and program, and can save CPU resources. The button circuit is shown in Figure 19. The 4 independent buttons are respectively connected to the P3.0, P3.1, P3.2, and P3.3 interfaces of STC89C52.
A brief description of the above 4 buttons is as follows: K1 - SET button, K2 - UP button, K3 - DOWN button, K4 - OUT/STOP button.
SET button: Press the SET button to enter the time calibration state. Press once to adjust the seconds, twice to adjust the minutes, and so on to calibrate the year, month, day, hour, minute, second and week.
UP key: When the SET key is pressed, UP performs the addition operation of the SET selected item (such as hours);
DOWN key: When the SET key is pressed, DOWN performs a subtraction operation on the SET selected item (such as hours);
OUT key: When the OUT key is pressed, this key function is to exit the calibration function and enter the next mode to display the temperature value and the upper and lower temperature limits.
5 Design of main program flow chart
6 DS1302 Read and Write Program Design
The time reading of this system mainly comes from the operation of the microcontroller on DS1302. In terms of hardware, the connection between the clock chip DS1302 and the microcontroller requires three lines, namely SCLK (7), I/O (6), and RST (5). For the specific connection diagram, see the system hardware design schematic diagram.
When DS1302 exchanges data with the microprocessor, the microprocessor first sends a command byte to the circuit. The highest bit MSB (D7) of the command byte must be logic 1. If D7=0, writing to DS1302 is prohibited, that is, write protection; D6=0 specifies clock data, D6=1 specifies RAM data; D5~D1 specify specific registers for input or output; the lowest bit LSB (D0) is logic 0, specifying a write operation (input), and D0=1 specifies a read operation (output).
Previous article:Design of temperature monitoring and alarm system based on single chip microcomputer
Next article:Design of Traffic Light Control System Based on Single Chip Microcomputer
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- Qorvo Expands BAW Filter Portfolio to Support Global 5G Base Station Deployment
- Internal bus block diagram of DM644x Davinci processor
- Recruitment of part-time MCU software programming
- Application of MSP430F415 in LCD air conditioner infrared remote control
- Please tell me why the 5V can't be turned off in this picture
- Transimpedance
- Allegro display problem
- Can Tantalum Capacitors Replace MLCC?
- Design of USB interface based on DSP
- Power relay contacts sticking