EasyManuals Logo
Home>Renesas>Microcontrollers>RL78/G15

Renesas RL78/G15 User Manual

Renesas RL78/G15
765 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #127 background imageLoading...
Page #127 background image
RL78/G15 CHAPTER 4 PORT FUNCTIONS
R01UH0959EJ0110 Rev.1.10 Page 127 of 765
Mar 7, 2023
4.6 Cautions When Using Port Function
4.6.1 Cautions on 1-bit manipulation instruction for port register n (Pn)
When a 1-bit manipulation instruction is executed on a port that provides both input and output functions, the output latch
value of an input port that is not subject to manipulation may be written in addition to the targeted bit.
Therefore, it is recommended to rewrite the output latch when switching a port from input mode to output mode.
[Example]
When P00 is an output port, P01 to P07 are input ports (the status of all pins is high level), and the output latch value of
port 0 is 00H, if the output of output port P00 is changed from low level to high level via a 1-bit manipulation instruction,
the output latch value of port 0 is FFH.
[Explanation]
The targets of writing to and reading from the Pn register of a port whose PMnm bit is 1 are the output latch and pin
status, respectively.
A 1-bit manipulation instruction is executed in the following order in the RL78 microcontroller.
<1> The Pn register is read in 8-bit units.
<2> The targeted one bit is manipulated.
<3> The Pn register is written in 8-bit units.
In step <1>, the output latch value (0) of P00, which is an output port, is read, while the pin status of P01 to P07, which
are input ports, is read. If the pin status of P01 to P07 is high level at this time, the read value is FEH.
The value is changed to FFH by the manipulation in <2>.
FFH is written to the output latch by the manipulation in <3>.
Figure 4-8. Bit Manipulation Instruction (P00)
1-bit manipulation instruction for the P00 bit
<1> Port register 0 (P
0) is read in 8-bit units.
  In the case of P00, an output port, the value of the port output latch (0) is read.
  In the case of P01 to P07, input ports, the pin status
(1) is read.
<2> Set the P00 bit to 1.
<3
> Write the results of <2> to the output latch of port register 0 (P0) in 8-bit units.
0
P00
P
01-P07
Low-level output
Pin status: High level
Port 0 output latch
0 0 0
0 0 0 0 1
P
00
P01
-P07
High-level output
Pin status:
High level
Port 0 output latch
1
1 1 1 1 1 1
1-bit manipulation
instruction (set1 P0.0)
is executed for the P00
bit.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Renesas RL78/G15 and is the answer not in the manual?

Renesas RL78/G15 Specifications

General IconGeneral
BrandRenesas
ModelRL78/G15
CategoryMicrocontrollers
LanguageEnglish

Related product manuals