![](http://datasheet.mmic.net.cn/110000/M37721S1BFP_datasheet_3496256/M37721S1BFP_93.png)
7721 Group User’s Manual
INPUT/OUTPUT PINS
6–4
6.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. Each bit of the
port register corresponds one for one to each pin of the microcomputer. Figure 6.2.3 shows the structure
of the port Pi (i = 4 to 10) register.
q When outputting data from programmable I/O port 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 set to the output mode, the contents of the port latch is read
out, instead of the pin state. Accordingly, the output data is correctly read without being affected by
an external load, etc. (Refer to “Figures 6.2.4 and 6.2.5.”)
q When inputting data from programmable I/O port set to input mode
A pin which is set to the input mode enters the floating state.
By reading the corresponding bit of the port register, the data which is input from the pin can be
read out.
By writing data to the port register of a programmable I/O port set to the input mode, the data is written
only into the port latch and is not output to the external (Note). The pin remains floating.
Note: When executing a read-modify-write instruction (CLB, SEB, INC, DEC, ASL, ASR, LSR, ROL,
ROR) to the port register of a programmable I/O port set to the input mode, the instruction is
executed to the data which is input from the pin and the result is written into the port register.
6.2 Programmable I/O ports
Fig. 6.2.3 Structure of port Pi (i = 4 to 10) register
Bit
Bit name
Functions
0
1
2
3
4
5
6
7
Port Pi0’s pin
Port Pi2’s pin
Port Pi3’s pin
Port Pi4’s pin
Port Pi6’s pin
Data is input from or output to a pin
by reading from or writing to the
corresponding bit.
Port Pi5’s pin
Port Pi register (i = 4 to 10)
(Addresses A16, B16, E16, F16, 1216, 1316, 1616)
b1
b0
b2
b3
b4
b5
b6
b7
Port Pi1’s pin
Port Pi7’s pin
At reset
RW
Undefined
0 : “L” level
1 : “H” level
RW
Note: For bits 0 to 2 of the port P4 register, nothing is assigned and these bits are fixed to “0” at reading.