PhilHornby
Senior Member
I have some code running on a 14M2, that is triggering the 'well-known' 2.1Sec Watchdog Reset when running at a clock speed of 31KHz ... even though it doesn't take anything like 2.1 Seconds to execute
This is the code :-
Without the 'setfreq k125 command, the Picaxe resets immediately after executing the 'high : nap : low' sequence. The sequence itself works successfully and gives a short 'blip' of an LED. I have tried splitting it into 3 separate statements, but to no avail. I have tried a second 14M2, with exactly the same results.
I've been staring at this for quite a while and can only think I'm missing something blindingly obvious. I can't see what is so special about the HIGH/NAP/LOW sequence, compared with code that has already been successfully executed @ 31KHz.
This is some of the immediately preceding code - that works OK :-
Any thoughts?
UPDATE: I don't know if it is pertinent, but this code is running in #Slot 1 of the 14M2
This is the code :-
Code:
[COLOR=Red][I]setfreq k31[/I] ;low power previously engaged ...
[/COLOR][COLOR=Blue]do
[/COLOR][COLOR=Green];** setfreq K125 ;Must be executed at 125KHz or above...
[/COLOR][B][COLOR=Blue]high LEDPin [/COLOR][COLOR=Black]: [/COLOR][COLOR=Blue]nap [/COLOR][COLOR=Navy]1 [/COLOR][COLOR=Black]: [/COLOR][COLOR=Blue]low LEDPin [/COLOR][/B][COLOR=Green];about 32mS
;@ 31KHz, when the LED goes off, the processor resets?!?
;** setfreq k31
[/COLOR][COLOR=Blue]nap [/COLOR][COLOR=Navy]5 [/COLOR][COLOR=Green];wait 576mS
[/COLOR][COLOR=Blue]PeekSfr IOCAF[/COLOR][COLOR=Black], [/COLOR][COLOR=Purple]SwitchChecker [/COLOR][COLOR=Green];get pin no.s that have edge detections
[/COLOR][COLOR=Blue]loop while [/COLOR][COLOR=Purple]SwitchChecker [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Navy]0 [/COLOR][COLOR=Green];wait for switch to be pressed again[/COLOR]
I've been staring at this for quite a while and can only think I'm missing something blindingly obvious. I can't see what is so special about the HIGH/NAP/LOW sequence, compared with code that has already been successfully executed @ 31KHz.
This is some of the immediately preceding code - that works OK :-
Code:
[COLOR=Blue]setfreq K31 [/COLOR][COLOR=Green];save power
[/COLOR][COLOR=Blue]low LEDPin [/COLOR][COLOR=Green];turn off LED - as acknowledgement
[/COLOR][COLOR=Blue]do while [/COLOR][COLOR=Purple]SwitchPin [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Navy]0 [/COLOR][COLOR=Green];really do need the user to release switch!
[/COLOR][COLOR=Blue]nap [/COLOR][COLOR=Navy]0 [/COLOR][COLOR=Green];18mS
[/COLOR][COLOR=Blue]loop
[/COLOR][COLOR=Green];
; Hurray - switch released!
;
[/COLOR][COLOR=Blue]nap [/COLOR][COLOR=Navy]4 [/COLOR][COLOR=Green];wait for switch to stop bouncing (probably unnecessary)
[/COLOR][COLOR=Blue]PokeSfr IOCAF[/COLOR][COLOR=Black], [/COLOR][COLOR=Navy]0 [/COLOR][COLOR=Green];reset Switch detections
[/COLOR][COLOR=Purple]SwitchChecker [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Navy]0 [/COLOR][COLOR=Green];say we've not seen any[/COLOR]
UPDATE: I don't know if it is pertinent, but this code is running in #Slot 1 of the 14M2
Last edited: