Tutorial 8:  External Wakeup on INTB0

Call them lazy but Microcontrollers are often asleep. Even when asleep they are really very busy saving their energy for when they are needed. There are numerous ways to wake up a sleeping microcontroller. In Tutorial 2, we saw how to wake up a PIC using the PORTB Interrupt. In this simple example we will wake up the PIC using the INTB0 external interrupt. This interrupt is very handy because it is triggered on either a rising or falling edge. A single DIP component acts as a 'wakeup' switch so that when it switches from low to high to PIC is woken, while awake it then copies the inputs on PORTC onto the outputs at PORTD. Switching the awake button to low again will make the PIC fall asleep again.

Download FEATURE62x_Tutorial8.zip and unzip into folder <your path>\Tutorial 8

Filename Version Description
tut8.pjt 1.0 MPLAB Project
tut8.asm 1.0 Assembler code
tut8.hex 1.0 Precompiled HEX
tut8.lst 1.0 Precompiled LST
tut8.vbb 1.0 Virtual Breadboard simulation

Running the Simulation

Open tut3.vbb and press RUN. Click the DIP component on PIN B0 to wake up the processor, it will then act as a port mirror copying the values from PORTC to PORTD. Click the DIP on PORTC to see the LEDS changing on PORTD. Click the DIP component again to the OFF position. The PIC is now asleep and changing the DIPS has no effect on the LEDS.

Code Walk Through

 

Features Demonstrated

TRISA/PORTA

TRISB/PORTB

INTB0 Interrupt - Rising Edge

INTB0 Interrupt - Falling Edge

INTB0 Wakeup from Sleep