sleep mode question

how do i put the 16f84 into sleep mode and can I wake it up with either an interupt on the RB0 Pin and/or an input on the RA0 pin?

thanks in advance for any advice

Reply to
Hayley
Loading thread data ...

SLEEP

Yes on the RB0 INT, but not on RA0.

Carefully read the datasheet on this stuff, it really matters. You have to have INTE set to have it wake from SLEEP on the RB0 interrupt. GIE will determine what happens after wakeup (next instruction or branch to ISR). The instruction following sleep gets executed before anything else. READ THE DATASHEET. :-)

BTW, you should be using something like a 16F88. It's basically pin compatible, much cheaper and has way more features.

Reply to
Anthony Fremont

Thanks for the help

Reply to
Hayley

You can also use the other pins on PORTB to wake up from SLEEP by using the "interrupt on change" feature. In fact, that's the only time you can rely on the IOC functionality to not miss any input pin state changes.

Reply to
Anthony Fremont

"Hayley" wrote

Microchip has several application notes with code examples to help you get started.

AN528 Implementing Wake-Up on Keystroke

formatting link

AN879 Using the Microchip Ultra Low-power Wake-up Module

formatting link

This is for the PIC16F684, but you can use a similar approach with any PIC supporting wake-up on pin change.

Regards,

-Bruce

formatting link

Reply to
Bruce

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.