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.
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 like it is explained 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. Depending on the timing settings for the task, the Counter will be armed by the Start Task function and will start acquiring the signal, when the Read function is called it will retrieve the most recent value. This "arming" action is the one that tells the counter when to start counting. Whether the Counter Task is armed by the DAQmx Task Start is dependent on the sampling timing type. In this case, for On-Demand mode the counter task is not armed until you call the DAQmx Read function, while Implicit or Sample Clock timing modes allow the counter task to be armed with the DAQmx Start Task. 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, and using this the DAQmx Read function will arm the counter and will return the next measurement, not the one that is already in progress, so you have to call the DAQmx Read function 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.
In case that you want to use the Finite Samples mode, even if you want to acquire just one sample the minimum value for the Samples per channel property is 2 so the Read function will return a warning about the buffer size but you could filter that warning using one of the methods explained in the How Do I Ignore a Specific Error in LabVIEW? article.
Collaborate with other users in our discussion forums
A valid service agreement may be required, and support options vary by country.