22-Digital clock (perpetual calendar) based on 51 single chip microcomputer

Publisher:cloudy德德Latest update time:2021-10-18 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Reference address:22-Digital clock (perpetual calendar) based on 51 single chip microcomputer

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
Latest Microcontroller 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号