PIC18F4550 Sleep Mode - PIC Controllers
PIC18F4550 Sleep Mode - PIC Controllers
Introduction
PIC18F4550 has a power-down mode to reduce power consumption when the microcontroller is idle. Most of the applications like
mobile phones, laptops rely on sleep mode which suspends most or all microcontroller operations to minimize power consumption.
Sleep mode is necessary for such applications because these are battery-operated devices which help to consume less energy
So no system clocks are occurring in the device. This keeps the PIC in a low power consumption state.
Bit IDLEN:
If WDT (Watchdog Timer) is enabled then INTRC Source having a frequency of 31 kHz is enabled.
Interrupt
Reset
WDT time out
Interrupts are any interrupt sources like external interrupt, timer interrupt, usart interrupt, ADC interrupt, etc can cause the PIC
microcontroller to exit from sleep mode.
Example
Let’s develop a simple application in which we force the PIC18F4550 to enter into sleep mode or exit from sleep mode by using an
external interrupt.
Interfacing Diagram
When the PIC microcontroller is in normal mode it will start blinking the LED and by giving external interrupt it will go into
sleep mode and the LED will stop blinking.
When the PIC microcontroller is in sleep mode, after providing external interrupt it will wake up and start blinking the LED
again.
Program
/*
*/
#include <pic18f4550.h>
#include "osc_config.h"
int flag;
void main()
TRISD=0;
flag = 0;
while(!flag)
MSdelay(300);
flag = ~flag;
INTCONbits.INT0IF=0;
for(i=0;i<val;i++)
for(j=0;j<165;j++);