Specific implementation functions
The system consists of STC89C52 microcontroller + DS1302 clock chip + button module + LCD1602 display + power supply.
Specific functions:
1. Can display year, month, day, hour, minute, second, week and lunar calendar;
2. The buttons can be used to set the alarm clock and alarm;
3. Press the button to adjust the time and display whether it is a common year or a leap year.
There are 4 buttons in total: Set, Add, Subtract, Switch.
design background
In our real life, everyone may have their own clock. Time is passing by without stopping. With a clock, people can live every day in a planned way. However, most clocks now need to replace batteries constantly, and some clocks need external power supply. If the battery is out of power or the external power supply cannot supply power, the clock will stop timing. The new clock calendar chip DS1302 from DALLAS of the United States can solve this problem. The device can provide real-time clock (RTC)/calendar and timer alarm. For months with less than 31 days, the date at the end of the month can be automatically adjusted, including leap year compensation. The device can also work in the 12-hour format of 24-hour forwarder/PM indication.
The clock also has the functions that non-real-time clocks do not have, such as environmental protection, no noise, low power consumption, etc. The real-time clock can be used not only at home, but also in public places, such as stations, docks, shopping malls, etc.
hardware design
AT89C52 is used as the main control microcontroller, DS1302 is used as the clock chip for the clock module, LCD1602 is used as the display module, and the key circuit is used for the setting part.
AT89C52 is compatible with MCS-51 microcontroller products, 8K bytes of in-system programmable Flash memory, 1000 erase and write cycles, full static operation: 0Hz~33Hz, three-level encrypted program memory, 32 programmable I/O lines, three 16-bit timers/counters, eight interrupt sources, full-duplex UART serial channel, low-power idle and power-down modes, interrupt wake-up after power-down, watchdog timer, dual data pointers, power-down identifier.
The DS1302 real-time clock chip is rich in functions and can be used to directly replace the clock calendar chip DS12887 on IBM PC. At the same time, its pins are also compatible with MC146818B and DS12887. Since DS1302 can automatically generate time information such as century, year, month, day, hour, minute, and second, a century register is added inside, thus solving the sub-millennium problem by hardware circuit; DS1302 has its own lithium battery, and its internal time information can be maintained for 10 years when the external power is off; for time recording within a day, there are two modes: 12-hour system and 24-hour system. Users can also program DS1302 to achieve multiple square wave outputs, and can shield its internal three-way interrupts through software.
software design
Program flow: The main program starts initialization and opens interrupts, then scans the alarm clock, keyboard, and reads the 18B20 value. When the S1 key is pressed, the clock setting is executed, and when the S4 key is pressed, the alarm setting is entered. No matter it is the clock or the alarm clock, exit after setting, and the clock resumes real-time display.
Schematic
The schematic diagram of this system was designed using Altium Designer19, as shown in the figure.
program
This design uses KEIL5 software to implement program design, as shown in the figure.
Simulation Implementation
This design uses protues8.7 software to implement simulation design, as shown in the figure.
Previous article:23-Design of intelligent electronic scale based on 51 single chip microcomputer
Next article:21-Design of 5x4 calculator based on 51 single chip microcomputer
Recommended posts
- Ask about the flyback switching power supply
- Dearteachers,Iwouldliketoaskabouttheflybackswitchingpowersupply TheflybackswitchingpowersupplyoftheUC3842maincontrolchip,whatisthefunctionoftheredbox? DoesthearrowpointtotheMOStube?Howtoselecttheparamete
- Knight97538 Power technology
- Who is the source manufacturer of the 3651 orthogonal convex tooth sensor? Is there anyone who can be its agent?
- Whenlookingforacamsensorwithorthogonaloutput,IfoundMT3651andYS3651atthesametime.Bothwereprintedwith3651andpackagedinTO-94.ThepriceonTaobaowas¥7+(thelatterisnow¥9),andtheywerebothoutofstock. Isuspecttha
- LearningASM DIY/Open Source Hardware
- 【DFRobot Skylark Weather Instrument】Study Notes 06 (Using SGP30 sensor to obtain CO2 concentration)
- ##10:UseIICinterfacetorealizeCO2detectionSGP30isacarbondioxide(CO2)andorganiccompound(TVOC)gassensormodule,whichcanrealizeairqualitymonitoringandcontrolbydetectingCO2andTVOCconcentrationintheenvironment.###10.1
- qzc0927 Sensor
- Robust Design of I2C Serial EEPROM Application System
- RobustDesignofI2CSerialEEPROMApplicationSystem ThankyouforsharingThankyouforsharing Seewhatthehostshared Thankyouforsharing Thanksforsharing,Ilearnedalot!
- zxopenljx FPGA/CPLD
- AD copper plating question
- Whataretheadvantagesofthiscopperplatingmethod?Ifoundthatitisnotusedmuch. Itisnotcommonlyused. Thepadsandcoppercoversofthesamenetworkareconnected,andotherssuchaswiresarenotconnected Itiseasytoseparate
- 朴树先生 PCB Design
- Ufun study report summary
- ufunactivity:ApplicationforUFUNlearningboardevaluationisinprogress,welcometojoin! ArticleSummary: @Min丨Da 【UfanLearning】HowsmallistheUfanlearningboard?? 【ufunlearning】Environmentdevelopmentandconstruction
- okhxyyo stm32/stm8
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- Breaking through the intelligent competition, Changan Automobile opens the "God's perspective"
- The world's first fully digital chassis, looking forward to the debut of the U7 PHEV and EV versions
- Design of automotive LIN communication simulator based on Renesas MCU
- When will solid-state batteries become popular?
- Adding solid-state batteries, CATL wants to continue to be the "King of Ning"
- The agency predicts that my country's public electric vehicle charging piles will reach 3.6 million this year, accounting for nearly 70% of the world
- U.S. senators urge NHTSA to issue new vehicle safety rules
- Giants step up investment, accelerating the application of solid-state batteries
- Guangzhou Auto Show: End-to-end competition accelerates, autonomous driving fully impacts luxury...
- Lotus launches ultra-900V hybrid technology "Luyao" to accelerate the "Win26" plan
- Analysis of the design steps of RS-485 bus interface circuit
-
[NXP Rapid IoT Review] +
NXP Rapid IoT Online IDE Air Quality Test - How to remotely control a two-wheeled balancing vehicle via the Internet?
- Discussion on Configuration of Emergency Stop System
- How to get the most out of your low noise amplifier solution?
- Android4.4.2 source code compilation-iMX6Q/D core board-non-device tree source code
- 【GD32E503 Review】 Unboxing and Powering on the Machine
- The role of *.lib under DSP
- JHIHAI APM32E103VET6 Review: External Interrupt (EINT)
- Two formulas to easily understand current transformers