Page 207
C8051F060/1/2/3
Weak Pull-up Disable bit, (WEAKPUD, XBR2.7). The weak pull-up is automatically deactivated on any pin that is
driving a logic 0; that is, an output pin will not contend with its own pull-up device.
Advanced
Information
17.2.
Ports 4 through 7 (C8051F060/2 only)
All Port pins on Ports 4 through 7 can be accessed as General-Purpose I/O (GPIO) pins by reading and writing the
associated Port Data registers (See Figure 17.19, Figure 17.21, Figure 17.23, and Figure 17.25), a set of SFR’s which
are byte-addressable. Note that Port 4 has only three pins: P4.5, P4.6, and P4.7.
A Read of a Port Data register (or Port bit) will always return the logic state present at the pin itself, regardless of
whether the Crossbar has allocated the pin for peripheral use or not. An exception to this occurs during the execution
of a
read-modify-write
instruction (ANL, ORL, XRL, CPL, INC, DEC, DJNZ, JBC, CLR, SETB, and the bitwise
MOV write operation). During the
read
cycle of the
read-modify-write
instruction, it is the contents of the Port Data
register, not the state of the Port pins themselves, which is read.
17.2.1. Configuring Ports which are not Pinned Out
Although P3, P4, P5, P6, and P7 are not brought out to pins on the C8051F061/3 devices, the Port Data registers are
still present and can be used by software. Because the digital input paths also remain active, it is recommended that
these pins not be left in a ‘floating’ state in order to avoid unnecessary power dissipation arising from the inputs float-
ing to non-valid logic levels. This condition can be prevented by any of the following:
1.
2.
output mode register (PnMDOUT).
3.
Force the output states of P3, P4, P5, P6, and P7 to logic 0 by writing zeros to the Port Data registers: P3
= 0x00, P4 = 0x00, P5 = 0x00, P6= 0x00, and P7 = 0x00.
Leave the weak pull-up devices enabled by setting WEAKPUD (XBR2.7) to a logic 0.
Configure the output modes of P3, P4, P5, P6, and P7 to “Push-Pull” by writing 0xFF to the associated
17.2.2. Configuring the Output Modes of the Port Pins
The output mode of each port pin can be configured to be either Open-Drain or Push-Pull. In the Push-Pull configura-
tion, a logic 0 in the associated bit in the Port Data register will cause the Port pin to be driven to GND, and a logic 1
will cause the Port pin to be driven to VDD. In the Open-Drain configuration, a logic 0 in the associated bit in the
Port Data register will cause the Port pin to be driven to GND, and a logic 1 will cause the Port pin to assume a high-
impedance state. The Open-Drain configuration is useful to prevent contention between devices in systems where the
Port pin participates in a shared interconnection in which multiple outputs are connected to the same physical wire.
The output modes of the Port pins on Ports 4 through 7 are determined by the bits in their respective PnMDOUT Out-
put Mode Registers. Each bit in PnMDOUT controls the output mode of its corresponding port pin (see Figure 17.20,
Figure 17.22, Figure 17.24, and Figure 17.26). For example, to place Port pin 5.3 in push-pull mode (digital output),
set P5MDOUT.3 to logic 1. All port pins default to open-drain mode upon device reset.
17.2.3. Configuring Port Pins as Digital Inputs
A Port pin is configured as a digital input by setting its output mode to “Open-Drain” and writing a logic 1 to the
associated bit in the Port Data register. For example, P7.7 is configured as a digital input by setting P7MDOUT.7 to a
logic 0 and P7.7 to a logic 1.
17.2.4. Weak Pull-ups
By default, each Port pin has an internal weak pull-up device enabled which provides a resistive connection (about
100 k
) between the pin and VDD. The weak pull-up devices can be globally disabled by writing a logic 1 to the