Operation Of Port Function; Writing Data To I/O Port; Reading Data From I/O Port; Operation With I/O Port - NEC V850ES/SA2 UPD703201 Manual

32-bit single-chip microcontrollers
Table of Contents

Advertisement

4.4

Operation of Port Function

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

Writing data to I/O port

(1) In output mode
A value can be written to the output latch by using a transfer instruction. The contents of the output latch are
output from the pin. Once data has been written to the output latch, it 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. Because the output buffer is off,
however, the status of the pin does not change.
Once data has been written to the output latch, it is retained until new data is written to the output latch.
Caution A 1-bit memory manipulation instruction manipulates 1 bit but accesses a port in 8-bit units.
If this instruction is executed to manipulate a port with a mixture of input and output bits, the
contents of the output latch of a pin set in the input mode, in addition to the bit to be
manipulated, become undefined.
4.4.2

Reading data 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 do
not change.
(2) In input mode
The status of the pin can be read by using a transfer instruction. The contents of the output latch do not
change.
4.4.3

Operation with I/O port

(1) In output mode
An operation is performed on the contents of the output latch and the result is written to the output latch. The
contents of the output latch are output from the pin.
Once data has been written to the output latch, it is retained until new data is written to the output latch.
(2) Input mode
The contents of the output latch become undefined. Because the output buffer is off, however, the status of the
pin does not change.
Caution A 1-bit memory manipulation instruction manipulates 1 bit but accesses a port in 8-bit units.
If this instruction is executed to manipulate a port with a mixture of input and output bits, the
contents of the output latch of a pin set to the input mode, in addition to the bit to be
manipulated, become undefined.
180
CHAPTER 4 PORT FUNCTIONS
Preliminary User's Manual U15905EJ1V0UD

Advertisement

Table of Contents
loading

Table of Contents