Showing results for 
Search instead for 
Did you mean: 

PCI-6602 Measuring Quadrature Encoder Signal 1200 PPR

I have a PCI 6602 board that I have set up with the following code:
GPCTR_Change_Parameter (2, ND_COUNTER_0, ND_INITIAL_COUNT, 0);

I use the following line to read the counter periodically.
GPCTR_Watch (2, ND_COUNTER_0, ND_COUNT, &depth1_raw);
The encoder I use is a BEI that has both 20 and 1200 PPF outputs. When I connect the 20 PPR outputs to the PCI-6602 it counts up and down perfectly. However, when I connect the 1200 PPR outputs it counts up perfectly, but then doubles the cont when it counts down. (Counts down twice as fast as it counts up)..
I checked the signal phase with a scope and it looks as good as the 10PPR signal. Even when I turn the encoder very slowly, it does the same thing.
The encoder signals are labeled as follows.
Pin1 = A 20 PPR
Pin2 = B 20 PPR
Pin3 = Z 1200 PPR
Pin4 = Z+90 1200 PPR
Pin5 = PWR GND
Pin6 = +5V
Pin7 = Chassis Gnd.

Thought I would include this for reference.
0 Kudos
Message 1 of 5
There are two things you can try to troubleshoot this issue. First swap the two 1200 PPR lines. The counter should count in the opposite direction and depending on the encoding scheme you have chosen (X1, X2, etc.), may display the double count in the up direction. If you do see the same behavior in the opposite direction, then it is possible that one edge of the TTL pulse is not as clean as the other. The PCI-6602 has software configurable deglitching/debouncing filters to clean up TTL edges. Try setting these to 5 microseconds for each line using the Line_Change_Attribute() function. You can speed these up later, if necessary for your application. Also, be sure to specify the encoding scheme using the GPCTR_Change_Parameter() function. Take a look at the example
TIOquadEncoderPosMeasure.C in the \NI-DAQ\Examples\VisualC\ folder or the equivalent VB example. Please let me know how this works.

Best Regards,

Brent Runnels
Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
Thanks Brent! The problem turned out to be the encoder. I replaced it with a new one and it works great. The 6602 board works great for encoder applications.
0 Kudos
Message 3 of 5
For the first time i have to make the acquisition of 7 encoders signals.
Can i do this with the PCI-6602?
If it possible, i have to just connect each encoder, to each counter?
Please help me.
0 Kudos
Message 4 of 5


That should be just fine, as the 6602 has 8 counters on it. Take a look at this tutorial, and pay particular attention to the TIO section which pertains to the 6602. That should get you pointed in the right direction.


0 Kudos
Message 5 of 5