Whilst we sorted out the root problem, I wanted to enable a Hardware Watchdog in the embedded project.
If the PIC crashed, the PIC would automatically reset and probalby run fine again.
I thought implmenting a WatchDog would be quite involved but it turned out to be really simple.
I have put together a little FC program for a PIC18F that flashed an LED and after 200 cycles, it fakes a Lock Up.
The WatchDog is triggered and reset the PIC, starting the process all over again.
The WatchDog is Enabled in the FC Configuration setting, same place you set the PIC version your using.
File > Project Options > For my PIC is was in section 0x2
The WatchDog Time-Out is 4mS x the PreScaler Value, which is also set in the Configuration settings.
You just need to consistantly run a single C command to stop the Watch Dog Triggering.
Code: Select all
CLRWDT();
J.