Many moons ago you helped with some code you wrote for me to send a PIC29F202 into sleep. The code you wrote was:
SysBYTETempA = On_signal
'Clear the port change reset flag
Set GPWUF off
movlwB'01001111''This is assembler. :-) option 'Returntosleepwait3Ssleepnop
The code has been recycled many times by simply changing the £On_signal " line.
the PIC16F18346 I'm using in this latest project doesn't want to know this and spits it out as if it were a nasty taste.
Having resolved all the project issues, i'm on the last hurdle and quite pleased with the outcome but I want the processor to go to sleep - any help would be really appreciated
// Both edges (most common for buttons/encoders)IOCBP6=1IOCBN6=1' ============================================='EnableInterrupts' =============================================On Interrupt PORTABChange Call Handle_IOC 'LinkIOCinterrupttosubroutine// code, lots of it.' ============================================='InterruptServiceRoutine(ISR)' =============================================Handle_IOC: If IOCBF.6 = 1 Then 'CheckifRB6causedtheinterruptIOCBF.6=0' CleartheflagforRB6EndIfReturn
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Many moons ago you helped with some code you wrote for me to send a PIC29F202 into sleep. The code you wrote was:
The code has been recycled many times by simply changing the £On_signal " line.
the PIC16F18346 I'm using in this latest project doesn't want to know this and spits it out as if it were a nasty taste.
Having resolved all the project issues, i'm on the last hurdle and quite pleased with the outcome but I want the processor to go to sleep - any help would be really appreciated
Just enter the command sleep
So I don't use any of the code instructions as befpre with the 10F202 and 12F508 ?
Thats magic - Thank you.
Last edit: Keith 2026-03-29
What event will wake the chip? That may help answer.
Yes, that is a problem. it goesn't go to sleep. It becomes Comatosed!.
I need it come back to life on pressing the encoder switch on PortB.6
The code is below - Thank you
Try this following to wake.
Thank you once again. It works a treat.
I put the first part of the routine above my main program as:
// Both edges (most common for buttons/encoders)
IOCBP6 = 1 ;Required
IOCBN6 = 1 ;Required
On Interrupt PORTABChange Call Handle_IOC ' Link IOC interrupt to subroutine
Main: ;----- start main*******
and a Sub called Handle_IOC ....
Calling up that Sub routine when the Main program times out and is inactive
Sub Handle_IOC ' Link IOC interrupt to subroutine
Sleep
' =============================================
' Interrupt Service Routine (ISR)
' =============================================
Handle_IOC:
End Sub
As I said it works really well downing the current to a couple of uA's
Thank you