|
|
View previous topic :: View next topic |
Author |
Message |
piedos
Joined: 14 Mar 2005 Posts: 5 Location: TURKEY/Ankara
|
WDT setup problem... |
Posted: Tue May 03, 2005 5:59 pm |
|
|
Quote: | ..... When assigned to WDT, a CLRWDT instruction will clear the prescaler along with the Watchdog Timer. The Prescaler is not readible or writable.... |
writes in PIC16F628A datasheet, But CCS compiler (3.206) have no caution about restart_wdt(); --> CLRWDT command.
So do i need to set prescaler every time i clear WDT? Or it is enough to setup WDT once in whole code?
Which code is the right one?
......
setup_wdt (WDT_2304MS);
restart_wdt();
......
OR
......
restart_wdt();
setup_wdt (WDT_2304MS);
......
Thanks in advance, _________________ ---------------------------------------------------------
The only thing that equally given mankind is time. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue May 03, 2005 10:46 pm |
|
|
The prescaler is a binary counter. When you use the setup_wdt()
function, you are selecting one of the counter outputs, so that
your WDT timeout duration is multiplied by 1, 2, 4, 8, 16, 32, 64 or 128.
This selection doesn't change when you use restart_wdt().
The restart_wdt() function clears the prescaler counter to a value of 0.
But it doesn't change the selection of the counter output.
So the answer is, you use setup_wdt() one time, at the start of
your program. Then use restart_wdt() after that, in some suitable
location (or several locations) in your program. |
|
|
|
|
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
|