View previous topic :: View next topic |
Author |
Message |
newguy
Joined: 24 Jun 2004 Posts: 1907
|
Windowed WDT Operation |
Posted: Wed May 04, 2022 9:46 am |
|
|
Just thought I'd pass this along in case anyone else has any doubts about the windowed watchdog timer's operation.
I'm using the PIC18F45K42 and it supports a function, get_wdt(), which isn't found in the help documentation. I like the idea of employing the window functionality but I wasn't sure how I could avoid trying to restart the watchdog without accidentally restarting it outside of the allowed window (which will cause an immediate processor reboot).
If you're curious about get_wdt(), as I was, here's what it returns: the 5 bits of the watchdog count of the WDTTMR register. For example, if you've set the WDT to have a 12.5% window, you have to wait until the number returned by get_wdt() is 0x1C or greater before you can issue your restart_wdt() command.
Hope this helps. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19506
|
|
Posted: Wed May 04, 2022 9:57 am |
|
|
It is in the manual. Page 301 in the current version.
The WDT timer is not readable on most chips. Only ones with the windowed
WDT allow it to be read. |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
Posted: Wed May 04, 2022 10:32 am |
|
|
That's my problem. Only consulted the help, not the manual. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19506
|
|
Posted: Thu May 05, 2022 12:36 am |
|
|
Get_wdt, is there in the help as well. It is in the 'built in functions' list
under timers, and in the search, but it isn't in the 'index'. It first
appeared in 5.081, but was missing from the function list at that time.
Annoyingly CCS for the last couple of years has got much worse at
putting notes about things like this in the 'readme' with the compiler.
This has only been updated a couple of times over the last thirty versions,
and this hasn't been recorded there.
As I said, only chips with the windowed WDT, actually allow the code to
read the WDT timer at all. Nicely, if you search on 'windowed' in the
help, it does tell you about this function.
So slightly poor updating of the documentation here. |
|
|
|