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: is my thinking correct??

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








Timer0: is my thinking correct??
PostPosted: Tue Mar 27, 2007 1:37 pm     Reply with quote

Hi All,

I am using a 12F629 device with the internal 4 MHz oscillator. With this configuration, I believe that each clock cycle is 1 us, and thus the Timer0 can potentially increment every 4 us (Fosc/4). Is that correct?

Then if I further prescale this value by 16, the actual timer increment period
is 64 uS (16 X 4 uS).

Am I thinking about this correctly, because I'm getting consistently strange results when I try to use Timer0 to measure the duration of a known pulse width.

[code}

setup_counters( RTCC_INTERNAL, RTCC_DIV_16 );

[/code]

Thanks,

Charles
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Mar 27, 2007 1:43 pm     Reply with quote

Quote:

I am using a 12F629 device with the internal 4 MHz oscillator. With this
configuration, I believe that each clock cycle is 1 us, and thus the
Timer0 can potentially increment every 4 us (Fosc/4). Is that correct?

The oscillator freq is 4 MHz, so the oscillator period is 250 ns.

The instruction cycle clock is 1/4 of the oscillator freq. Therefore
it's 1 MHz, and the instruction cycle clock period is 1 us.

The timers run off the instruction cycle clock.
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