INPUT/OUTPUT PINS
5.2 Programmable I/O ports
5.2.2 Port register
Data is input from or output to the external by writing/reading data to/from a port register. A port register
consists of a port latch which holds the output data and a circuit which reads the pin state. One bit of the
port register corresponds to one pin of the microcomputer. (This is the one-to-one relationship.) Figure
5.2.3 shows the structure of the port Pi (i = 1, 2, 5 to 7) register.
ꢀ When outputting data from programmable I/O port which has been set to output mode
ꢀ By writing data to the corresponding bit of the port register, the data is written into the port latch.
ꢀ The data is output from the pin according to the contents of the port latch.
By reading the port register of a port which has been set to the output mode, the contents of the port
latch is read out, instead of the pin state. Accordingly, the output data can be correctly read out without
being affected by an external load, etc. (See “Figures 5.2.4 and 5.2.5.”)
ꢀ When inputting data from programmable I/O port which has been set to input mode
ꢀ A pin which has been set to the input mode enters the floating state.
ꢀ By reading the corresponding bit of the port register, the data which has been input from the pin can
be read out.
By writing data to a port register of a programmable I/O port which has been set to the input mode,
the data is written only into the port latch and is not output to the external (Note). This pin remains
floating state.
Note: When executing a read-modify-write instruction to a port register of a programmable I/O port
which has been set to the input mode, the instruction will be executed to the data which has
been input from the pin and the result will be written into the port register.
b7 b6 b5 b4 b3 b2 b1 b0
Port Pi register (i = 1, 2, 5 to 7)
(Addresses 316, 616, B16, E16, F16)
Funtion
Bit
0
Bit name
At reset R/W
Undefined
RW
Port pin Pi0
Port pin Pi1
Port pin Pi2
Port pin Pi3
Port pin Pi4
Port pin Pi5
Port pin Pi6
Port pin Pi7
Data is input from or output to a pin by reading from
or writing to the corresponding bit.
Undefined RW
Undefined RW
Undefined RW
Undefined RW
Undefined RW
Undefined RW
Undefined RW
1
2
0 : “L” level
1 : “H” level
3
4
5
6
7
Notes 1: Nothing is assigned for bits 0 to 4 of the port P5 register. These bits are undefined at reading.
2: Nothing is assigned for bits 6 and 7 of the port P6 register. These bits are undefined at reading.
3: Nothing is assigned for bits 5 to 7 of the port P7 register. These bits are undefined at reading.
Fig. 5.2.3 Structure of port Pi (i = 1, 2, 5 to 7) register
7906 Group User’s Manual Rev.2.0
5-4