Chapter 4
General-Purpose Counter/Timer
©
National Instruments Corporation
4-21
DAQ-STC Technical Reference Manual
Use this function to program a counter for buffered event counting. Program the Gi_Source
to select the signal on which you want to count events. Program the Gi_Gate to select the
signal that causes the counter contents to be saved.
Function
Gi_Buffered_Event_Counting
{
Gi_Load_Source_Select = 0;
Gi_Load_A = initial counter value;
∑
Gi_Load = 1;
∑
Gi_Source_Select = 0 (G_IN_TIMEBASE1) or 1 through 10 (PFI<0..9>) or
11 through 17 (RTSI_TRIGGER<0..6>) or 18 (IN_TIMEBASE2)
or 19 (other G_TC);
Gi_Source_Polarity = 0 (count rising edges) or 1 (count falling edges);
Gi_Gate_Select = 1 through 10 (PFI<0..9>) or 11 through 17
(RTSI_TRIGGER<0..6>) or 18 (AI START2) or 19 (UI2_TC) or
20 (other G_TC) or 21 (AI START1) or 31 (logic low);
Gi_OR_Gate = 0;
Gi_Output_Polarity = 0 (active low) or 1 (active high);
Gi_Gate_Select_Load_Source = 0;
Gi_Gate_Polarity = 0 (disable inversion) or 1 (enable inversion);
Gi_Output_Mode = 1 (one clock cycle output) or 2 (toggle on TC) or
3 (toggle on TC or gate);
Gi_Reload_Source_Switching = 1;
If (buffered cumulative event counting) then
{
Gi_Loading_On_Gate = 0;
}
Else
{
/*Buffered noncumulative event counting*/
Gi_Loading_On_Gate = 1;
}
Gi_Loading_On_TC = 0;
Gi_Gating_Mode = 2;
Gi_Gate_On_Both_Edges = 0;
Gi_Trigger_Mode_For_Edge_Gate = 3;
Gi_Stop_Mode = 0;
Gi_Counting_Once = 0;
Gi_Up_Down = 0 (down counting) or 1 (up counting) or 2 (controlled by
G_UP_DOWNi) or 3 (controlled by the internal gate value);
Gi_Bank_Switch_Enable = 0;
Gi_Bank_Switch_Mode = 0;
Gi_TC_Interrupt_Enable = 0;
Gi_Gate_Interrupt_Enable = 1;
}