I have been working on a digital electronic clock recently, and I have summarized some information to share with you. The DS1302 clock chip. The chips needed for computer simulation are AT89C52, 74HC138 resistor array (because the IO port of C52 microcontroller P0 does not have a pull-up resistor), 74HC245. If you need to make a real thing, you have to choose the appropriate resistor according to the model of the digital tube, DS1302 chip, button
1. Working principle
Let's first understand what we are using. STC89C52 is an 8051 microcontroller, which will not be introduced here. Then there is the DS1302 clock chip.
This is the DS1302 clock chip.
This is the working principle. We often use the connection between the DS1302 and the microcontroller.
2. Experimental ideas
Understand the data transmission between the DS1302 clock chip and the microcontroller. The single bus method is used, so there will be a timing diagram and a read-write
diagram third is the address. If we read a minute or hour, the data we read is 0x82, and if it is to write minutes, it is 0x83, but it is not that simple. We have to turn off the read-write protection before performing the operation, so that we can read and write.
3. Experimental simulation diagram
We first need to know how to use 74HC138 and 74HC245 chips. The data sheets of these two chips are attached in the compressed package. You can refer to the manual. In actual production, the IO of the microcontroller cannot directly drive the digital tube, because the current of the digital tube is relatively large, and the IO port of the microcontroller does not have such a large driving current, so it can be determined by triodes or driver chips and resistors. The resistance value of the resistor depends on the rated current and resistance of the digital tube. Because there is no such in proteus, I did not do it so carefully here. The use of the button is K3 to pause the time, K1 is to select the time to be adjusted, and K2 is to add one. Press K3 again to restore the time and make it move. The only disadvantage is that you cannot see it when adjusting the time.
4. Experimental source code
There is a lot of experimental source code. I put the source code, the data manual, and the simulation diagram in a compressed package. You can download them if you need them. The software used is KELI4 Proteus8.7. There are many of these two software on the Internet. Please download them by yourself. I will not go into details here.
5. Experimental extension
Because our digital tube display is displayed one by one, because the time is extremely short, the effect comes out together. We use timer 1 to switch time and date, but we have been consuming a lot of power for a long time, so we can set the sleep mode, that is, use PCON=0x02; enter sleep, and then the external interrupt can be used. STC89C52 has four interrupt wake-up. We can use these four external interrupts to achieve the effect of power saving, PCON=0x00; wake up the microcontroller. This is just a personal idea, and this idea has not been integrated. If you have ideas, you can also make improvements. I hope you like it. .
Previous article:STC15 MCU uses ESP8266 to control LED source code
Next article:Programming of Single Chip Microcomputer Intelligent Temperature Detection and Control System
- Popular Resources
- Popular amplifiers
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
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Xunwei-i.MX6ULL Development Board-Network Test Method (Part 2)
- esp8266 uses oled to play online videos
- Security monitoring multi-channel long-distance transmission problem
- Why does LDMOS conduct without adding gate voltage?
- EEWORLD University Hall----Live Replay: NXP's facial recognition technology solution based on i.MX RT106F
- Function overloading and reentrancy
- Alternative winners in the 5G era
- What Jack Ma said about starting a business...
- Phytec's IMX8Mplus review
- Transplantation of webplayer audio player based on RVB2601