Rev. 1.1
151
C8051F410/1/2/3
18.2. Port I/O Initialization
Port I/O initialization consists of the following steps:
Step 1. Select the input mode (analog or digital) for all Port pins, using the Port Input Mode
register (PnMDIN).
If the pin is in analog mode, a '1' must also be written to the
corresponding Port Latch.
Step 2. Select the output mode (open-drain or push-pull) for all Port pins, using the Port Output
Mode register (PnMDOUT).
Step 3. Select any pins to be skipped by the I/O Crossbar using the Port Skip registers (PnSKIP).
Step 4. Assign Port pins to desired peripherals using the XBRn registers.
Step 5. Enable the Crossbar (XBARE = ‘1’).
All Port pins must be configured as either analog or digital inputs. Any pins to be used as Comparator or
ADC inputs should be configured as an analog inputs. When a pin is configured as an analog input, its
weak pullup, digital driver, and digital receiver are disabled. This process saves power and reduces noise
on the analog input. Pins configured as digital inputs may still be used by analog peripherals; however, this
practice is not recommended.
Additionally, all analog input pins should be configured to be skipped by the Crossbar (accomplished by
setting the associated bits in PnSKIP). Port input mode is set in the PnMDIN register, where a ‘1’ indicates
a digital input, and a ‘0’ indicates an analog input. All port pins in analog mode must have a '1' set in the
corresponding Port Latch register. All pins default to digital inputs on reset. See
SFR Definition 18.4 for the
PnMDIN register details.
Important Note: Port 0 pins are 5 V tolerant across the operating range of VIO. Figure 18.5 shows the input current range of P0 pins when overdriven above VIO (when VIO is 3.3 V nominal). There are two over-
drive modes for Port 0: Normal and High-Impedance. When the corresponding bit in P0ODEN is logic 0,
Normal Overdrive Mode is selected and the port pin requires 150 A peak overdrive current when its volt-
age reaches approximately VIO + 0.7 V. When the corresponding bit in P0ODEN is logic 1, High-Imped-
ance Overdrive Mode is selected and the port pin does not require any additional overdrive current. Pins
configured to High-Impedance Overdrive Mode consume slightly more power from VIO than pins config-
ured to Normal Overdrive Mode. Note that Port 1 and Port 2 pins cannot be overdriven above VIO and
have the same behavior as P0 in Normal Mode.