Archived:Using an Up/Down Encoder With an NI S Series DAQ Card

Updated Mar 6, 2025

NI does not actively maintain this document.

This content provides support for older products and technology, so you may notice outdated links or obsolete information about operating systems or other relevant products.

Environment

Hardware

  • Counter/Timer Device
  • PXI-6123
  • PXI-6133

Software

  • LabVIEW

Driver

  • NI-DAQmx

This KB will show you how you can use an NI S Series DAQ card, such as a PXI-6123 or PXI-6133, with an Up/Down or Bidirectional encoder. This KB will use LabVIEW as the programming environment and requires the NI-DAQmx driver .

  1. Refer to Appendix A of NI 6110/6111/6115/6120/6122/6123/6132/6133/6143 Feature Guide to find the pinout for your particular NI S Series DAQ card
  2. Connect Channel A of your encoder to one of the counter's Source terminal
  3. Connect Channel B of your encoder to the corresponding counter's Up/Down terminal (P0.6 for counter 0 and P0.7 for counter 1)
  4. Use a NI-DAQmx Count Edges task and set the count direction to Externally ControlledThis uses the state of a digital line (P0.6 or P0.7) to control the count direction.
Counter.PNG
  1. From here, you can use the DAQmx Read.vi to see the value/count.

NI-DAQmx installs examples that show how to perform Edge Counting with encoders.
These can be found here: C:\Program Files (x86)\National Instruments\LabVIEW 2021\examples\DAQmx\Counter Input
Note, this path is for LabVIEW 2021 32-bit. Update the version of LabVIEW to reflect the version of LabVIEW you are using. Also, if you are using LabVIEW 64-bit, change '/Program Files (x86)/ to '/Program Files/'.

These LabVIEW examples can be edited as described above to be externally controlled.