Documentation Home Page RT-LAB Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

OpNI6602 PWM In




This block reads the pulse width of a signal connected to the GATE pin of one counter/timer of National Instruments NI6602 card.

Depending on the options selected in the mask, the pulse width measured is returned in seconds, or as a duty ratio.


Bus TypeThis popup menu enables the user to select the bus type of the target computer where the NI6602 card is installed. The options are PCI or PXI.
PCI indexEnter the PCI index (see definition)of the card on the PCI (or PXI) bus.
CounterSpecify the counter to which gate pin the input signal is connected.
Clock SourceThree clock sources are available: 100 KHz, 20 MHz and 80MHz. This selection has a direct impact on the timing precision of the measurement.
PolaritySelect which polarity of the signal will be measured - high or low.
Output unitUnit of the measurement returned at the PWM outport. The choices are second, i.e. raw measurement of the pulse width of the signal, or a ratio (%), i.e. duty ratio of the pulse relative the frequency of the signal. In the latter case, the frequency of the signal must be determined by one of the two methods provided with the Frequency parameter (see below).
FrequencyThis parameter appears only when the Output unit parameter is set to the ratio (%). Two methods can be used to determine the frequency of the signal. When the Use input value option is selected, the frequency value must be provided at the Freq inport (see Inputs section below). When the Measure signal frequency option is selected, the counter is set in Frequency Input measurement mode (similar to the Op NI6602 Freq In block) while the Cmd inport is set to 0. This frequency value is then used for calculating the duty ratio returned at the PWM outport.
Digital FilterThis parameter allows each GATE input pin to be passed through or digitally filtered to remove noise. The digital filter sample the signal using Timebase 3, and upon detecting a state change, require it to be in the same state for a minimum pulse width of 5µs, 1µs,500ns or 100ns.
Synchronizesee definition.


When the Output unit parameter is set to second, this block has no inputs. When this parameter is set to ratio (%), the block has one input. This input is named Freq or Cmd depending on the choice of the Frequency parameter.

FreqWhen the Frequency parameter is set to Use input value, the frequency of the signal to be measured must be provided at this input. For example, this value can come from the output of an Op NI6602 Freq In block.
CmdWhen the Frequency parameter is set to Measure signal frequency, the counter is initialized in frequency measurement mode and remain in this mode while the input value is 0. The first time the input value goes from 0 to 1, the counter is reinitialized in pulse width measurement mode and the last measured frequency is used to determine the duty ratio of the signal.


PWMReturns the measured pulse width, in seconds or as a duty ratio. This outport returns a0 value when the counter is set in frequency measurement mode (see the description of the Cmd input above).
StatusThis output returns 1 if a new PWM measurement was completed during the previous step, it returns 0 if no new measurement was latched (the PWM output was measured during some previous timestep), and it returns 2 if we can not be sure whether the current PWM value is new or not. This can occur when the pulses to be measured are short compared to the time step, and when the period of the signal is shorter than the time step.
Since lastReturns the time elapsed, in seconds, since the last edge that started a PWM measurement.
FreqThis output appears only if the Output unit parameter is set to ratio (%) and the Frequency parameter is set to Measure signal frequency. It returns the last measured frequency of the signal, in Hz.

Characteristics and Limitations

Connections Requirements

Connect the input signal to be measured to the GATE pin of the selected counter.

Connector Pin Assignments

Pin Description Pin Description 
1+5V 35RG 
3GATE(0) 37Reserved
4Reserved 38Reserved
5OUT(0) 39GND
8GATE(1) 42GND
9OUT(1) 43RG
10PFI_0 44PFI_1
11GND 45PFI_2
12PFI_3 46GND
13PFI_4 47PFI_5
14GND 48PFI_6
15PFI_7 49GND
16OUT(7) 50GND
17UP_DOWN(7)/AUX_LINE(7) 51GATE(7)
19RG 53OUT(6)
Direct FeedthroughNo
Discrete sample timeNo
XHP supportYes
Work offlineNo

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | | +1 514-935-2323