National Instruments 321645c-01 Welding System User Manual


 
Chapter 2 Function Reference GPCTR_Set_Application
©
National Instruments Corporation 2-237 NI-DAQ FRM for PC Compatibles
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. You
can do this as follows:
Create u32 variable counter_armed.
repeat
{
GPCTR_Watch(deviceNumber, gpctrNumber, ND_ARMED, counter_armed)
}
until (counter_armed = ND_NO)
When the counter is disarmed, you can safely access data in the buffer.
Typically, you will find modifying the following parameters through the
GPCTR_Change_Parameter function useful when the counter application is
ND_BUFFERED_EVENT_CNT. You can change the following:
ND_SOURCE to any legal value listed in the GPCTR_Change_Parameter function
description.
ND_SOURCE_POLARITY to ND_HIGH_TO_LOW.
ND_GATE to any legal value listed in the GPCTR_Change_Parameter function
description.
ND_GATE_POLARITY to ND_NEGATIVE. Counts will be captured on every high-to-low
transition of the signal present at the gate.
Note The counter will start counting as soon as you arm it. However, it will not count
if the gate signal stays in low state when
ND_GATE_POLARITY is ND_POSITIVE
or if it stays in high state when
ND_GATE_POLARITY is ND_NEGATIVE while
GPCTR_Control is executed with action = ND_ARM or action = ND_PROGRAM.
Be aware of this when you interpret the first count in your buffer.
application =
ND_BUFFERED_PERIOD_MSR
In this application, the counter is used for continuous measurement of the time interval
between successive transitions of the same polarity of the gate signal. By default, those are
the low-to-high transitions of the signal listed in Table 2-25. The counter counts the 20 MHz
internal timebase (
ND_INTERNAL_20_MHZ), so the resolution of measurement is 50 ns. The
counter counts up starting from 0; its contents are placed in the buffer after an edge of
appropriate polarity is detected on the gate; the counter then starts counting up from 0 again.
NI-DAQ transfers data from the counter into the buffer until the buffer is filled; the counter is
disarmed at that time.
The default 20 MHz timebase, combined with the counter width for E Series and 445X
devices (24 bits), lets you measure the width of a pulse between 100 ns and 0.8 s long. For