202
CHAPTER 8 I/O PORTS
MB90560 series
8.7
8.7.1 Port 4 Registers (PDR4 and DDR4)
Port 4
This section describes the port 4 registers.
I
Functions of Port 4 Registers
G
Port 4 data register (PDR4)
The PDR4 register indicates the state of each pin of port 4.
G
Port 4 data direction register (DDR4)
The DDR4 register specifies the direction of a data flow (input or output) at each pin (bit) of
port 4. When a DDR4 register bit is “1”, the corresponding port (pin) is set as an output port.
When the bit is “0”, the port (pin) is set as an input port.
<Check>
When a peripheral function having output pins is used, the port functions as peripheral
function output pins regardless of the value in the DDR4 register as long as the peripheral
function output enable bit corresponding to the pins is set.
To use a peripheral function having input pins, reset the DDR4 register bit corresponding
to each peripheral function input pin to “0” to place the port in input mode.
Table 8.7-3 lists the functions of the port 4 registers.
Table 8.7-3 Port 4 register functions
R/W : Read/write enabled
X
: Undefined
–
: Empty bit
Register
Data
During
reading
During writing
Read/
Write
Address
Initial value
Port 4 data
register (PDR4)
0
The pin is at
the low level.
The output latch is loaded with “0”. When
the pin functions as an output port, the pin
is set to the low level.
R/W
000004H
–XXXXXXXB
1
The pin is at
the high
level.
The output latch is loaded with “1”. When
the pin functions as an output port, the pin
is set to the high level.
Port 4 data
direction register
(DDR4)
0
The direction
latch is “0”.
The output buffer is turned off to place the
port in input mode.
R/W
000014H
–0000000B
1
The direction
latch is “1”.
The output buffer is turned on to place the
port in output mode.