Why Does the DAQmx Start Task Won't Arm the Counter When Using Two-Edge Separation Measurement Type of a Counter Input Task?

Updated Jun 20, 2023

Reported In

Software

  • LabVIEW

Driver

  • NI-DAQmx

Issue Details

When trying to set a Two-Edge Separation Task the DAQmx Start Task VI is not arming the counter so the device is missing the pulse if the DAQmx Read function is not being called before the pulse arrives. 

Solution

The Two-Edge Separation measurement on a Counter Input Task measures the amount of time between the rising and falling edge of one digital signal and the rising or falling edge of another digital signal. The signals should be present on the default input terminals for the counter selected or can be specified by selecting different input terminals as in the How Do I Configure a Counter Task to Measure Two Edge Separation in Terms of Ticks of a Third Channel article.
 
The process for creating this task is presented in the NI DAQmx Help documentation, in the Measuring Semi-Period, Two-Edge Separation, and Pulse Width Programming Flowchart section.
 
The "arming" of the counter task action is what tells the counter to start counting. The arming action is dependent on the timing mode of the task. If the DAQmx Timing VI is set to Implicit or Sample Clock timing modes, then the DAQmx Start Task arms the counter. In the armed state the task will begin acquiring the signal, and calling the DAQmx Read function will return the acquired data. 
 
If the DAQmx Timing VI is not used in the code to specify the timing mode for your Counter Input Task, then the default is On-Demand timing. For On Demand timing, the DAQmx Read function will arm the counter and will return the next measurement. The read will not return the measurement that is already in progress, so the DAQmx Read function will need to be called before the pulses get to the counter.
 
This could be an issue if you have several counters working in parallel since you will need to have all the DAQmx Read functions for each of the tasks in parallel to prevent missing the pulses.

In this case, the solution is using the DAQmx Timing VI and setting an Implicit or Sample Clock timing mode to arm the counter task when calling the DAQmx Start Task VI.

TwoEdgeSeparationUsingImplicitTiming.png

 

Additional Information

If you try to acquire only one sample using the Finite Samples mode, then the read function will return a buffer size warning. This warning occurs because  the minimum value for the Samples per channel property is 2. In this case the warning can be filtered out following the method explained in this article.