View previous topic :: View next topic |
Author |
Message |
jo Guest
|
Cant i turn WDT on/off as i like? |
Posted: Mon Jun 06, 2005 9:07 am |
|
|
I am using a PIC16LF76 and i found out that i can only setup and restart the WDT. The enable/disable option is only valid for PIC18. What can i do?
I tried to manually clear WDTE of Config Reg addr:2007 but to no avail. The WDT still carries on...
My project uses sleep to put the PIC in standy mode so it will not waste energy but if i keep on forcing it back to sleep after it wakes by WDT, is not meeting my objective of doing so.. Pls help.
Thanks |
|
|
valemike Guest
|
|
Posted: Mon Jun 06, 2005 9:41 am |
|
|
The way i understand most of the PICs, the watchdog timer enable/disable is a setting in the FUSE bits, that get programmed in when you flash the chip.
The only control you have over the wdt now once the PIC is running is to refresh it and, i think, to change its timeout rate.
So if you must use the wdt and go to sleep, then the best you can do then is to set the WDT for the maximum time til timeout, which i think is 2+ seconds. This time varies with temperature and per device though. |
|
|
valemike Guest
|
|
Posted: Mon Jun 06, 2005 9:45 am |
|
|
By the way, even if the PIC does wake up every few seconds or so because of the WDT, all you have to do is to quickly go back to sleep. If you put an ammeter thru it, this isn't as bad as you think. You'll only draw a spurt of a few microvolts (or a few millivolts). Such activity alone ought to last longer than the battery's shelf life itself. |
|
|
jo Guest
|
Thanks |
Posted: Mon Jun 06, 2005 9:50 am |
|
|
ya, i think thats the only way out.. thanks for your info..
but what about the WDTE,bit2 in Config Reg 2007? it says WDT can be disabled by clearing it?
sorry for all the ques, i am still very new in all this.. |
|
|
MikeValencia
Joined: 04 Aug 2004 Posts: 238 Location: Chicago
|
|
Posted: Mon Jun 06, 2005 2:47 pm |
|
|
"Configuration bits" are what i meant by the "fuse" bits, which can only be programmed while you flash the chip. |
|
|
Steve H Guest
|
|
Posted: Mon Jun 06, 2005 3:38 pm |
|
|
The WDT is like a fail safe for your program. If misbehaving software could turn it off it would not be a very reliable fail safe. That's why it can't be disabled via software.
Steve H. |
|
|
jo Guest
|
Got it! |
Posted: Tue Jun 07, 2005 6:29 am |
|
|
ok, i understand now.. thanks for all the help..
that explain why nothing hapen even if the WDTE bit is changed during execution ..
thanks again |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Thu Jun 09, 2005 1:46 pm |
|
|
There are other PIC's that do allow you to enable or disable the WDT through software. I use an 18F452 quite regularly and if left disabled, at programming time, it can be controlled via software. If you need control of the WDT then look for another PIC that will allow you to do this.
Ronald |
|
|
jo Guest
|
thanks |
Posted: Fri Jun 10, 2005 4:17 am |
|
|
ok, thanks for the info.. however i am stuck with the PIC16 at the moment. Anyway i have implemented the WDT and is waking up every 2 sec to go back to sleep again...
|
|
|
|