This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

How to make E Series Counter to Detect Both the Rising and Falling Edges

Updated Jul 30, 2023

Environment

Hardware

  • Counter/Timer Device
  • Quadrature Encoder
  • Multifunction I/O Device

Driver

  • NI-DAQmx

I have an X2 type encoder, where the count is supposed to increase on both the rising and falling edge of my A phase. When I connect this signal to one of my counters on my E-series device, I only get half of the counts that I would like. Can the counters be set to increment on both the rising and falling edges of a signal?

With E-series boards, a single counter cannot detect both rising and falling edges of a signal. To detect both edges of your signal, you will need to use both counters on your device. Wire the A phase to both GPCTR0 source and GPCTR1 source pins. In your program, create an event counting task for each counter. Enable one counter to count rising edges and the other to count falling edges using the following steps.
  • Using DAQmx: The Count Edges instance of the DAQmx Create Virtual Channel VI contains the edge parameter, which can be used to configure your counter task to count either rising or falling edges. Select either rising or falling, then add the counts from each counter together to form a total count, reflecting the actual X2 position measurement.
  • Using Traditional DAQ: Use the Set Attribute VI in LabVIEW to configure your counter task to count either rising or falling edges. Select source polarity as the attribute ID, and low to high or high to low with the source polarity parameter. Then, in your program, add the counts from each counter together to form a total count, reflecting the actual X2 position measurement.
  • NoteM and X Series boards have the ability to count both the rising and falling edges of a signal, as well as support for X1, X2 and X4 encoders. To learn more information about using M Series devices with quadrature encoders, please see the DAQ M Series User Manual below (page 7-14). To learn more about using X Series devices with quadrature encoders, please see the DAQ X Series User Manual below (page 7-21).