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 CCS Technical Support

Need help, timer1

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



Joined: 09 Mar 2007
Posts: 6

View user's profile Send private message

Need help, timer1
PostPosted: Fri Mar 16, 2007 1:15 am     Reply with quote

I am using pic16f877a and set timer 1 ,I need to know each increment
in timer 1 what will be equal in us, please help me.
I am using pcm v4.024
#use delay(clock=4000000)
setup_timer_1(T1_INTERNAL | T1_DIV_BY_4);
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Fri Mar 16, 2007 8:49 am     Reply with quote

Well, the way to figure this is take the main oscillator (Fosc) divide that by 4 (a hardware division), divide that by 4 (since you have that configured in your setup_timer_1() statement) and then divide that by 65536 (which equals the 16 bit register that counts the clocks) and you will have the frequency of Timer1's interrupt.

Fosc/4/4/65536.

You will get 3.8146972 interrupts each second which equals to be aproximately 262mS between each interrupt.

Clear as mud?

Ronald
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