I never really understood the sleep instruction before. Recently, when I was making a smart water meter product, I used an 8-bit microcontroller PIC16F690. When I saw the sleep instruction in the program, I thought the CPU would continue to work after execution, which led to some misunderstandings. I searched the Internet and found an article with detailed instructions on sleep. I have collected it for future reference!
Enter the sleep power saving mode after executing the SLEEP instruction. After entering the SLEEP mode, the main oscillation stops. If the watchdog is turned on during programming, the watchdog timer will be cleared and keep running. The I/O port, peripheral modules and internal RAM will remain in their original state, so if low power consumption is required after sleep, the IO port should be set to a high impedance input state before entering SLEEP, and unused modules should also be turned off. Some other peripheral modules are related to the main clock, such as USART in asynchronous mode, and will not work.
There are many conditions for waking up SLEEP, such as IO port level change, AD conversion completion, external reset, watchdog overflow, etc. For details, please refer to the data sheet. When the SLEEP instruction is executed, the PC+1 instruction is pre-fetched. When the device is awakened by an interrupt condition (this interrupt should be enabled), if GIE (global interrupt enable bit) is 0, the device will continue to execute the instruction following the SLEEP instruction. If GIE is 1, the device will execute the pre-fetched PC+1 instruction and jump to the interrupt entry of 0004H. Therefore, it is recommended that the instruction following SLEEP should be a NOP. External manual reset MCLR will wake up the device and RESET. The meaning of the flag bit indicating the status is detailed in the data sheet. The watchdog timer overflows under SLEEP to wake up the device, and then executes the instruction following SLEEP, and there is also a flag bit to indicate the status.
Previous article:How to integrate the programming function of PIC microcontroller into ATE
Next article:PIC microcontroller timer (TMR0)
- 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?
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Another technical solution for power-type plug-in hybrid: A brief discussion on Volvo T8 plug-in hybrid technology
- I was badly hurt by "RZ7888"!!!
- I feel good today
- Review of STM32's "useless" RAM debugging
- The meaning of two and a half dimensions in RF simulation
- How to select rectifier modules for communication power systems
- Rohde & Schwarz launches combined spectrum analyzer and phase noise tester
- [Starting at 13:30 pm] TI wireless connectivity product series application design guidance, online hands-on demo
- Inductance and Q value of transformer
- MSP430 ADC analog-to-digital routines
- Shenying series SY-Y1000 intelligent partition long-range laser perimeter warning radar