![](http://datasheet.mmic.net.cn/120000/MB89P195P-101_datasheet_3559072/MB89P195P-101_86.png)
4-8 Chapter 4 I/O Ports
MB89190/190A series
4.2 Port 0
4.2.1 Port 0 Registers (PDR0, DDR0)
The registers related to port 0 are explained.
T Function of port 0 registers
Port 0 data register (PDR0)
The PDR0 register indicates the state of the pin, so a pin set to the output port can read the same
value as the output latch (0 or 1), but a pin set to the input port cannot read the value of the output
latch.
Reference:
During execution of the bit manipulation instructions (SETB, CLRB), the value of the output
latch is read instead of the pin, so the value of the output latch other than the bits to be
manipulated remains un-changed.
Port 0 direction register (DDR0)
The DDR0 register sets the I/O direction of the pin bit-by-bit.
When the bit corresponding to the port is set to 1, it becomes an output port.
When the bit
corresponding to the port is set to 0, it becomes an input port.
Check:
The DDR0 register is write only, so the bit manipulation instructions (SETB, CLRB) cannot be
used for it.
[Port 0 input enable register (ENI0)]
Each bit of the ENI0 register corresponds to each pin of P00 to P03. When this bit is 1, the
corresponding external interrupt input and port input are enabled. When it is 0, all input
functions other than the analog input are disabled.
External interrupt input setting
When using a port 0 pin as an external interrupt input pin, enable operation of the external interrupt
circuit and set the corresponding pin to the input port. The value of the corresponding output latch is
meaningless.
Analog input setting (only MB89190A series)
Disable the operation of the output transistor corresponding to the pin used as the analog input, and
set the pin to high impedance.
Resource output setting
When using a resource with an output pin, set the output enable bit of the resource to Enable.
Output of the resource is preferred, so the setting of the PDR0 and DDR0 registers that corresponds
to the resource output pin is meaningless, irrespective of the output value and output enable of the
resource.
Resource input setting
When using a resource with an input pin, set the pin corresponding to the input of the resource to the
input port. The value of the corresponding output latch is meaningless.