Documentation

National Instruments PCI-6225 PWM Measure

PWM Measure block for PCI-6225 and PXI-6225 boards

Library

Simulink® Real-Time™ Library for National Instruments®

Description

Use this block to measure the pulse width or the period of a signal.

To measure the pulse width of a signal, connect the signal to the gate, as follows:

CounterGate Pin
0PFI 9 (Pin 3)
1PFI 4 (Pin 41)

The input waveform must have fast rise and fall times and conform to TTL signal levels of [0,5] volts. Use external signal conditioning to achieve these levels. If you input a sine wave, the decision points are less definite and the measurement is noisy. In extreme cases, the gate can transition multiple times during a slow signal transition.

This block does not queue or buffer measurements. If the gate changes state, the driver holds the current count, overwriting the previous value.

This block returns the length of the last gate period before the block executes.

To compute the duty cycle percentage, use two counters. Because the period of a cycle is H counter + L counter, you can measure two of these counters and compute the third.

You cannot measure a 0 width pulse.

Block Parameters

Counter

From the list, select a counter, 0 or 1.

Trigger mode

From the list, select the gating mode to use:

ModeDescription
Width of Gate HighReturns the number of 80 MHz cycles that occur when a single cycle of the input is high.
Width of Gate LowReturns the number of 80 MHz cycles that occur when a single cycle of the input is low.
Between Rising EdgesReturns the number of 80 MHz cycles that occur between rising edges of the input signal. This cycle is the full period of the input signal.
Between Falling EdgesReturns the number of 80 MHz cycles that occur between falling edges of the input signal. This cycle is the full period of the input signal.

If the input signal has both fast rise and fall edges, Between Rising Edges and Between Falling Edges return the same value. If the input is asymmetric, one of these options can give a better result than the other.

Filter

You can apply a digital debouncing filter to the input pins before processing.

From the list, select a filter value to ignore pulses that are shorter than the filter time. The block ignores pulses shorter than the chosen duration. The value of None indicates that the input is not filtered

  • None

  • Minimum pulse width 125 nanoseconds

  • Minimum pulse width 6.25 microseconds

  • Minimum pulse width 1.25 milliseconds

Sample time

Enter the base sample time or a multiple of the base sample time (-1 means sample time is inherited).

PCI slot (-1:autosearch)

If only one board of this type is in the target computer, enter -1 to locate the board.

If two or more boards of this type are in the target computer, enter the bus number and the PCI slot number of the board associated with this driver block. Use the format [BusNumber,SlotNumber].

To determine the bus number and the PCI slot number, type:

tg = slrt;
getPCIInfo(tg, 'installed')

External Websites

Was this topic helpful?