If it is possible, how would the code loo like if there was two WDTs enabled?
My very simple program code is below. I would like to know if you think that the second WDT would be useful in this case.
Code: Select all
Device = 18F13k22
Clock = 2
Config FOSC = Irc 'tells the chip to use its internal oscillator
'---Set-up Watchdog timer
Config WDTPS = 32768 'WDT period = 4ms x 32768 = 131.072 s
Config WDTEN = ON
Dim LoopNumber As Integer
'---Enable sleep mode etc.
OSCCON = %01001100
Low(PORTA.2)
Low(PORTA.5)
LoopNumber = 0
'---Main Program Loop
While True
LoopNumber = LoopNumber + 1
If LoopNumber <= 330 Then '330 x 131.072s = 12h 0min 53.76s
Asm 'Put PIC to sleep for 2.18 mins
sleep
End Asm
EndIf
If LoopNumber > 330 Then
High(PORTA.5)
DelayMS(5000)
Low(PORTA.5)
LoopNumber = 0
End If
Wend