Chapter 4
General-Purpose Counter/Timer
©
National Instruments Corporation
4-3
DAQ-STC Technical Reference Manual
Each GPCT counter has a source input (G_SOURCE), a gate input (G_GATE), and an
up/down control input (G_UP_DOWN). When the counter is enabled to count, rising edges
on the G_SOURCE input cause the counter to increment or decrement. The G_GATE input
acts as a general-purpose control signal and can operate as a counter trigger signal, a counter
enable, a save signal, a reload signal, an interrupt, an output control signal, a load register
select signal, and a counter disarm. The G_UP_DOWN input determines whether the counter
counts up or down.
The counter outputs are the signals labeled G_OUT and INTERRUPT. G_OUT is a counter
TC-related signal, which can toggle on every counter TC or can output the counter TC signal
directly. INTERRUPT is an interrupt signal routed inside the DAQ-STC to the interrupt
control module. Refer to Chapter 8,
, for more information. The counter has
load registers to reload the counter with new count values. The save registers save the counter
contents until they can be read by software.
4.4 Counter/Timer Functions
The purpose of the GPCT is to provide counter/timer functions that are improved over those
available on the Am9513-based DAQ boards through NI-DAQ, the National Instruments
software for data acquisition. Examples of existing counter/timer functions supported by the
DAQ-STC are event counting, period measurement, pulsewidth measurement, pulse
generation, and pulse-train generation. Enhancements to the existing counter/timer functions
include ETS timing output, relative time stamping, and the ability to perform buffered mode
operations.
4.4.1 Event Counting
In the event-counting functions, the counter counts events on the G_SOURCE input following
the software arm. The software arm occurs when software sets the counter arm bit in the
DAQ-STC register map. The following actions are available in event counting:
•
G_SOURCE increments or decrements the counter.
•
G_GATE indicates when to start and stop counting intervals or when to save the counter
contents in the save register.
•
The software either reads the counter value asynchronously or reads the save register
each time the hardware latches the counter value. In the latter case, interrupts notify the
software that a save has occurred.
•
G_UP_DOWN controls the direction of the counting.