
Rev. 1.0
83
C8051F70x/71x
15.4. Automatic Scanning
CS0 can be configured to automatically scan a sequence of contiguous CS0 input channels by configuring
and enabling auto-scan. Using auto-scan with the CS0 comparator interrupt enabled allows a system to
detect a change in measured capacitance without requiring any additional dedicated MCU resources.
Auto-scan is enabled by setting the CS0 start-of-conversion bits (CS0CF6:4) to 111b. After enabling auto-
scan, the starting and ending channels should be set to appropriate values in CS0SS and CS0SE, respec-
tively. Writing to CS0SS when auto-scan is enabled will cause the value written to CS0SS to be copied into
CS0MX. After being enabled, writing a 1 to CS0BUSY will start auto-scan conversions. When auto-scan
completes the number of conversions defined in the CS0 accumulator bits (CS0CF2:0), auto-scan config-
ures CS0MX to the next sequential port pin configured as an analog input and begins a conversion on that
channel. The scan sequence continues until CS0MX reaches the ending input channel value defined in
CS0SE.
Note:
All other CS0 pins configured for analog input with a 0 in the port latch are grounded during the conversion.
After the final channel conversion, auto-scan configures CS0MX back to the starting input channel. For an
Note:
Auto-scan attempts one conversion on a CS0MX channel regardless of whether that channel’s port pin has
been configured as an analog input. Auto-scan will also complete the current rotation when the device is halted
for debugging.
If auto-scan is enabled when the device enters suspend mode, auto-scan will remain enabled and running.
This feature allows the device to wake from suspend through CS0 greater-than comparator event on any
configured capacitive sense input included in the auto-scan sequence of inputs.
Figure 15.2. Auto-Scan Example
SFR Configuration:
A
D
A
D
A
P2.0
PxM
D
IN
b
it
Po
rt
Pin
0
CS
0M
X
C
han
nel
P2.1
1
P2.2
2
P2.3
3
P2.4
4
P2.5
5
P2.6
6
P2.7
7
P3.0
8
P3.1
9
P3.2
10
P3.3
11
P3.4
12
P3.5
13
P3.6
14
P3.7
15
CS0SS = 0x02
CS0SE = 0x0D
P2MDIN = 0xF2
P3MDIN = 0x04
CS0CF = 0x70
CS0CN = 0x80
Enables CS0
Enables Auto-scan
as start-of-
conversion source
Sets P2.2 as Auto-
scan starting channel
Sets P3.5 as Auto-
scan ending channel
Configures P2.3,
P2.2, P2.0 as analog
inputs
Configures P3.0-P3.1
and P3.3-P3.7 as
analog inputs
Scans on channels
not configured as
analog inputs result
in indeterminate
values that cannot
trigger a CS0
Greater Than
Interrupt event