View Single Post
  #6   Spotlight this post!  
Unread 08-02-2008, 10:12
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,854
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: How many interrupts is too many interrupts?

The number of interrupts you want to generate is dependent on the accuracy you design for. Any quadrature encoder you choose can be quadrupled in accuracy by discriminating programming.

An encoder rated to return 128 counts per revolution (cpr) assumes the use of an interrupt only on “output A,” and triggering an interrupt only on one edge, rising or falling, of output A, e.g., Digital Inputs 1 & 2.

You can double the effective resolution (a 128cpr encoder will give 256cpr) by alternating the interrupt trigger within the ISR to tick on both the rising and the falling edges of output A, a la Digital Inputs 3-6.

Further, you can quadruple your effective resolution (a 128cpr encoder will produce 512cpr) by also interrupting on “Output B” and triggering on both rising and falling edges.

BTW: Never use the combination of interrupting on both A & B, but only on one edge (rising or falling), since "ticks" would then vary in distance rather than be of constant length.


Quote:
Originally Posted by marccenter View Post
Quick question for this thread, does a single quadrature encoder count as one irq or 2 irq's ? My quick calculations show that a wheel speed of 8 feet/sec with a 256 pulse/rev encoder yields about 1000 interrupts per second or is it really 2000 interrupts per second because the encoder has two channels? The addition of a second encoder can now push the processor to 2000/4000 interrupts per second. So, if 2 irq's per encoder, the processor will be operating nearly 4000 interrupts per second?
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 08-02-2008 at 10:15.