View Single Post
  #1   Spotlight this post!  
Unread 31-01-2008, 13:33
Abrakadabra Abrakadabra is offline
Here We Go !!!
AKA: Scott Kukshtel, Mr. K
FRC #3467 (The Windham Windup!)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2002
Location: Windham, New Hampshire
Posts: 160
Abrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant future
Regularity of RepeatingTimer interrupts?

How accurate can I count on the trigger timing of ISRs registered with RegisterRepeatingTimer() to be?

I have the idea of using a repeating timer to do regular velocity calculations on the two quad encoders attached to my gear boxes. Basically the ISR would read the encoder counts, subtract the previous counts from each to get the differences, and divide by the repeating timer interval (most likely 256ms, so I can divide using bit shifting). The resulting velocities would be stored in global variables to be accessed by my PID code running in the "default" loop.

Will this work?