Wiki

The most recent version of this page is a draft.DiffThis version (07 May 2021 16:18) was approved by Prasad Kamath.The Previously approved version (21 Mar 2021 08:30) is available.Diff

This is an old revision of the document!


Click here to return to the GPIO Conditioning page

Toggle Counter



Description


The Toggle Counter cell counts the number of edges seen on its input pin and outputs the count as a 32.0 integer value. The toggle detection can be set to detect rising or falling edges on the input.

Usage


The toggle counter increments an internal counter each time an edge is detected on the input. Two algorithms exist: one for detecting and counting rising edges, and one for detecting and counting falling edges.

The rising edge counter starts at zero when the program begins. Each time the input detects a rising edge - in any number format - the counter will increment. After the counter exceeds the maximum count value (which can be configured in the GUI), it will reset to zero and resume counting again.

The falling edge counter starts at zero when the program begins. Each time the input detects a falling edge - in any number format - the counter will increment. After the counter exceeds the maximum count value (which can be configured in the GUI), it will reset to zero and resume counting again.

Targets Supported

NameADSP-214xxADSP-215xx/ADSP-SC5xxADAU145x/1456x
—————————————-——————————————————————————————--——————————————-
Toggle Counter Not supported Not supported Sample


Pins

Input

NameTypeDescription
———————————-————————————————————
Input0ControlControl Signal input that is detected by the toggle counter
Input1LogicConnected to a software interface register - reads the last count value at startup

Output

NameTypeDescription
———————————-—————————————————————————--
Output0ControlToggle count. Increments by one each time a new edge is detected on the input.
Output1LogicOther - interface register. Connected to a software interface register - writes the last count value


Configurable Parameters

GUI Parameter NameDefault ValueRangeFunction Description
—————————————- ———————- ————————————- —————————————-
Gain 33 to 100 Sets the toggle count at which the counter resets to zero
IsLin true true/false Setting this value to true indicates the gain is a decimal value, else the value is entered in dB


DSP Parameters

Parameter NameDescriptionADAU145x/ADAU146x
——————————————————————-- ———————————
maxThe maximum value that the counter can reach. When the counter exceeds this value, it will be reset to zeroFixed Point 8.24


DSP Parameter Computation


if IsLin ==true max= Gain else max = 10^ (Gain/20)

/srv/wiki.analog.com/data/pages/resources/tools-software/sigmastudiov2/modules/gpioconditioning/togglecounter.txt · Last modified: 12 May 2021 14:19 by Prasad Kamath