Hardware Interfacing; Momentary Push-Button Input; Single-Pole Switch Input; Rotary Encoder Input - Analog Devices AN-951 Application Note

Table of Contents

Advertisement

Application Note

HARDWARE INTERFACING

GPIO pins can be interfaced to several types of hardware
controls. This section details several examples of these controls
and their associated circuits. Unless otherwise mentioned,
IOVDD = 3.3 V.

MOMENTARY PUSH-BUTTON INPUT

One of the simplest forms of a control input to the SigmaDSP
is a push-button. In Figure 1, a momentary switch is used in an
active-low configuration with a 10 kΩ pull-up resistor. More
information about pin current limits can be found in the
relevant device data sheet.
GPIO
Figure 1. Active-Low Push-Button Input Circuit Example
SigmaDSP GPIO pins feature a debounce circuit, which should
be activated in SigmaStudio to avoid errors from contact chatter
on switching. For active-low operation, as in this example
circuit, the corresponding GPIO register should be set as an
inverting input. For active-high operation, the register can be
set as noninverting and the location of the circuit switch and
resistor should be switched. For devices without hardware
invert bits, a software logic inverter is available in SigmaStudio.

SINGLE-POLE SWITCH INPUT

Switches can be used in a similar fashion to momentary push-
buttons. In the example shown in Figure 2, the switch is shown
in the active-low configuration with a pull-up resistor. This
switch is not momentary, in contrast to the example shown in
Figure 1.
GPIO
Figure 2. Active-Low Switch Input Circuit Example

ROTARY ENCODER INPUT

A GPIO conditioning cell is available in SigmaStudio for incre-
mental rotary encoders, also called relative rotary encoders. An
incremental rotary encoder is essentially a knob that produces
output pulses depending upon which direction it is turned. This
should not be confused with an absolute rotary encoder, which
has a set of binary codes corresponding to all possible angular
positions. To use an incremental rotary encoder, connect the
output pins to two GPIO pins. The corresponding block in
IOVDD
10kΩ
IOVDD
10kΩ
SigmaStudio calculates the phase difference between pulses on
the two pins to recognize clockwise and counter-clockwise turns.
GPIO
10nF
Figure 3. Rotary Encoder Input Circuit Example

POTENTIOMETER INPUT

A potentiometer can be used as an analog control, most often to
adjust volume. Because the auxiliary ADC has linearly spaced
steps, a linear potentiometer should be used for best results. A
logarithmic lookup table can be implemented within software if
a logarithmic control is desired. For some SigmaDSPs, the full-scale
input voltage for the ADC is less than IOVDD. Because of this, a
voltage divider should be used to appropriately scale the signal, as
in the example circuit in Figure 4.
Figure 4. Potentiometer Input Circuit Example

LED OUTPUT

An LED is the simplest form of GPIO output. A transistor is
necessary to avoid excessive loading of the SigmaDSP. An
example transistor is the MMBT2222A. The SigmaDSP can
source or sink the current, as long as it does not exceed the
current limitations as specified in the device data sheet. See
the relevant data sheet for more details. For an active-high,
current-sourcing implementation, the transistor should be
NPN in a common-emitter (or N-channel in a common-
source) configuration. For an active-low, current-sinking
implementation, the transistor should be PNP in a common-
collector (or P-channel in a common-drain) configuration.
Figure 5. Current Sourcing LED Output Circuit Example
Rev. A | Page 3 of 20
IOVDD
10kΩ
10kΩ
GPIO
10kΩ
10kΩ
10nF
ROTARY
ENCODER
IOVDD
472Ω
10kΩ
GPIO
IOVDD
100Ω
2kΩ
GPIO
AN-951

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the AN-951 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents