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. This tutorial demonstrates waking 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 PORTA<0.3. onto the outputs at PORTB<4..7>. Switching the awake button to low again will make the PIC fall asleep again.
| 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 |
Open tut8.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 PORTA to PORTB. Click the DIP on PORTA to see the LEDS changing on PORTB. Click the DIP component again to the OFF position. The PIC is now asleep and changing the DIPS has no effect on the LEDS.
|
TRISA/PORTA | |
|
TRISB/PORTB | |
|
INTB0 Interrupt - Rising Edge | |
|
INTB0 Interrupt - Falling Edge | |
|
INTB0 Wakeup from Sleep |