Chapter 2 Function Reference — GPCTR_Set_Application
©
National Instruments Corporation 2-219 NI-DAQ FRM for PC Compatibles
Figure 2-15 shows one possible scenario of a counter used for ND_SINGLE_PERIOD_MSR
after the following programming sequence:
GPCTR_Control(deviceNumber, gpctrNum, ND_RESET)
GPCTR_Set_Application(deviceNumber, gpctrNum,
ND_SINGLE_PERIOD_MSR)GPCTR_Set_Application
GPCTR_Control(deviceNumber, gpctrNum, ND_PROGRAM)
In Figure 2-15, 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.
• Armed is the value you would read from the counter if you called the
GPCTR_Watch
function with entityID =
ND_ARMED. The different values illustrate behavior at different
times.
Figure 2-15.
Single Period 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. You can do this as follows:
Create u32 variable counter_armed.
Create u32 variable counted_value.
repeat
{
GPCTR_Watch(deviceNumber, gpctrNumber, ND_ARMED, counter_armed)
}
01
YES
YES
23
4
4
44
Gate
Source
Count
Armed
Measured
Interval
NO
NO
NO