Hi Team.
Please help me understand how the watchdog is handled in FC.
If I select the auto clear in the build properties where does FC clear the WDT ? at the end pf the main loop or somewhere else?
I suppose I need to configure the WDT Timeout by setting the WDTCON register is this done by a normal C call ?
I only need to enable the WDT in Config and then it will run to what ever I set in the WDTCON as time , I am confused as to where FC clear the watchdog and how to you manually clear the WDT in FC
Thanks for the help and pointers it is appreciated.
WDT and FC
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: WDT and FC
Hi Peter,
The Auto Clear Watchdog Timer checkbox automatically clears the watchdog timer whenever a component macro is called and also when a millisecond or second delay is called.
If you want to clear the watchdog timer yourself then you can do so using this line of C code.
To write to the Watchdog timeout register you would simply do this.
Hope this helps.
The Auto Clear Watchdog Timer checkbox automatically clears the watchdog timer whenever a component macro is called and also when a millisecond or second delay is called.
If you want to clear the watchdog timer yourself then you can do so using this line of C code.
Code: Select all
MX_CLEAR_WATCHDOG;
Code: Select all
WDTCONbits.WDTPS = 0b01011;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: WDT and FC
Hi Ben.
Thank a million,it is clear now ,I also suppose when not activating the auto clear and setting the WDT too ON, I can clear it in the FC where I need it
Thank a million,it is clear now ,I also suppose when not activating the auto clear and setting the WDT too ON, I can clear it in the FC where I need it
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: WDT and FC
Yep it's best to control it yourself if you can.Thank a million,it is clear now ,I also suppose when not activating the auto clear and setting the WDT too ON, I can clear it in the FC where I need it
The main reason for having the auto clear watchdog is if you have delays in your program which are larger than the watchdog timeout period. In this case we break up the delay into manageable sections with clear commands in between however in practise this can extend the overall length of the delay.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel