wake up from sleep question

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View


I want to wake up a 16f84 from sleep scan the A port for highs
and then have the pic go back to sleep. the pic is waking up with
the RB0 I/P, do i need to get the pic to wait a short while after
wakeup before going to the subroutine to look at the A port?
is there anything unusual I need to consider? timing etc?.


thanks for any advice

H



Re: wake up from sleep question


Send you code for us to pick on. It would help a great deal.

No, nothing unusual to make it work. Just make sure your WDT is enabled.
When the PIC is asleep, it will sleep for a maximum 2.3secs. When the WDT
kicks in, it wakes the PIC up and continues execution from the SLEEP
command.

In your case, you say you wake it up from RB0/INT. In this case, to test use
this: RB0 is tied low via 10K and tied high via button.
    movlw    b'10010000'
    movwf    INTCON
This will setup PIC to use RB0 as interrupt. When button pressed, your code
at 0x04 will be executed.
Within that interrupt, firstly start by saving the context, then test for
RB0 that caused the interrupt (i.e. INTCON,INTF is set). Do you scan porta
bits routine. Eventually, clear INTCON,INTF and restore context.
As far as putting it to SLEEP again, you can issue the SLEEP in a main loop.

Regards

Quoted text here. Click to load it



Site Timeline