Hello Craig,
It looks like you are trying to do an x4 quadrature encoder measurement from scratch (i.e. do all the calcuations by yourself). Using DAQmx however, we have a built in task type that allows you to use quadrature encoders directly. Check out
this example and see if that works for you. I am assuming you are using LabVIEW, if this is not the case, let me know what you are programming in and I will try and find an example in that language (or you can search the example programs to see if you can find one).
Depending on the encoder, there will be some ambiguity as to position. This is determined by the distance between pulses on the encoder. You can also see some issues if your system is vibrating. If you bounce back and forth across an edge of your encoder signal (usually due to vibrations), you can see unwanted ticks that will throw your position off.
I hope this helps, please let me know if you have any more questions.
Neal M.
Applications Engineering National Instruments www.ni.com/support