
INPUT/OUTPUT PINS
7905 Group User’s Manual Rev.1.0
5-4
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, 4 to 8) register.
q 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.”)
q 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.
Fig. 5.2.3 Structure of port Pi (i = 1, 2, 4 to 8) register
RW
Bit name
Bit
0
1
2
3
4
5
6
7
Port Pi register (i = 1, 2, 4 to 8)
(Addresses 316, 616, A16, B16, E16, F16, 1216)
Funtion
At reset
R/W
Port pin Pi0
Port pin Pi1
Port pin Pi2
Port pin Pi3
Port pin Pi4
Port pin Pi5
Port pin Pi6
Port pin Pi7
Undefined
b7 b6 b5 b4 b3 b2 b1 b0
Notes 1: Nothing is assigned for bits 0 and 4 of the port P5 register. These bits are undefined at reading.
2: Nothing is assigned for bits 4 to 7 of the port P8 register. These bits are undefined at reading.
Data is input from or output to a pin by reading from
or writing to the corresponding bit.
0 : “L” level
1 : “H” level