From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2-Bit Quadrature Encoder without counters

I've noticed that the internal help in LabVIEW only mentioned Quadrature Encoders in terms of reading them with the counter inputs of a device that supports that type of reading. In case your DAQ does not support those counter inputs, such as the NI USB-6008, here is a LabVIEW VI that reads the output of a 2-bit encoder such as the Grayhill 61C22-01-04-02 optical encoder, and also reads its pushbutton output. Note that this would be called an "X4 decoding" in LabVIEW terms when referring to the decoding operation that it implements.

 

Datasheet: http://eceserv0.ece.wisc.edu/~morrow/ECE315/ARM7-FPGA/datasheets/grayhill_61C.pdf

Wire the encoder up with the load resistors listed in second page of the datasheet, and tie one of the pushbutton pins to 5V.

 

The VI labels the physical channels that you should wire up to. Example:

DAQmx Device Name: Dev1

Encoder 5V Supply Channel: /port0/line0

 

Note that I delete the device name from the channel selector, so "Dev1/port0/line0" becomes "/port0/line0". I only break the Device and channel names into 2 selectors because I swap DAQs often and I prefer to write my programs to just take a single "DAQmx Device" input that I can change in one place, then leave all the other lines the same. Just a little quirk of mine I guess.

 

The "X4 Quadrature Encoder (SubVI).vi" and its subVIs are the ones doing the work, the parent VI is just an example of how to use them.

 

I hope this helps somebody.

 

____
Ryan R.
R&D
Message 1 of 2
(3,645 Views)

This was very helpful actually, thanks! 🙂

0 Kudos
Message 2 of 2
(2,574 Views)