Introduction to the method of exiting the sleep state of PIC16C5X microcontroller

Publisher:SereneSpiritLatest update time:2012-08-20 Source: 21ic Keywords:PIC16C5X Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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 the SLEEP instruction is executed, 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, the 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.

When SW2 is pressed, the red light is on. Readers can write processing programs according to actual needs, see Figure 2.

Before entering the sleep state, set the key scan output lines SCAN1 and SCAN2 to a low level. In this way, when entering the sleep state, 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 state and enter reset. During reset, SCAN1 and SCAN2 automatically change from output state to input state (high impedance state), the discharge circuit 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 the 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 a low level once every 20ms to sample the key value. To prevent the capacitor from discharging for too long, it will be pulled low to reset again. Each scan, that is, the time when SCAN1 or SCAN2 is low, 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 device re-enters the sleep state. R4-R8 is mainly used to prevent C from discharging and possibly causing damage to the chip. The working sequence is shown in Figure 3.

Keywords:PIC16C5X Reference address:Introduction to the method of exiting the sleep state of PIC16C5X microcontroller

Previous article:PIC microcontroller basic learning program design
Next article:PIC16F887 infrared decoding program

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号