Menu

sleep and wake

Help
2009-10-28
2013-05-30
  • Nobody/Anonymous

    What cammands are needed to wake a sleeping 16f916 using the extint0 pin, what varibles need to be set before sleep mode?

     
  • Nobody/Anonymous

    I am thinking just an On Interrupt ExtInt0 is required.

        #chip 16f690,8
        #config MCLRE=On, INTRC_OSC_NOCLKOUT
        #define Led PortC.0
        dir LED out
       
        On Interrupt ExtInt0 call Wakeup
        OnWakeup = False
       
        Main:
        If OnWakeup = True then
        notcount = 5
        Else
        notcount = 2
        end if
        For count = 1 to notcount
        SET LED ON
        wait 50 10ms
        SET LED OFF
        wait 50 10ms
        Next
        asm sleep
        goto Main
       
        sub Wakeup
        OnWakeup = Not OnWakeup  ;could use a nop instead
        end sub

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.