View previous topic :: View next topic |
Author |
Message |
phased
Joined: 03 Oct 2006 Posts: 17
|
Help with WDT and TOCKI |
Posted: Thu Oct 12, 2006 6:41 pm |
|
|
I would like to "wake up" a pic16F54 every half a second and check the status of RA2.
As suggested by others, I'll have to use the watchdog Timer. My questions is how to set the "postscalar" and how I should configure the pins? That is, do I need to tie TOCKI to Vdd, Vss, or somehow use it?
Thanks.
And thank you all for all the help I've been given to date. I hope that I'll be good enough at this someday to pass on the favor to others. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Oct 12, 2006 9:30 pm |
|
|
The watchdog timer runs on its own internal RC oscillator. There's
no external oscillator.
To use the watchdog, enable it in the #fuses statement.
At the start of main(), put in a setup_wdt() statement.
Look near the end of the 16F54.H file and you'll see eight
#define statements that let you choose the nominal WDT
period. Put one of those constants into the setup_wdt()
function as a parameter.
You'll also have to put one or more restart_wdt() statements in
suitable location(s) in your program, to prevent the WDT
from resetting your program during normal operation. |
|
|
Ttelmah Guest
|
|
Posted: Fri Oct 13, 2006 3:16 am |
|
|
Remember though, that the watchdog is very innaccurate. It is fine, provided by 'half a second', you are prepared to accept that in some temperatures/chips, this may be anything from perhaps 1/4 second, to a second. If however the time is important, another route will be needed...
Best Wishes |
|
|
|