16 bit timer

Status
Not open for further replies.

2camjohn

Member
I moved some of my routines from an 8 bit timer to the 16 bit timer on the 16f819.

From my understanding the timer works exactly the same except it overflows after 65536 ticks instead of 256.


So I expected to see the routine slow down alot (with the same prescalar it should run 256 times slower than an 8 bit timer). But it doesnt.

Am I misunderstanding how 16 bit timers work(I thought it just had to count upto 16 bits instead of 8 )?

Is there anything else I should know?


Cheers
John
 
The 16 bit timers don't use the prescaller in the OPTION register. Timer 1 and 2 have there own prescallers.

Mike.
 
I have the prescalar currently set to

T1CON.T1CKPS1 = 1
T1CON.T1CKPS0 = 1

Thats from the timer1 section of the datasheet.
But it seems to go as fast as the 8 bit timer!!!

Just to confirm a 16 bit timer will only create an overflow once it has incremented 65536 times???



Cheers
John
 
2camjohn said:
Just to confirm a 16 bit timer will only create an overflow once it has incremented 65536 times???

Cheers
John

Yes, in your case, with the prescaler set to 8, it will be 8*65536.

How are you testing for overflow? With TMR1IF?

Mike.
 
Yes

And it is reset to zero at the end of the timer routine.



Thanks for the help so far...

John
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…