S3F84B8_UM_REV 1.00
13 A/D CONVERTER
13-2
13.1.1 USING A/D PINS FOR STANDARD DIGITAL INPUT
The ADC module’s input pins are alternatively used as digital input in port2.
13.1.1.1 A/D Converter Control Register (ADCON)
The A/D converter control register, ADCON, is located at FAH address.
ADCON has five functions:
Bits 7-5 select an analog input pin (ADC0–ADC7).
Bit 4 enables/disables the ADC interrupt.
Bit 3 indicates the status of A/D conversion.
Bits 2-1 select a conversion speed.
Bit 0 starts the A/D conversion.
Only one analog input channel can be selected at a time. You can dynamically select any one of the eight analog
input pins (ADC0–ADC7) by manipulating ADCON.7–ADCON.5.
.7
.6
.5
.4
.3
.2
.1
.0
LSB
MSB
A/D Converter Control Register (ADCON)
FAH, R/W
ADC0 (P2.0)
ADC1 (P2.1)
ADC2 (P2.2)
ADC3 (P2.3)
ADC4 (P2.4)
ADC5 (P2.5)
ADC6 (P2.6)
ADC7 (P2.7)
A/D Conversion input pin selection bits
000
001
010
011
100
101
110
111
Conversion speed selection bits:
(NOTE)
00 = f
OSC
/8 (f
OSC
< 10 MHz)
01 = f
OSC
/4 (f
OSC
< 10 MHz)
10 = f
OSC
/2 (f
OSC
< 10 MHz)
11 = f
OSC
/1 (f
OSC
< 4 MHz)
ADC complete interrupt bit (EOC):
0 = No interrupt pending, Conversion in progress
(
clear when write
)
1 = Interrupt pending, AD conversion has completed
Conversion start bit:
0 = No effect
1 = A/D conversion start
NOTE:
Maximum ADC clock input = 4 MHz
ADC Interrupt enable bit:
0 = disable
1 = enable
Figure 13-1 A/D Converter Control Register (ADCON)