Pulsin causes reboot instead of timeout at slower clock speeds: 08M2

inglewoodpete

Senior Member
I am developing software for an 08M2 (Firmware v4.A) to interwork with a Davis anemometer. The 08M2 is the real thing, not the simulator. PE Version 6.0.7.2 Beta

I wasn't getting the granularity at low wind speeds with the PulsIn command that I wanted, so I lowered the PICAXE's clock speed to 1MHz. This gives me good resolution at low wind speeds but I found that the PICAXE consistently reboots rather than returning the timeout value of 0. I imagine that some sort of watchdog timer is resetting the 08M2 due to the extended execution time of the PulsIn command.

Is there a solution to this, apart from not running the chip a 1MHz or slower?

Code:
[color=Blue]Pause [/color][color=Navy]1000[/color]
[color=Blue]SerTxd ([/color][color=Red]"Booted"[/color][color=Black], [/color][color=Blue]CR[/color][color=Black], [/color][color=Blue]LF)
Do
   SetFreq m1        [/color][color=Green]'Works with m2; Fails with m1
   [/color][color=Blue]Pause [/color][color=Navy]1           [/color][color=Green]'Ensure clock is steady
   [/color][color=Blue]PulsIn C.1[/color][color=Black], [/color][color=Navy]1[/color][color=Black], [/color][color=Purple]w4
   [/color][color=Blue]SetFreq m4        [/color][color=Green]'Restore native clock speed for the SerTxd
   [/color][color=Blue]Pause [/color][color=Navy]2           [/color][color=Green]'Ensure clock is steady
   [/color][color=Blue]SerTxd([/color][color=Red]":"[/color][color=Black], #[/color][color=Purple]w4[/color][color=Black], [/color][color=Blue]CR[/color][color=Black], [/color][color=Blue]LF)
Loop      [/color]
 

Goeytex

Senior Member
Can you use pokesfr to write the WDTCON register? Changing bits 5:1 to 10010 should change the WDT timeout to 256 seconds.

If firmware will allow, writing a 1 to bit 0 OF WDTCON will turn off the WDT.
 

Goeytex

Senior Member
You can chose from these three. Tested to work


Code:
symbol WDTCON = $37

pokesfr WDTCON, %00010110   '//disable WDT
pokesfr WDTCON, %00011011  '//  WDT ON  Timeout = 8 seconds
pokesfr WDTCON, %00010111    '//  Restore WDTCON to default  (on + 2 seconds time out)
 

inglewoodpete

Senior Member
Thanks Goeytex and Alan for the quick and comprehensive responses. It's refreshing to find that I'm not quite at the bleeding edge and that others have taken the pain before me. There was a period about 4 years ago that I discovered a few firmware issues and 'hidden features':(.

It's getting a bit late here so I'll have to wait a day or two before studying and implementing the solution.
 
Top