CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

timer0 and WDT (timer0 is too fast when WDT is enabled)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mutthunaveen



Joined: 08 Apr 2009
Posts: 100
Location: Chennai, India

View user's profile Send private message

timer0 and WDT (timer0 is too fast when WDT is enabled)
PostPosted: Thu Jan 19, 2017 3:07 am     Reply with quote

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: 19446

View user's profile Send private message

PostPosted: Thu Jan 19, 2017 3:26 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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