View Single Post
  #12   Spotlight this post!  
Unread 12-04-2006, 13:05
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
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,801
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: Phase A and Phase B on encoders

Quote:
Originally Posted by gburlison
Can we also connect the 'B' side of the encoder to an interrupt and effectively quadruple the amount of precision by counting the rising and falling edges of both the 'A' & 'B' channel of the encoder?

Would this be any different than multiplying the single channel count by '4'?
The quick answer is yes, it's as you describe - more interrupts = more resolution per revolution.

Multiplying the existing count of the rising A interrupt by 4 doesn't tell you the encoder has moved further, it only changes the units it's expressed in. That's like multiplying your salary by 100 - okay, you then know how much you made in pennies, but it doesn't let you buy more stuff than you could before. Each actual interrupt you see tells you the encoder has absolutely, positively moved. Extra interrupts are more like extra dollars in your salary - always a nice thing .

The complexity of your interrupt hander code goes up to correctly interpret the order of the additional interrupts, so you keep track (state machine style) of whether the encoder is rotating forwards vs backwards and when it jitters or changes direction.
E.g., if the A line rises then falls again before the B line changes (either up or down) then you've reversed direction. Or an A fall followed by a B rise is the opposite of an A fall followed by a B fall. You have to know if you should be adding or subtracting encoder counts.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 12-04-2006 at 13:25.