Operation Of Port Functions; Writing To I/O Port; Reading From I/O Port; Arithmetic Operation Of I/O Port - NEC PD789860 User Manual

8-bit single-chip microcontrollers pd789860 subseries; pd789861 subseries
Table of Contents

Advertisement

6.4 Operation of Port Functions

The operation of a port differs depending on whether the port is set to input or output mode, as described below.

6.4.1 Writing to I/O port

(1)
In output mode
A value can be written to the output latch of a port by using a transfer instruction. The contents of the output
latch can be output from the pins of the port.
The data once written to the output latch is retained until new data is written to the output latch.
(2)
In input mode
A value can be written to the output latch by using a transfer instruction. However, the status of the port pin
is not changed because the output buffer is OFF.
The data once written to the output latch is retained until new data is written to the output latch.
Caution A 1-bit memory manipulation instruction is executed to manipulate one bit of a port.
However, this instruction accesses the port in 8-bit units.
executed to manipulate a bit of a port consisting both of inputs and outputs, therefore, the
contents of the output latch of the pin that is set to input mode and not subject to
manipulation become undefined.

6.4.2 Reading from I/O port

(1)
In output mode
The contents of the output latch can be read by using a transfer instruction. The contents of the output latch
are not changed.
(2)
In input mode
The status of a pin can be read by using a transfer instruction. The contents of the output latch are not
changed.

6.4.3 Arithmetic operation of I/O port

(1)
In output mode
An arithmetic operation can be performed with the contents of the output latch. The result of the operation is
written to the output latch. The contents of the output latch are output from the port pins.
The data once written to the output latch is retained until new data is written to the output latch.
(2)
In input mode
The contents of the output latch become undefined. However, the status of the pin is not changed because
the output buffer is OFF.
Caution A 1-bit memory manipulation instruction is executed to manipulate one bit of a port.
However, this instruction accesses the port in 8-bit units.
executed to manipulate a bit of a port consisting both of inputs and outputs, therefore, the
contents of the output latch of the pin that is set to input mode and not subject to
manipulation become undefined.
68
CHAPTER 6 PORT FUNCTIONS
User's Manual U14826EJ5V0UD
When this instruction is
When this instruction is

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pd78e9861aPd78e9860aPd789860(a)Pd789861

Table of Contents