Menu

SLEEP and skipping wake up initialisation

Steve Cody
2007-08-30
2013-05-30
  • Steve Cody

    Steve Cody - 2007-08-30

    I am writing a low power application that makes use of the PIC 'sleep' features.
    GCBasic normally sticks BASEPROGRAMEND at the end of the program thus...

    BASPROGRAMEND
        sleep
        goto $

    This has the effect of making the PIC fall to sleep and then starting again from the beginning on RESET, WDT, etc.

    This has the effect of causing my I/O to change state momentarily while the PIC gets going. I can accept this for a power in reset, but not when waking up from a Watchdog timeout.

    I attempted to avoid the default initialisation (after the first pass) by inserting the following inline code at the end of my main sequence...

        sleep
        goto MainLoop

    The compiler, however, interprets 'sleep' as a cue to insert a delay routine called SLEEP.

    Is there anyway to get the compiler to accept my inline code as I intended it to be?
    Is there an alternative function/directive/trick that will achieve the desired result?

     
    • Hugh Considine

      Hugh Considine - 2007-08-30

      If you have the newest version of GCBASIC from http://gcbasic.sourceforge.net/newfiles/update.zip you should be able to use this command:

      asm sleep

      asm is a new directive I recently added to solve problems like this, where an assembly mnemonic  is the same as a GCBASIC command.

      If this doesn't work or you don't want to download update.zip, then you can also edit the stdbasic.h file to remove the Sleep subroutine.

       
    • Steve Cody

      Steve Cody - 2007-08-31

      Thanks for the prompt reply.
      That exactly what I needed to know - up until now I have been hand editing the ASM file!

       

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.