MB89960 series
CHAPTER 4 I/O Ports
79
4
4.2 Ports 0 and 1
4.2.2 Operation of Ports 0 and 1
This section describes the operation of ports 0 and 1.
s Operation of Ports 0 and 1
q Operation as an output port
Setting the corresponding DDR0 or DDR1 register bit to “1” sets a pin as an output
port.
When a pin is set as an output port, the output buffer is “ON” and the pin outputs the
data set in the output latch.
Writing data to the PDR0 and PDR1 registers stores the data in the output latch and
outputs the data directly to the pin.
Reading the PDR0 or PDR1 register returns the pin value (“0” or “1”, the same value
as the output latch).
Note: As the bit manipulation instructions (SETB and CLRB) read the output latch data rather
than the pin level, the instructions do not change the output latch values for bits other
than the bit being set or cleared.
q Operation as an input port
Setting the corresponding DDR0 or DDR1 register bit to “0” sets a pin as an input port.
When a pin is set as an input port, the output buffer is “OFF” and the pin goes to the
high impedance state.
Writing data to the PDR0 and PDR1 registers stores the data in the output latch but
does not output the data to the pin.
Reading the PDR0 or PDR1 register returns the pin value (“0” or “1”).
q Operation at reset
Resetting the CPU initializes the DDR0 and DDR1 registers to zero. This sets all
output buffers “OFF” (all pins become input ports) and sets the pins to the high
impedance state.
The PDR0 and PDR1 registers are not initialized by a reset. Therefore, to use as
output ports, set the output data in the PDR0 and PDR1 registers before setting the
corresponding DDR0 or DDR1 register bits to output mode.
q Operation in stop mode
The pins go to high impedance if the pin state specification bit in the standby control register
(STBC: SPL) is “1” when the device changes to stop mode. This is achieved by forcibly setting
the output buffer “OFF” regardless of the DDR0 and DDR1 register values.
Table 4.2.2 lists the port 0 and 1 pin states.
SPL: Pin state specification bit in the standby control register (STBC: SPL)
MOD0, MOD1: Mode pins
Hi-z: High impedance
Note: Pins with the pull-up resistor selected go to the “H” level rather than to high impedance
when the output buffer is “OFF”.
Table 4.2.2 Port 0 and 1 Pin States
Pin
Normal Mode, Sleep Mode,
Stop Mode (SPL=0)
Stop Mode (SPL=1)
Reset
(MOD0, MOD1 = VSS, VSS)
P00/INT20 - P07/INT27
General-purpose I/O ports
Hi-z
P10/INT10 - P17