Example Program Drafts

Showing results for 
Search instead for 
Did you mean: 

DAQmx Counter; Finite pulse width measurement with Event

This example demonstrate how to measure the pulse width of an signal.


  1. Ex. Typically it is interesting to measure the High/Low time of a switch. Maybe it happens only one time or it is difficult to predict when the switch change occurs.

Using normal DAQmx "Counter - Read Pulse Width and Frequency (Finite).vi" Example requires more than one switch event (Buffer Size) and requires that you select a timeout time for the DAQmx read function. You could wire there -1 which results in an endless wait until the required samples are acquired. But then you need to abort this VI (no DAQmx close) when the required samples couldn't be acquired.

How to use example:

  1. 1. Select which counter you want use
  2. 2. Select the PFI input where the measured signal is connected
  3. 3. Edit Max und Min Pulse Width times (seconds)
  4. 4. Define starting Edge
  5. 5. Define how many Pulse Widths you want measure
  6. 6. Run VI

Idea behind this example:

You register a dynamic DAQmx Event on the amount of Pulse Widths you want acquire. When the samples are acquired DAQmx is fire an Event which is handled from event structure. In this SubCase you run the DAQmx Read function with size of already acquired samples in buffer. So DAQmx Read should never run into a timeout and your acquisition can every time be stopped. (inkl. free all references)

DAQmx Counter- Read Finite Pulse Width with Event.png

Kind regards,