
CHAPTER 4 PORT FUNCTIONS
User’s Manual U17790EJ2V0UD
198
The order of setting in which malfunction may occur on switching from the P41 pin to the
SCL01 pin are shown below.
Setting Order
Setting Contents
Pin States
Pin Level
<1>
Initial value
(PMC41 bit = 0,
PFC41 bit = 0,
PF41 bit = 0)
Port mode (input)
Hi-Z
<2>
PMC41 bit
← 1
SOB0 output
Low level (high level depending on the
CSIB0 setting)
<3>
PFC41 bit
← 1
SCL01 I/O
High level (CMOS output)
<4>
PF41 bit
← 1
SCL01 I/O
Hi-Z (N-ch open-drain output)
In <2>, I
2C communication may be affected since the alternate-function SOB0 output is output
to the pin. In the CMOS output period of <2> or <3>, unnecessary current may be generated.
(b) Cautions on alternate-function mode (input)
The input signal to the alternate-function block is low level when the PMCn.PMCnm bit is 0 due to the AND
output of the PMCn register set value and the pin level. Thus, depending on the port setting and alternate-
function operation enable timing, unexpected operations may occur. Therefore, switch between the port
mode and alternate-function mode in the following sequence.
To switch from port mode to alternate-function mode (input)
Set the pins to the alternate-function mode using the PMCn register and then enable the alternate-
function operation.
To switch from alternate-function mode (input) to port mode
Stop the alternate-function operation and then switch the pins to the port mode.
The concrete examples are shown as Example 1 and Example 2.
[Example 1]
Switch from general-purpose port (P02) to external interrupt pin (NMI)
When the P02/NMI pin is pulled up as shown in Figure 4-41 and the rising edge is specified
in the NMI pin edge detection setting, even though high level is input continuously to the NMI
pin during switching from the P02 pin to the an NMI pin (PMC02 bit = 0
→ 1), this is detected
as a rising edge as if the low level changed to high level, and an NMI interrupt occurs.
To avoid it, set the NMI pin’s valid edge after switching from the P02 pin to the NMI pin.