CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Windowed WDT Operation

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
newguy



Joined: 24 Jun 2004
Posts: 1908

View user's profile Send private message

Windowed WDT Operation
PostPosted: Wed May 04, 2022 9:46 am     Reply with quote

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: 19515

View user's profile Send private message

PostPosted: Wed May 04, 2022 9:57 am     Reply with quote

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: 1908

View user's profile Send private message

PostPosted: Wed May 04, 2022 10:32 am     Reply with quote

That's my problem. Only consulted the help, not the manual.
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Thu May 05, 2022 12:36 am     Reply with quote

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. Sad
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group