C509-L
Semiconductor Group
38
Digital I/O Ports
The C509-L allows for digital I/O on 64 lines grouped into 8 bidirectional 8-bit ports. Each port bit
consists of a latch, an output driver and an input buffer. Read and write accesses to the I/O ports P0
through P6 and P9 are performed via their corresponding special function registers P0 to P6 and
P9. The port structure of the C509-L is designed to operate either as a quasi-bidirectional port
structure, compatible to the standard 8051-Family, or as a genuine bidirectional port structure. This
port operating mode can be selected by software (setting or clearing the bit PMOD in the SFR
SYSCON).
The output drivers of port 0 and 2 and the input buffers of port 0 are also used for accessing external
memory. In this application, port 0 outputs the low byte of the external memory address, time-
multiplexed with the byte being written or read. Port 2 outputs the high byte of the external memory
address when the address is 16 bits wide. Otherwise, the port 2 pins continue emitting the P2 SFR
contents.
Analog Input Ports
Ports 7 and 8 are available as input ports only and provide for two functions. When used as digital
inputs, the corresponding SFR’s P7 and P8 contain the digital value applied to port 7 and port 8
lines. When used for analog inputs the desired analog channel is selected by a three-bit field in SFR
ADCON0 or a four-bit field in SFR ADCON1. Of course, it makes no sense to output a value to these
input-only ports by writing to the SFR’s P7 or P8; this will have no effect.
lf a digital value is to be read, the voltage levels are to be held within the input voltage specifications
(
V
IL
/
V
IH
). Since P7 and P8 are not bit-addressable registers, all input lines of P7 or P8 are read at the
same time by byte instructions.
Nevertheless, it is possible to use ports 7 and 8 simultaneously for analog and digital input.
However, care must be taken that all bits of P7 or P8 that have an undetermined value caused by
their analog function are masked.