National Instruments 321645c-01 Welding System User Manual


 
Chapter 2 Function Reference GPCTR_Set_Application
©
National Instruments Corporation 2-223 NI-DAQ FRM for PC Compatibles
action = ND_PROGRAM returns gateSignalError. If this happens, you should not
rely on values returned by
GPCTR_Watch.
application =
ND_TRIG_PULSE_WIDTH_MSR
In this application, the counter is used for a single measurement of the time interval between
two transitions of the opposite polarity of the gate signal. By default, the measurement is
performed between a low-to-high and a high-to-low transition on the I/O connector default
gate pins (see Table 2-25 for default gate pin selection). The counter counts the 20 MHz
internal timebase (
INTERNAL_20_MHZ)
, so the resolution of measurement is 50 ns. The
counter counts up starting from 0.
Unlike
ND_SINGLE_PULSE_WIDTH_MSR, your gate signal can change state during counter
arming. However, the counter will start counting only after a high-to-low edge on the gate if
the gate polarity is positive, or after a low-to-high edge on the gate if the gate polarity is
negative. This transition is the trigger from this application’s name.
The default 20 MHz timebase, combined with the counter width (24 bits), lets you measure
the duration of a pulse between 100 ns and 0.8 s long. For the 6602 and 455X devices with
counter width 32 bits, you can measure pulse duration between 100 ns and 214 s long.
Figure 2-17 shows one possible scenario of a counter used for
ND_TRIG_PULSE_WIDTH_MSR
after the following programming sequence:
GPCTR_Control(deviceNumber, gpctrNum, ND_RESET)
GPCTR_Set_Application(deviceNumber, gpctrNum, ND_TRIG_PULSE_WIDTH_MSR)
GPCTR_Control(deviceNumber, gpctrNum, ND_PROGRAM)
In Figure 2-17, the following behavior is present:
Gate is the signal present at the counter gate input.
Source is the signal present at the counter source input.
Count is the value you would read from the counter if you called the
GPCTR_Watch
function with entityID =
ND_COUNT. The different numbers illustrate behavior at
different times.
Count Available is the value you would read from the counter if you called the
GPCTR_Watch function with entityID = ND_COUNT_AVAILABLE. The different values
illustrate behavior at different times.