Operation Of Port 4 - Fujitsu MB90460 Series Hardware Manual

F2mc-16lx 16-bit microcontroller
Table of Contents

Advertisement

9.7.2

Operation of Port 4

This section describes the operation of port 4.
■ Operation of Port 4
Port operation in output mode
• Setting a bit of the DDR4 register to "1" places the corresponding port pin in output mode.
• Data written to the PDR4 register in output mode is held in the output latch of the PDR and output to the
port pins.
• The PDR4 register can be accessed in read mode to read the value at the port pins (the same value as in
the output latch of the PDR).
Note:
If a read-modify-write instruction (such as an instruction that sets bits) is used with the port data
register, the target bits of the register are set to the specified value. The bits that have been
specified for output using the DDR register are not affected, but for the bits that have been specified
for input, a value input from the pins is written to the output latch and output as is. Before switching
the mode for the bits from input to output, therefore, write output data to the PDR register, then
specify output mode in the DDR register.
Port operation in input mode
• Resetting a bit of the DDR4 register to "0" places the corresponding port pin in input mode.
• In input mode, the output buffer is turned off, and the pins are placed in a high impedance state.
• Data written to the PDR4 register in input mode is held in the output latch of the PDR but not output to
the port pins.
• The PDR4 register can be accessed in read mode to read the level value (0 or 1) at the port pins.
Port operation for resource output
The resource output enable bit is set to enable the port to be used for resource output. The state of the
resource enable bit takes precedence when specifying a switch between input and output. Even if a DDR4
register bit is "0", the corresponding port pin is used for resource output if the resource has been enabled for
output. Because the value at the pins can be read even if resource output is enabled, the resource output
value can be read.
Port operation for resource input
When the port is also used for resource input, the value at the pins is always supplied as resource inputs.
To use an external signal for the resource, reset the DDR4 register to "0" to place the port in input mode.
CHAPTER 9 I/O PORT
191

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mb90465 series

Table of Contents