NEC PD703114 User Manual page 580

V850e/ia2 32-bit single-chip microcontrollers
Table of Contents

Advertisement

12.4 Operation of Port Function
The operation of a port differs depending on whether it is set in the input or output mode, as follows.
12.4.1 Writing to I/O port
(1) In output mode
A value can be written to the output latch (Pn) by writing it to the port n register (Pn). The contents of the
output latch are output from the pin.
Once data is written to the output latch, it is held until new data is written to the output latch.
(2) In input mode
A value can be written to the output latch (Pn) by writing it to the port n register (Pn). However, the status of
the pin does not change because the output buffer is off.
Once data is written to the output latch, it is held until new data is written to the output latch.
Caution A bit manipulation instruction (CLR1, SET1, NOT1) 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, are overwritten to the current input pin status and become undefined.
12.4.2 Reading from I/O port
(1) In output mode
The contents of the output latch (Pn) can be read by reading the port n register (Pn). The contents of the
output latch do not change.
(2) In input mode
The status of the pin can be read by reading the port n register (Pn). The contents of the output latch (Pn) do
not change.
12.4.3 Output status of alternate function in control mode
The status of a port pin can be read by setting the port n mode register (PMn) to the input mode regardless of the
setting of the PMCn register. If the PMn register is set to the output mode, the value of the port n register (Pn) can be
read in the port mode, and the output status of the alternate function can be read in the control mode.
580
CHAPTER 12 PORT FUNCTIONS
User's Manual U15195EJ5V0UD

Advertisement

Table of Contents
loading

Table of Contents