# task in PIC16f887 with watchdogtimer

Can someone help how to find formula and calculate this task?

How many times per second will be reset if the microcontroller is set to 1:128 preskaler microcontrollers and works on Frequency of 8 Mhz.

Could someone explain me how to solve this kind of task? Please.

-
On the '887 you have 2 prescalers on the watchdog - the dedicated 16-bit watchdog prescaler, and the secondary prescaler shared with Timer0. Are you using the secondary one at all, or just the watchdog one? –  Majenko Nov 30 '11 at 17:57
just watchdog one –  jiki Nov 30 '11 at 18:00

## 1 Answer

The watchdog always runs from the internal 31KHz internal oscillator.

The general formula for calculating the watchdog time is:

$\frac{1}{31000}\times WDTPrescaler [\times Prescaler]$

Where $WDTPrescaler$ is the dedicated 16-bit watchdog prescaler, and $Prescaler$ is the optional 8-bit prescaler shared with the Timer0 module.

So in your case it's

$\frac{1}{31000}\times 128 = 0.004129032$

Which is roughly 4ms.

If you were using the secondary shared prescaler you would multiply the answer by that value as well.

-
if I use secondary prescaler the formula is the same or diffrent? –  jiki Nov 30 '11 at 18:06
The formula would include the part in [ and ]. You can think of not using the Timer0 prescaler as using it but with it set to 1:1 - so multiply the answer by 1 - which does nothing ;) –  Majenko Nov 30 '11 at 18:07
the value in [ ] is 128 or 256? –  jiki Nov 30 '11 at 18:08
I have clarified my answer a little –  Majenko Nov 30 '11 at 18:09
@jiki: Please accept the answer if you find it correct and helpful. –  Andrejs Cainikovs Nov 30 '11 at 18:45