Chapter 4 I/O Ports
IV - 12
Port 1
4-3 Port 1
4-3-1 Description
General Port Setup
Each bit of the port 1 control I/O direction register (P1DIR) can be set individually to set pins as input or
output. The control flag of the port 1 direction control register (P1DIR) should be set to "1" for output
mode, and "0" for input mode.
To read input data of pin, set the control flag of the port 1 direction control register (P1DIR) to "0" and
read the value of the port 1 input register (P1IN).
To output data to pin, set the control flag of the port 1 direction control register (P1DIR) to "1" and write
the value of the port 1 output register (P1OUT).
Each bit can be set individually whether pull-up resistor is added or not, by the port 1 pull-up resistor control
register (P1PLU). Set the control flag of the port 1 pull-up resistor control register (P1PLU) to "1" to add pull-
up resistor.
Special Function Pin Setup
P10, P12 and P14 have real time output control function. P10, P12, and P14 can be used as I/O ports and
also switched to 3 types of pin output; "High", "Low", and "Hi-z". P10 is controlled with bp1, bp0, P12 is
controlled with bp3, bp2 and P14 is controlled with bp5, bp4 of the port 1 output control register (P1TCNT).
When these flags are set to "00", these pins are used as I/O ports. When the pins are set to "01", "High"
is output, to "10", "Low" is output and to "11", "High-z" is output.
Also, P10 to P14 are used as timer I/O pin, as well. P10 is used as remote control carrier output pin, as
well. The port 1 output mode register (P1OMD) can select P10 to P14 output mode by each bit. When port
1 output mode register (P1OMD) is "1", special function data is output, and when it is "0", they are used as
general port.
For more information, refer to 4-12 Real Time Output Control Function [p.IV-45].