Showing results for 
Search instead for 
Did you mean: 

I have generated two square wave forms using NI-9221. These two Square waveforms are suppose to be 90 degrees electrical from one another.

 I have two square wave forms from an encoder wheel. I can not seem to generate or calculate the phase of the waveforms. I have tried to extract the data but it is not accurate? I can not use a true false statement with the extracted data either. I have to have the one waveform 90 degrees electrical from the other waveform. Any Suggestions?

0 Kudos
Message 1 of 5

A bit confused- you say you are generating the waveforms with the 9221 and also saying you are trying to measure the phase of the encoder.


If you are using a quadrature encode, the A and B signals are already 90 degrees out of phase by definition.



"It’s the questions that drive us.”
0 Kudos
Message 2 of 5

As AK2DM pointed out the signals are 90 degrees apart by definition.  But that is 90 degrees of rotation, not time.  When the angular velocity is constant the time phase and angular phase will be the same.


There are 8 possible combinations of transitions and levels for the two signals. A simple state machine monitoring transitions and levels can be used to produce direction and count signals.



0 Kudos
Message 3 of 5

Fist thank you both for responding so quickly. I am using a half encoder wheel and the waveforms are certainly show the phases correctly.  The operator of this program will not have access to the graph only the data and measurements collected. The reason I am trying to get the phase is because that is going to be a major factor in if the board passes or fails. I extracted the phases from the waveforms but it’s not accurate at all. I think I may try to trigger when to measure the wave and when to stop measuring. Is that Possible?



J. Powell

0 Kudos
Message 4 of 5

Please post your VI with some typical data saved as default. We do not have your hardware so we cannot reproduce the data collection, but we may be able to help with the analysis.


1. How fast is the encoder pulsing during the test? What is the range of speeds? Can the speed change significantly during a test?

2. How are you sampling the data? How are you triggering the data acquisition?

3. How are you defining the phase relationship between the encoder channels? 

4. What defines your pass/fail decision?



0 Kudos
Message 5 of 5