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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?
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.
Thanks for the prompt reply.
That exactly what I needed to know - up until now I have been hand editing the ASM file!