In some applications, the CPU only needs to work intermittently or process external events, and is usually in standby mode. The PIC16C5X microcontroller has an energy-saving mode, the sleep (SLEEP) mode. In this state, the oscillator driver stops working, and the I/O port maintains the state before executing the SLEEP instruction, thereby greatly reducing system power consumption. Since the PIC16C5X microcontroller has no interrupt function, there are only two ways to exit the sleep mode:
(1) Watchdog timer (WDT) overflow.
(2) Add a low level to the reset pin to reset the chip. This article adopts the second method. In the example given in Figure 1, PIC16C5X is usually in sleep mode. When any key is pressed, it wakes up from sleep mode and performs keyboard processing. For ease of explanation, in this example, when SW1 is pressed, it lights up, as shown in the figure below, as
a green light; when SW2 is pressed, the red light lights up. Readers can write processing programs according to actual needs, see Figure 2.
Before entering the sleep mode, set the key scan output lines SCAN1 and SCAN2 to a low level. In this way, when entering the sleep mode, when no key is pressed, the capacitor C is fully charged, so that the reset pin of the PIC16C5X microcontroller remains at a high level. Once a key is pressed, C discharges through resistor R2 or R3, causing the voltage on C to drop rapidly (about 1ms), thereby pulling the reset pin to a low level, forcing the PIC16C5X to exit the sleep mode and enter reset. When reset, SCAN1 and SCAN2 automatically change from output state to input state (high impedance state), the discharge loop of C is blocked, and VCC charges C to a high level through resistor R1.
It should be noted that the RC value should be selected appropriately so that the charge and discharge cycle is less than the reset time of PIC16C5X (about 18ms). It is also much less than the minimum time of key pressing (about 50--100ms). After the reset is completed, in the program, SCAN1 and SCAN2 are set to low level once every 20ms to sample the key value. In order to avoid the capacitor discharging time being too long, it will be pulled low to cause a reset again. Each scan, that is, the time when SCAN1 or SCAN2 is low level is about 10us. When the key processing program is completed, the program scans the keyboard cyclically until the key is released. Then the SCAN1 and SCAN2 outputs are set to low level and the computer goes back to sleep. R4-R8 is mainly used to prevent C from discharging and possibly causing damage to the chip. The working timing is shown in Figure 3.
Previous article:Software and hardware implementation of serial communication between PIC16 series microcontroller and PC
Next article:PIC16F676 microcontroller internal EEPROM program
- Popular Resources
- Popular amplifiers
- 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?
- Vicor high-performance power modules enable the development of low-altitude avionics and EVTOL
- Chuangshi Technology's first appearance at electronica 2024: accelerating the overseas expansion of domestic distributors
- Chuangshi Technology's first appearance at electronica 2024: accelerating the overseas expansion of domestic distributors
- "Cross-chip" quantum entanglement helps build more powerful quantum computing capabilities
- Ultrasound patch can continuously and noninvasively monitor blood pressure
- Ultrasound patch can continuously and noninvasively monitor blood pressure
- Europe's three largest chip giants re-examine their supply chains
- Europe's three largest chip giants re-examine their supply chains
- 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
- Op amp feedback judgment method
- Two type qualifiers about compiler optimization: volatile and restrict
- The content is easy to understand and clear, especially suitable for beginners.
- Free application: RTT & Renesas ultra-low power MCU RA2L1 development board
- Where to go during the May Day holiday?
- The 5G era is within reach! Qorvo RF Fusion has been successfully applied to many new smartphone designs
- I want to make a game console recently, but in order to prevent others from copying it, what is the best way to do it?
- The firmware development kit has been upgraded, ONSemiconductor.BDK.1.18.0.pack
- Linux builds RVB2601 development environment
- Wi-Fi 6 and Wi-Fi 6E: The key to the Internet of Things