The tcDspCounter class is used to count the occurances of some external event. Up to 16 counters are provided, each capable of counting from zero to (2^30 - 1). The actual depth of each counter may be configured to any value fro 1 to 2^30, and an interrupt may be enabled which is triggered whenever a counter rolls over.
The application may register a routine to be run in ISR context to provide specific functionality for each counter rollover.
In addition, utility routines are provided which allow any pair of counters to be used as quadrature (i.e. rotational) counters. It is assumed that one counter is configured to measure clockwise rotation, and the other CCW rotation.
There is no limit to the number of instances of tcDspCounter that may be created.
An instance of the tcDspCounter class is created by specifying the firmware base address of the core and the interrupt level used. This core supports specifying a level of gnAutoLevel, which automatically installs a vectored interrupt.
This is a simple example of tcDspCounter creation and usage: