Quote:
Originally Posted by Bomberofdoom
In order to know if B is high, we need to compare to the last length of phase B, or does Kevin's Encoder calculate that automaticly somehow?
|
You don't need to know anything about the length of B. To check whether B is high or not, all you need to look at is the value of the Digital input that B is connected to.
The way an interrupt works is that you enter the ISR
on the transition from a low state to a high state. You can choose which transition it is, but I'm pretty sure it's low-to-high by default in Kevin's code.
In the ISR, you check the value of B by just using the standard "rc_dig_inX" variable. In Kevin's code, that's #defined to ENCODER_Y_PHASE_B_PIN. When you're going forward, B will be one value, let's say 1. When you're going reverse, B will be the opposite value, 0.
A picture illustrates this better:

(from:
http://digital.ni.com/public.nsf/all...256275005E18E2)
Hope that helps. Ask more if you still have questions!