User manual
Chapter 3 Software Overview
NI-DAQ User Manual for PC Compatibles 3-94 ni.com
General-Purpose Counter/Timer Application Tips
The General-Purpose Counter/Timer (
GPCTR
) functions perform a variety
of event counting, time measurement, and pulse and pulse-train generation
operations, including buffered operations. When using the
GPCTR
functions, follow the generic program flow as shown in Figure 3-36.
Figure 3-36. Generic Program Flow for All GPCTR Counter Applications
To select the type of application you want to use, (for example simple event
counting, buffered event counting, period measurement, and so on) call the
GPCTR_Set_Application
function with the appropriate application
parameter. If the application is buffered, configure a buffer for use during
the acquisition using the
GPCTR_Config_Buffer
function. Next, change
some of the counter attributes, depending on your type of application, by
calling
GPCTR_Change_Parameter
. For example, set the counter source
to the internal 100 kHz timebase; set the initial value of the counter to 0;
or set the output mode of the counter to pulse mode. Arm the counter with
the settings you made, by calling
GPCTR_Control
.
If you configure the counter to use a start trigger, the counter will not start
counting until it receives the start trigger signal. Otherwise, the counter
immediately begins counting. Check the status of the counters by using the
GPCTR_Watch
function. If you are doing a continuous buffered operation,
read the buffer by calling
GPCTR_Read_Buffer
. When the operation has
completed or you want to abort the operation, reset the counter by calling
GPCTR_Control
with appropriate control code.
Done?
No
Read Attributes or Buffer
Configure Buffer (if needed)
Select Counter Application
Program Counter (Arm)
Change Counter Attributes
Reset Counter
Ye s










