National Instruments 321645c-01 Welding System User Manual


 
Chapter 2 Function Reference GPCTR_Set_Application
©
National Instruments Corporation 2-217 NI-DAQ FRM for PC Compatibles
Using This Function
NI-DAQ requires you to select a set of parameters so that it can program the counter hardware.
Those parameters include, for example, signals to be used as counter source and gate and the
polarities of those signals. A full list of the parameters is given in the description of the
GPCTR_Change_Parameter function. By using the GPCTR_Set_Application function,
you assign specific values to all of those parameters. If you do not like some of the settings
used by this function, you can alter them by using the
GPCTR_Change_Parameter function.
When using DMA for buffered
GPCTR
operations on E Series and 445X devices, you should
use the internal 20 MHz timebase over the internal 100 kHz timebase. The 100 kHz timebase
does not work correctly when you are using DMA. For measuring gate signals slower than
the internal 20 MHz timebase will allow, or when you need to use DMA, we recommend
using external timebases. You can use DMA operations on typical 486-based machines
without any errors for gate signals of up to 50 kHz using the internal 20 MHz timebase.
Trying to achieve rates higher than 50 kHz might cause gpctrDataLossError. This error
might cause some computers to lock up because of a memory parity error.
The behavior of the counter you are preparing for an application with this function
will depend on application, your future calls of the
GPCTR functions, and the signals supplied
to the counter. The following paragraphs illustrate typical scenarios.
application =
ND_SIMPLE_EVENT_CNT
In this application, the counter is used for simple counting of events. By default, the events
are low-to-high transitions on the default source pins (see Table 2-22 for default source
selections). The counter counts up starting from 0, and it is not gated.
Figure 2-14 shows one possible scenario of a counter used for
ND_SIMPLE_EVENT_CNT after
the following programming sequence:
GPCTR_Control(deviceNumber, gpctrNum, ND_RESET)
GPCTR_Set_Application(deviceNumber, gpctrNum, ND_SIMPLE_EVENT_CNT)
GPCTR_Control(deviceNumber, gpctrNum, ND_PROGRAM)
In Figure 2-14, the following behavior is present:
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.
Figure 2-14.
Simple Event Counting
0
1
2
Source
Count
5 66