DAQ_Digital PWM Measurement Library
- Updated2025-04-25
- 4 minute(s) read
DAQ_Digital PWM Measurement Library VIs initialize, configure, measure, and close counter input tasks with an assigned input terminal. This library is applicable for digital I/O channels and modules that support timing input signals with PFI channels or other connections.
- Use the DAQ_Dig PWM Meas Initialize VI to initialize hardware and create a DAQmx Task for digital PWM measurement.
- Specify the physical or global channel input to use for the counter. Only one counter can
be used for a task. Only one counter can be
used for a task. Use separate tasks for each counter if multiple counters are
required. Note The Global Channel (Counter) input terminal supports only Semi-Period Counter Input global channels from NI MAX. The VI returns an error for other invalid global channels.
- Provide the output terminal on which to measure the signal. Refer to the NI-DAQmx Device Terminals Help table. To access the table in NI MAX, select your device and right-click Device Pinout. Use the table to view the default PFI terminals of each counter for your device.
- If necessary, configure PFI lines.Note For the TestScale TS-15050 module only, P0.DIO<0:7> channels map to PFI<0:7> terminals. Refer to the TS-15050 Specifications for more information.
- During initialization, counters are reserved with the default timebase. for NI 63xx (X
Series) DAQ devices, the default timebase is 100 MHz. The TestScale timebase
uses a maximum value of 80 MHz. The following table shows the relation between
each timebase and the PWM semi-period duration in DAQ NI 63xx (X Series) and
TestScale devices.
Timebase Clock Minimum Semi-Period Maximum Semi-Period 100 MHz (default) 20 ns 42.949673 s 80 MHz (TestScale maximum) 25 ns 53.687091 s 20 MHz 100 ns 214.748365 s 100 kHz 20 µs 42949.673 s To determine the timebase clocks assigned to the counter, update the minimum and maximum semi-period values in the DAQ_Dig PWM Meas Initialize VI block diagram. A semi-period is the time between either a rising and falling edge, or a falling and rising edge in a PWM signal.For details about TestScale Counter Timebase behavior, visit Clock Routing in the TestScale Features manual.
- Pass the digital PWM measurement DAQmx Task to the DAQ_Dig PWM Meas Configure and Measure
VI.
-
- Execution Settings—By default, the Configure and Measure VI also executes the
measurement. If you are using a trigger for your
measurement, choose the Configure Only or Measure Only
execution option to avoid automatic execution.Tip To capture the entire signal, use Configure Only mode to set the channel to wait for the first rising edge of the input signal. After capturing the cycles, use Measure Only mode to read the measured data.
- Measurement Settings—Configure the number of PWM cycles to capture. Captured
cycles are averaged to derive Digital PWM Measurements. A
PWM cycle represents a complete PWM wave measured from the
rising edge to next consecutive rising edge. At least two
cycles are required for PWM measurements. Otherwise, the low
time for a single pulse will not have a clear end to enable
low time calculation.
Configure the timeout. The default timeout is 10 seconds. The VI returns an error if the specified time elapses before the requested cycles are captured. Customize the timeout value as necessary based on the captured PWM signal frequency and number of cycles to capture.
- Output Data—The VI returns the detected High Time(s), Low Time(s), Duty Cycle (%) and Frequency (Hz) on the specified input terminal. These measurements are the averaged results from the captured PWM cycles. The output measurements also return the actual number of cycles captured during the measurement.
-
- Wire the updated digital PWM measurement task from DAQmx Task Out and perform any additional operations.
- Close the digital PWM measurement task using DAQ_Dig PWM Meas Close VI.
Execution Option Settings
