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
Posted: Mon Feb 13, 2012 2:00 pm
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
Posted: Sat Feb 18, 2012 10:18 pm
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
Posted: Sun Feb 19, 2012 1:30 pm
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.
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