piclist 1995\11\27\143422a >
Thread: Wake and Sleep code for 84 device
picon face BY : Scott Stephens email (remove spam text)

>Has anyone got any simple code that I can 'borrow' to make a '84 wake up
>from sleep mode when an input changes state? I also want some code to put
>the device back into sleep mode.

       ORG     H'000'          ;Reset vector for 16C84 PIC's
       btfsc   STATUS,_PD      ;
       goto    Star1
       goto    Star2

       ORG     H'004'          ;Interrupt vector
       goto    ISR

       ORG     H'005'
Star1   btfsc   STATUS,_TO
       goto    PwrUp           ;Power-up condition, TO & PD = 1
       goto    X_Init          ;WDT time-out, not sleep T0=0, PD=1
Star2   btfss   STATUS,_TO
       goto    Wake_up         ;WDT time-out, sleep T0=0, PD=0

Wake_up sleep

Check page 2-543 of the 94 databook for explanation of the TO and PD Status
bits., and the "SLEEP" instruction. PortB and INT interrupts will wakeup the
processor as well as a watch-dog timer time-out. Execution may start at the
ISR vector H'004' or elsewhere, depending on how the interrupts are configured.

See also: www.piclist.com/techref/index.htm?key=wake+sleep+code
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Wake and Sleep code for 84 device

month overview.

new search...