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

Help in determining Timer1 preload

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



Joined: 18 Jan 2010
Posts: 17

View user's profile Send private message

Help in determining Timer1 preload
PostPosted: Sun Feb 12, 2012 10:48 pm     Reply with quote

I know that questions about timers have been asked on here time and time again but I have a unique situation that I don't know how to tackle with the preload.

I have INT_RTCC interrupt set up and ran it in the MPLAB Sim and it says that there are 1033 instructions. Now I have a 16F628A chip with Timer 1 set up at a prescaler of 4 at 8 bits. I'm guessing to use a preload but don't know exactly how to calculate the number to use. I know that it will interrupt after 1024 instructions but that is 9 less than it takes to run the code in the interrupt not including any overhead that I need to take into account. Right now i took 255-1033 and used that as a preload but don't know how much preloads like negative numbers. What would be the correct method here? Program runs fine if that matters and if it helps I can post the code but its lengthy.

Any help would be greatly appreciated
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 13, 2012 2:00 pm     Reply with quote

It doesn't take a long program to demonstrate how to use a Timer preload.
Probably 20 lines at most, and that's including all pre-processor statements.

Do you realize you asked for specific Timer help but you didn't tell us
your desired interrupt frequency, or your PIC's oscillator frequency ?
That's why you didn't get any replies so far.
danen



Joined: 18 Jan 2010
Posts: 17

View user's profile Send private message

PostPosted: Sat Feb 18, 2012 10:18 pm     Reply with quote

Quote:
Do you realize you asked for specific Timer help but you didn't tell us
your desired interrupt frequency, or your PIC's oscillator frequency ?
That's why you didn't get any replies so far.


Sorry about that, I am using the PICs internal oscillator at 4 Mhz and my compilier version is 4.120 if that makes a difference
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Feb 19, 2012 1:30 pm     Reply with quote

You still didn't answer the part in bold:
Quote:

Do you realize you asked for specific Timer help but you didn't tell us
your desired interrupt frequency, or your PIC's oscillator frequency ?
That's why you didn't get any replies so far.
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