![](http://datasheet.mmic.net.cn/120000/ML66525-XXTB_datasheet_3559839/ML66525-XXTB_182.png)
Chapter 7
I/O Port
VII - 34
Ports
7.3.3
Description (Port 3)
■ General Port Setup
Each bit can be set individually as either an input or output by the port 3 I/O control register (P3DIR). The control
flag of the P3DIR register is set to “1” for output mode, and to “0” for input mode.
To read input data of a pin, set the control flag of the P3DIR register to “0” and read the value of the port 3 input
register (P3IN).
To output data to a pin, set the control flag of the P3DIR register to “1” and write data to the port 3 output register
(P3OUT).
Each bit can be set individually if pull-up resistor is added or not, by the port 3 pull-up control register (P3PLU).
Set the control flag of the P3PLU to “1” to add pull-up resistor.
■ Special Function Pin Setup
P30 to P35 are used as I/O pins of timer 0 to 5 as well. Each bit can be selected individually as output mode by
port 3 output mode register (P3MD). P30 to P35 output special function data when the control flag of the P3MD
is “1”and are used as general ports when it is “0”.
P36 to P37 are used as I/O pins of timer 8 as well. Each bit can be selected individually as output mode by port 3
output mode register (P3MD). P36 to P37 output special function data when the control flag of the P3MD is
“1”and are used as general ports when it is “0”.
7.3.4
Description (Port 4)
■ General Port Setup
Each bit can be set individually as either an input or output by the port 4 I/O control register (P4DIR). The control
flag of the P4DIR register is set to “1” for output mode, and to “0” for input mode.
To read input data of a pin, set the control flag of the P4DIR register to”1” and read the value of the port 4 input
register (P4IN).
To output data to a pin, set the control flag of the P4DIR register to “1” and write data to the port 4 output register
(P4OUT).
Each bit can be set individually if pull-up resistor is added or not, by the port 4 pull-up control register (P4PLU).
Set the control flag of the P4PLU register to “1” to add pull-up resistor.
■ Special Function Pin Setup
P42 to P43, P46 to P47 are used as I/O pins of timer 9 and 10 as well. Each bit can be selected individually as out-
put mode by the port 4 output mode register (P4MD). P42 to P43, P46 to P47 output special function data when
the control flag of the P4MD is “1”and are used as general ports when it is “0”