Watchdog timer question
I'm using an SX48 Proto Board and want my program to use SLEEP to go into a low power mode, with the watchdog timer causing it to wake and check some peripherals every so often. If no signals change then it should go back to SLEEP. But I'm having trouble getting the watchdog timer to work.· I've simplified my code to the following, which doesn't even use the SLEEP command yet. Note that the RESETWDT command is commented out, so I'd expect a reset or wake up within a second or two. Nothing happens though. At startup the LEDs all come on for 1/4 second, then most of them go out as expected, but they then stay unlit forever. The DO-LOOP never appears to exit, so the watchdog timer action doesn't seem to be happening. ·Much of this code is identical to the example in the Help documentation under the subject "RESETWDT Example". Can anyone see what it is I must be overlooking?
'
Device Settings
DEVICE········· SX48, OSCHS3
FREQ··········· 50_000_000
ID············· "Test"
'
Start of Program
PROGRAM Start
'
Initialization
Start:
· TRIS_D = %00000000···· 'Row of LEDs are on RD·pins
· OPTION = %11111110···· 'Same as in RESETWDT example
· RD = %11111111·········'All 8 LEDs go on at·startup
· PAUSE 250··············'for about .25 seconds
· DO
··· RD = %10000001·······'Most of the LEDs go out
··· PAUSE 250
··· 'RESETWDT··········· 'Without this should get·timeouts
· LOOP
'
Device Settings
DEVICE········· SX48, OSCHS3
FREQ··········· 50_000_000
ID············· "Test"
'
Start of Program
PROGRAM Start
'
Initialization
Start:
· TRIS_D = %00000000···· 'Row of LEDs are on RD·pins
· OPTION = %11111110···· 'Same as in RESETWDT example
· RD = %11111111·········'All 8 LEDs go on at·startup
· PAUSE 250··············'for about .25 seconds
· DO
··· RD = %10000001·······'Most of the LEDs go out
··· PAUSE 250
··· 'RESETWDT··········· 'Without this should get·timeouts
· LOOP
Comments
eg.
device··SX48,oschs1,watchdog····;sx device options
There is also a directive SLEEPCLK to enable clock generation during sleep mode.
See tables 6 and 7 of sasm manual (pages 49/50)
regards peter
Post Edited (Peter Verkaik) : 3/1/2007 8:54:25 AM GMT
-John