Chapter 4 General-Purpose Counter/TimerDAQ-STC Technical Reference Manual4-20 ©National Instruments CorporationGi_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 TCor gate);Gi_Loading_On_Gate = 0;Gi_Loading_On_TC = 0;Gi_Gating_Mode = 1;Gi_Gate_On_Both_Edges = 0;Gi_Trigger_Mode_For_Edge_Gate = 2;Gi_Stop_Mode = 0;Gi_Counting_Once = 0;Gi_Up_Down = 0 (down counting) or 1 (up counting);Gi_Bank_Switch_Enable = 0;Gi_Bank_Switch_Mode = 0;Gi_TC_Interrupt_Enable = 0;Gi_Gate_Interrupt_Enable = 0;}4.6.1.6 Buffered Event CountingBuffered event counting is an application in which a general-purpose counter counts the edgesof its source signal. Progress of counting is observed by monitoring the counter contents, atpoints of interest. This is achieved by using the HW save register and interrupts. We definetwo modes of operation for this application: noncumulative mode and cumulative mode. Innoncumulative mode, the counter is reloaded every time its contents are saved due to the gateaction. In cumulative mode, the counter's contents are saved by the gate, but the counter keepscounting.Noncumulative mode is useful if you are interested in the number of events between twocontrolling events. Cumulative mode is useful if you are interested in monitoring progress interms of events.One interesting application is periodic event-count monitoring. For example, you may beinterested in the number of events that happened every second. You can do this byprogramming Gi for buffered event counting and Gj for pulse generation, and then using theGj output as the Gi gate.Possible error conditions are rollover, gate acknowledge latency error, and stale data error(in noncumulative mode). Rollover is explained in section 4.4.1.1, Simple Event Counting.The gate acknowledge latency error occurs if the interrupt service program (ISR) does notmanage to read the value in the HW save register before the next hardware save. Innoncumulative mode, the stale data error occurs if there are two gate edges without anintervening source edge, indicating that the gave event was too quick to be measured. Incumulative mode, the stale data error is ignored because the gate actions do not affect thecounter contents, so that the HW save register always contains the correct value.