|
Re: Why are four states needed with Quadratuer encoders?
Some times, you don't always have 90 degrees between the two sensors or you don't always have exactly 50% duty cycles (a.k.a. even ON and OFF times). In these cases, folks often ignore edges to improve on velocity calculations.
By calculating velocities based on rising edge to rising edge of the same channel (or falling to falling) you can avoid the problems associated with non-50% duty cycles and variations in phasing between A & B*.
Note that we don't always get to spec out the encoder we'd like in an ideal world so we sometimes end up with the phasing and the duty cycle of the sensors being non-constant due to changes in velocity, temperature, voltage, etc. It is not ideal, but what is?
This tends to be more of a problem with calculating velocities than positions.
Joe J.
*you can still get a velocity calc at every edge, but you have to keep 4 different times in memory and subtract the appropriate past time from the current time. Also, you need to be careful during transitions from CCW to CW or vise versa. It is surprisingly easy to write code that blows up (or at a mininum gets the wrong answer) during direction changes.
__________________
Joseph M. Johnson, Ph.D., P.E.
Mentor
Team #88, TJ2
|