Quote:
|
Originally Posted by cabbagekid2
Would changing the code to make the encoders interrupt on both a change in A or B fix this problem? Or would this cause the microcontroller to interrupt too often?
|
Two things than can easily be done are: 1) Capture the state of the phase-B signal earlier in the ISR, and 2) use a D-type flip-flop to capture the state of the phase-B signal as the phase-A signal transitions from low to high. You can do this by wiring the phase-A signal to the flip-flop's clock input and to the interrupt input. Wire the phase-B signal to the flip-flop's D input and connect the flip-flop's Q output to the phase-B input on the robot controller. Option one will get you perhaps an extra microsecond or two. Option two will give you a much more significant increase.
-Kevin