
C8051F040/1/2/3/4/5/6/7
204 Rev. 1.5
The C8051F04x family of devices have a wide array of digital resources which are available through the
four lower I/O Ports: P0, P1, P2, and P3. Each of the pins on P0, P1, P2, and P3, can be defined as a Gen-
eral-Purpose I/O (GPIO) pin or can be controlled by a digital peripheral or function (like UART0 or /INT1 for
example), as shown in Figure 17.2. The system designer controls which digital functions are assigned
pins, limited only by the number of pins available. This resource assignment flexibility is achieved through
the use of a Priority Crossbar Decoder. The state of a Port I/O pin can always be read from its associated
Data register regardless of whether that pin has been assigned to a digital peripheral or behaves as GPIO.
The Port pins on Ports 1, 2, and 3 can be used as Analog Inputs to ADC2 (C8051F040/1/2/3 only), Analog
Voltage Comparators, and ADC0, respectively.
Figure 17.2. Port I/O Functional Block Diagram
An External Memory Interface, which is active during the execution of an off-chip MOVX instruction, can be
active on either the lower Ports or the upper Ports. See Section “16. External Data Memory Interface
and On-Chip XRAM” on page 187 for more information about the External Memory Interface.
17.1. Ports 0 through 3 and the Priority Crossbar Decoder
The Priority Crossbar Decoder, or “Crossbar”, allocates and assigns Port pins on Port 0 through Port 3 to
the digital peripherals (UARTs, SMBus, PCA, Timers, etc.) on the device using a priority order. The Port
pins are allocated in order starting with P0.0 and continue through P3.7, if necessary. The digital peripher-
als are assigned Port pins in a priority order which is listed in Figure 17.3, with UART0 having the highest
priority and CNVSTR2 having the lowest priority.
External
Pins
Digital
Crossbar
Priority
Decoder
SMBus
2
SPI
4
UART0
2
PCA
2
T0, T1,
T2, T2EX,
T3, T3EX,
T4,T4EX,
/INT0,
/INT1
P1.0
P1.7
P2.0
P2.7
P0.0
P0.7
Highest
Priority
Lowest
Priority
8
8
Comptr.
Outputs
(Internal Digital Signals)
Highest
Priority
Lowest
Priority
UART1
6
2
P3.0
P3.7
8
8
P0MDOUT, P1MDOUT,
P2MDOUT, P3MDOUT
Registers
XBR0, XBR1, XBR2,
XBR3 P1MDIN,
P2MDIN, P3MDIN
Registers
P1
I/O
Cells
P3
I/O
Cells
P0
I/O
Cells
P2
I/O
Cells
8
Port
Latches
P0
P1
P2
8
8
8
P3
8
(P2.0-P2.7)
(P1.0-P1.7)
(P0.0-P0.7)
(P3.0-P3.7)
To
ADC2
Input
To External
Memory
Interface
(EMIF)
To
ADC0
Input
To
Comparators
/SYSCLK
CNVSTR0
CNVSTR2