Joined: 08 Apr 2009 Posts: 100 Location: Chennai, India
timer0 and WDT (timer0 is too fast when WDT is enabled)
Posted: Thu Jan 19, 2017 3:07 am
Dear Board
I’m using 16F877A PIC and I'm facing this weird problem when enabling WDT.
First i wrote a code with timer0 which could create 10ms and executed.
- Code works fine and I get 10ms interval as expected
After I enabled WDT and used with approx. 2 sec (consulting close to 2 sec time in devices.h file) and restarted WDT every where possible in my code.
- After compiling and during execution I see the timer0 with 10ms is too fast and 10ms become to 40us. Too fast timer0 event occurring.
So weird.
When I disable WDT the timer0 restores to 10ms (good working).
Is there WDT and Timer0 somewhere linked or am I doing something wrong somewhere not known?
Please help me.
thank you
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
Posted: Thu Jan 19, 2017 3:26 am
Read the data sheet......
Yes on your chip, the WDT, and timer0, use a shared prescaler.
Look at:
"BLOCK DIAGRAM OF THE TIMER0/WDT PRESCALER".
The prescaler is only available or one device _or_ the other.
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