National Instruments 321645c-01 Welding System User Manual


 
Chapter 2 Function Reference GPCTR_Set_Application
©
National Instruments Corporation 2-227 NI-DAQ FRM for PC Compatibles
{
GPCTR_Watch (deviceNumber, gpctrNumber, ND_ARMED, counter_armed)
until (counter_armed = ND_NO)
GPCTR_Watch (deviceNumber, gpctrNumber, ND_COUNT, counted_value)
To calculate the measured interval, multiply the counted value by the period corresponding to
the timebase you are using. For example, if your
ND_SOURCE is ND_INTERVAL_20_MHZ, the
interval will be (1/20 MHz) = 50 ns. If the
ND_COUNT is 3 (Figure 2-18), the actual interval is
3 * 50 ns = 150 ns.
When the counter reaches terminal count (2
24
– 1 for E Series and 445X devices, and 2
32
–1
for 6602 and 455X devices), it rolls over and keeps counting. To check if this occurred, use
GPCTR_Watch function with entityID set to ND_TC_REACHED.
Typically, you will find modifying the following parameters through the
GPCTR_Change_Parameter function useful when the counter application is
ND_BUFFERED_TWO_SIGNAL_EDGE_SEPARATION_MSR. You can change the following:
ND_SOURCE to ND_INTERNAL_100_KHZ. With this timebase, you can measure intervals
between 20 µs and 11.37 hours long. The resolution will be lower than if you are using
ND_INTERVAL_20_MHZ.
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. Measurement will be performed on the active
low pulses.
ND_SECOND_GATE to any legal value listed in the GPCTR_Change_Parameter function
description.
ND_SECOND_GATE_POLARITY to ND_NEGATIVE. Measurement is performed on the
active low pulses.
application =
ND_SINGLE_PULSE_GNR
In this application, the counter is used for the generation of single delayed pulse. By default,
you get by using through the 20 MHz internal timebase (
ND_INTERNAL_20_MHZ), so the
resolution of timing is 50 ns. By default, the counter counts down from
ND_COUNT_1 = 5
million to 0 for the delay time, and then down from
ND_COUNT_2 = 10 million to 0 for the
pulse generation time to generate a 0.5 s pulse after 0.25 s of delay.
With the default 20 MHz timebase, combined with the counter width of 24 bits (E Series and
445X only), you can generate pulses with a delay and length between 100 ns and 0.8 s long.
For the 6602 and 455X devices with counter width 32 bits, you can generate pulses with a
delay and length between 100 ns and 214 s long.