National Instruments 321645c-01 Welding System User Manual


 
Chapter 2 Function Reference GPCTR_Set_Application
©
National Instruments Corporation 2-221 NI-DAQ FRM for PC Compatibles
measure a time interval between 100 ns and 0.8 s long.For the 6602 and 455X devices with
counter width 32 bits, you can measure a time interval between 100 ns and 214 s long.
Figure 2-16 shows one possible scenario of a counter used for
ND_SINGLE_PULSE_WIDTH_MSR after the following programming sequence:
GPCTR_Control(deviceNumber, gpctrNum, ND_RESET)
GPCTR_Set_Application(deviceNumber, gpctrNum,
ND_SINGLE_PULSE_WIDTH_MSR)
GPCTR_Control(deviceNumber, gpctrNum, ND_PROGRAM)
In Figure 2-16, 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.
Figure 2-16.
Single Pulse Width Measurement
Use the GPCTR_Watch function with entityID = ND_ARMED to monitor the progress of the
counting process. This measurement completes when entityValue becomes
ND_NO. When
the counter is no longer armed, you can retrieve the counted value by using
GPCTR_Watch
with entityID =
ND_COUNT, as shown in the following example code:
Create u32 variable count_available.
Create u32 variable counted_value.
repeat
{
01
NO
NO
2
Gate
Source
Count
Count Available
Measured
Interval
YES
YES
2
2
2
2
2