Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a good example using the USB-6008 counter for measuring an encoder signal?

I am trying to use the counter channel on a USB-6008 device to measure the encoder from a servo motor. There is a LS7184 chip used to determine spin direction and the thought was that by knowing the starting count (home position), the relative count and the spin direction, I could calculate the position of the motor in Labview. The motor is connected to a probe that extends and retracts multiple times and the maximum position is used as the final measurement. Ultimately, if the probe is hitting a rigid object, the cycle counts should be the same. However, the data shows that on extension I get about 80 counts while I get 40 counts when retracting. I can't seem to get an even amount of counts per cycle. I acquire the count inside a timed loop to control the sample rate, but am not sure that is the best way. By using the loop, could it be possible I am missing counts? Is there a good vi example that could point me in the right direction?

0 Kudos
Message 1 of 4
(6,733 Views)

Hi,

 

A great place to start when looking for examples is the example finder. You can even have Vis that support your hardware highlighted with a yellow arrow next to them. This uses a feature that not too many people know about in the lower left hand corner of the example finder.

 

24610i69E1238AC5A10F09

 

The USB 6008 can only do software timed reads of its count register. How are you using the spin direction signal from the encoder? What don’t you post your code and a wiring schematic. The timed loop is fine, but the each call to DAQmx read is going to have and indeterminate amount of latency due to how your OS processes this commands and how your USB communication is executed; I wouldn’t rely on the timed loop for a deterministic sampling rate.

Matt
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(6,722 Views)

The spin direction is used to determine whether to add or subtract counts from the raw count. The A and B signals from the encoder are routed to the external chip to create a digital spin direction signal (1 = CW, 0 = CCW) that then is fed into a Dig I/O channel in the USB-6008 module. I then picking up the counter and spin channels in Labview, I let a sub vi keep track of the motor position (at least in theory). What got me to post my question is that I am seeing the dissimilar counts in the raw data before it's even post-processed by the subvi. This leads to believe something else might be going on.

0 Kudos
Message 3 of 4
(6,720 Views)

Ok, so ignoring the spin direction for now. If you turn the motor one direction one revolution you count one number of pulses, and if you turn the motor the other direction you count about half as many pulses? Can you scope the output from the encoder during this?  It may be the pulses returned from the device are problematic. Can you elaborate on “I can't seem to get an even amount of counts per cycle” from your first post? Do you mean the counts are not consistent?

Matt
Applications Engineer
National Instruments
0 Kudos
Message 4 of 4
(6,697 Views)