I/O PORTS S3C8245/P8245/C8249/P8249
9-8
PORT 2
Port 2 is an 8-bit I/O port that can be used for general-purpose I/O as A/D converter inputs, ADC0–ADC7. The pins
are accessed directly by writing or reading the port 2 data register, P2 at location F8H in set 1, bank 0.
To individually configure the port 2 pins P2.0–P2.7, you make bit-pair settings in two control registers located in set
1, bank 0: P2CONL (low byte, E7H) and P2CONH (high byte, E6H). In input mode, ADC or external reference voltage
input are also available.
Port 2 Control Registers
Two 8-bit control registers are used to configure port 2 pins: P2CONL (E7H, set 1, Bank 0) for pins P2.0–P2.3 and
P2CONH (E6H, set 1, Bank 0) for pins P2.4–P2.7. Each byte contains four bit-pairs and each bit-pair configures one
port 2 pin. The P2CONH and the P2CONL registers also control the alternative functions.
Port 2 Control Register, High Byte (P2CONH)
E6H, Set 1, Bank 0, R/W
.7 .6 .5 .4 .3 .2 .1 .0MSB LSB
P2.7
(VLDREF/ADC7)
P2.6 (ADC6) P2.5 (ADC5)
P2.4 (ADC4)
P2CONH bit-pair pin configuration:
00
01
10
11
NOTE:
If a pin is enabled for ADC mode by ADCEN or ADC & VLD
ENABLE signal, normal I/O and pull-up resistance are disabled.
When pins are enabled for ADC mode, the pins can be selected for
ADC input by ADCON.6. 5. 4.
And the P2.7 can be used for VLD external input.
Input mode
Output mode, pull-up
Alternative function (ADC & VLD External input ENABLE,
ADCEN signal Gen.)
Output mode, push-pull
Figure 9-8. Port 2 High-Byte Control Register (P2CONH)