Information Needed on Timer1

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Post Reply
keshavamurthy k.c
Posts: 18
Joined: Fri Feb 26, 2010 5:05 am
Contact:

Information Needed on Timer1

Post by keshavamurthy k.c »

Hi,

I want to use Timer1 interrupt for every 1 msec.But if we seclect Interrupt component in
that after selecting timer1 interupt and changing in proerties i am not able to get exactly for 1 msec.
Can you please provide how i need to configure register.


Thanks & Regards
Keshav

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Information Needed on Timer1

Post by Benj »

Hello

You can get different interrupt rates by using the calulator available from here.

http://users.picbasic.org/projects/PicT ... merCal.htm

By changing the timer offset value and the prescaler you should be able to get a whole number or at least a low percentage of error.

The timer offset value will need to be written to the interrupt count registers at the start of your service routine to allow the updated timeout period to be set.

Using a C code icon the code would look similar to this.

tmr1l = 0x12;
tmr1h = 0x01;

Post Reply