Chapter 4
I/O Ports
IV - 6
Port 0
nGeneral Port Setup
Each bit can be set individually as either an input or output by the port 0 control I/O direction register
(P0DIR). The control flag of the port 0 direction control register (P0DIR) is set to "1" for output mode, and
"0" for input mode.
To read input data of pin, set the control flag of the port 0 direction control register (P0DIR) to "0" and
read the value of the port 0 input register (P0IN).
To output data to pin, set the control flag of the port 0 direction control register (P0DIR) to "1" and write
the data to the port 0 output register (P0OUT).
Each bit can be set individually if pull-up or pull-down resistor is added or not, by the port 0 pull-up / pull-
down resistor control register (P0PLUD). Set the control flag of the port 0 pull-up / pull-down resistor
control register (P0PLUD) to "1" to add pull-up or pull-down resistor. The pull-up / pull-down resistor
selection register (FLOAT) selects if pull-up resistor or pull-down resistor is added. The bp4 of the pull-up
/ pull-down resistor control register (FLOAT) is set to "1" for pull-down resistor, set to "0" for pull-up
resistor.
nSpecial Function Pin Setup
P00 to P05 are used as I/O pin for serial 0, 2, as well. P00 and P03 are output pins of the serial 0, 2
transmission data. When the SC0SBOS, SC2SBOS flag of the serial interface 0, 2 mode register 1
(SC0MD1, SC2MD1) is "1", P00 and P03 are serial data output pins. P01 and P04 are the input pins of
the serial 0, 2 reception data. P03 and P05 are I/O pins of the serial 0, 2 clock. When the SC0SBTS,
SC2SBTS flag of serial interface 0, 2 mode register 1 (SC0MD1, SC2MD1) is "1", P03 and P05 are serial
clock output pins.
P00, P01, P03 and P05 can be selected as either an push-pull output or Nch open-drain output by the
serial interface 0, 2 port control registers (SC0ODC, SC2ODC).
4-2
Port 0
4-2-1
Description
[
Chapter 11 11-2. Control registers ]
[
Chapter 12 12-2. Control registers ]
P06 is used as a buzzer output pin, as well. When the bp7 of the oscillation stabilization control register
(DLYCTR) is "1", buzzer output is enabled.