
PB1
(code = 4)
PB2
(code = 11)
PB3
(code = 17)
Coderange
whenno
buttonsare
pressed
Threshold 1
(code = 7)
Threshold 2
(code = 14)
Threshold 3
(code = 23)
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Window 0
Window 1
Window 2
Window 3
ADCCODE
SBAS387A – MAY 2009 – REVISED JUNE 2010
www.ti.com
5.19.1.2 Basic Operational Description
The detect circuit, once programmed, can provide either on-demand sampling of the detect input or trigger
an AIC36 interrupt when used in continuous detection mode. This section provides details for the main
sub-sections of the detect circuit and provides programming examples to illustrate its operation.
First assume the EXT_MICBIAS circuit is enabled and programmed to the desired bias voltage. When no
buttons are pressed, the voltage at the DETECT pin is determined by the bias current of the microphone
and the bias resistor Rbias. If a button is pressed, the resistor associated with that button is put in parallel
with the microphone, causing the voltage at the DETECT pin to drop. If the EXT_MICBIAS circuit is
disabled, then the EXT_MICBIAS pin is temporarily connected to AVDD_BIAS for the duration of the ADC
reading.
The 5-bit detect ADC has its input connected to the DETECT pin and its reference connected to the
EXT_MICBIAS pin. Thus the output of the ADC is the DETECT pin voltage relative to the EXT_MICBIAS
voltage. The state of the microphone and pushbuttons can be deduced from the ADC output. If the ADC
output is zero, DETECT is shorted to ground; if it is full-scale then the microphone is unplugged. If the
output is in between, then the microphone is plugged in and/or a button may be pressed, depending on
the particular ADC output value.
The detect ADC can provide a raw value corresponding to the voltage at the detect pin but it’s unsuitable
as an interrupt source. To condition this raw detect value, an 8 window comparator is used to divide the
32-level ADC output into as many as eight mapped windows. Using seven programmable threshold
registers, the edges of up to 8 windows are defined within the code values of 0–31 of the ADC. These
threshold registers encode ranges of raw ADC values into a button press value which is then de-bounced
for generating an interrupt.
As a windowing example, assume that three unique pushbuttons must be detected in an application.
Based on resistor values selected for the voltage dividers, assume they correspond to raw ADC codes of
ideally 4, 11, and 17. Thresholds 1, 2, and 3 can be set to 7, 14, and 23 as shown in
Figure 5-51towindow the three values. A fourth code range is defined to describe the ADC values returned when no
button is pressed. To properly map ADC codes into windows, threshold 1 must correspond to the edge of
the lowest window, threshold 2 is the next highest window, and so on. Detect threshold registers 4 through
7 should not be enabled in this case.
Figure 5-51. Example Threshold Settings
72
APPLICATION INFORMATION
Copyright 2009–2010, Texas Instruments Incorporated