LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Digital Encoder Using DAQ

Hi,

 

I have an encoder from US Digital (http://www.usdigital.com/products/encoders/incremental/rotary/kit/E2) that I am trying to read using my DAQ device in order to get angular rotation. My DAQ is a NI USB-6281 and I am connecting using a 50 pin feed through pannel (NI SCXI-1302). 

 

I would like for my program to communicate with the encoder to output angular position, as I will be using it to measure elbow joint angles. Therefore, I would also like to the encoder to be read directionally (for both increasing and decreasing angles). 

 

The encoder I am using has A, B, and Z outputs, and I am currently trying to read them using built in DAQ assistant, set to acquire counter input and angular position. After reading through a few manuals on how to communicate with encoders using labview and DAQ assistant and consulting with the manual for the 6281 device, I feel like I have all of the resources necessary to directly communicate with the encoder, however I am not getting the output I would expect. 

 

After hooking up the leads to the feedthrough pannel, and setting the DAQ assistant to output degrees, all that are output are spikes, that I believe coincide with whenever the system reads an encoder tick. 

Capture.PNG

 

So there is some form of communication, but it is not working as I would expect. Currently, I have my A and B pins connected to terminals 47 (PFI8/CTR 0 SRC) and 48 (PFI9/CTR 0 Gate) of the 1302 device. However, the DAQ says I should be connecting pin B to PFI10 in order to communicate with CTR 0, which I am unable to find on my pannel. The ground is connected to the digital ground on the feedthrough pannel, and excitation is connected to +5V. Additionally, I have the encoding type set to X4, which I believe is correct for my application.

 

I have read in other forums about communicating with a High_Low pin on the DAQ, but I am unable to locate that on my 6281 device (although the manual says it has that capability).

 

If anyone could help, it would be greatly appreciated.

 

Thank you,

Peter

 

 

0 Kudos
Message 1 of 5
(5,397 Views)

Did you read the USB-6281 Manual?  There's a section on Measurement using Quadrature Encoders that discusses X4 encoding using A, B, and Z inputs.  Also the section on Pin location differs somewhat from the values you describe.  For Channel 0, A, B, and Z are on pins 37 (PFI8), 45 (PFI 10) and 3 (PFI 9), while Channel 1 A, B, Z pins are listed as 42 (PFI 3), 46 (PFI 11), and 41 (PFI 4).  [I might have copied something down wrong, but the wiring looks very different from what you mentioned].

 

Bob Schor

0 Kudos
Message 2 of 5
(5,360 Views)

Hi Bob,

 

Thank you for your reply. Yes, I have looked at the manual, however there is some disconnect between my USB-6281 and NI SCXI-1302 feed through pannel. I have a USB-6281 mass terminal, so there are no pins directly to the 6281. Instead, I must map through the 50 pins of the 1302, using the table below. 

Capture1.PNG

 

I am unable to find the PFI 10 and PFI 11 pins on this mapping. Do you know of any work around for this problem, or am I limited by the capabilities of the 1302 device?

 

-Peter

0 Kudos
Message 3 of 5
(5,353 Views)

Alright, so I believe I have figured it out. Bob, you were correct in sayign that my original pin connections were incorrect. And thanks to your advice, after consulting the manual for the 6281, the pin configuration and mapping is different for the 6281 than the diagram that I posted above. The actual pin outputs for the 6281 are as shown below:

Capture.PNGCapture1.PNG

So PFI 10 corresponds to pin 45 on the 6281, which then maps to screw terminal 37 on the 50 pin 1302 feedthrough pannel device.

 

So on the 1302 for CTR0, A goes to 47, B goes to 37, and Z goes to 48

For CTR1: A goes to 41, B goes to 36, and Z goes to 42

 

However, in my case I am only able to communicate with the encoders using CTR1. CTR0 is still not working. I am assuming this is due to a faulty pin somewhere.

 

-Peter 

0 Kudos
Message 4 of 5
(5,340 Views)

Glad we agree.

 

BS

0 Kudos
Message 5 of 5
(5,337 Views)