News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Snooze not working

Started by kladogen, Dec 19, 2025, 01:06 PM

Previous topic - Next topic

kladogen

I'm using snooze on PIC16LF1705 in a low power project.
I call
Snooze 6 to place the PIC in low power for ~2 secs but the program just freezes and never reaches the next instruction. Eventually the program restarts after about 8-10 secs.
The sleep command, when I set the watchdog to 8 secs and call sleep it works correctly.

Is there something special that I need to do to use snooze.


RGV250

Hi,
It would probably help if you posted your code.

Bob

Pepe

demo proteus

;-------------------------------------------------------------------------------
;**** Added by Fuse Configurator ****
; Use the Fuse Configurator plug-in to change these settings

Device = 16LF1705

Config1 FOSC_INTOSC, WDTE_ON, PWRTE_OFF, MCLRE_OFF, CP_OFF, BOREN_OFF, CLKOUTEN_OFF, IESO_OFF, FCMEN_OFF
Config2 WRT_OFF, PPS1WAY_ON, ZCDDIS_ON, PLLEN_OFF, STVREN_OFF, BORV_LO, LPBOR_OFF, LVP_OFF

;**** End of Fuse Configurator Settings ****
;-------------------------------------------------------------------------------
Xtal = 8
Declare Optimiser_Level = 3
Declare Create_Coff On
Declare Bootloader off

Declare Watchdog = On


'--------------Set port----------
OSCCON = %01110010


PORTA = 0
TRISA = 0

Symbol LED = PORTA.0
Symbol LED1 = PORTA.1
Low LED '
DelayMS 1000
Do
High LED ' Turn LED on
High LED1 ' Turn LED on.
DelayMS 1000 ' Wait 1 second.
Low LED1 ' Turn LED off.
Snooze 6 ' Sleep for 1.15 seconds.
Loop


kladogen

Thanks for your replies.

In the end I used WDTE_SWDTEN in config and Sleep after setting the watchdog to 1 sec.

If WDTE_SWDTEN config is not set you cant modify the watchdog timings.