Rev. 1.0, 02/00, page 105 of 1141
6.2.6
Port Mode Register (PMR1)
0
0
1
0
R/W
2
0
R/W
3
0
4
0
R/W
0
R/W
5
0
7
0
R/W
PMR17
PMR16
PMR15
PMR14
PMR13
PMR12
PMR11
PMR10
R/W
R/W
R/W
6
Bit :
Initial value :
R/W :
Port Mode Register 1 (PMR1) controls pin function switching-over of port 1. Switching is
specified for each bit.
PMR1 is an 8-bit readable/writable register and is initialized to H'00 by a reset.
Only bits 5 to 0 are explained here. For details, see section 10.3.2, Register Configuration.
Bits 5 to 0
P15/
,54
8
,54
8
,54
8
,54
8
to P10/
,54
3
,54
3
,54
3
,54
3
pin switching (PMR15 to PMR10): These bits are for
setting the P1n/
,54Q
pin as the input pin for P1n or as the
,54Q
pin for external interrupt request
input.
Bit n
PMR1n
Description
0
P1n/
,54Q
pin functions as the P1n input/output pin
(Initial value)
1
P1n/IRQn pin functions as the
,54Q
input/output pin
(n = 5 to 0)
Notes on switching the pin function by PMR1 are as follows:
•
When the port is set as the
,&
input pin or
,54
8
to
,54
3
input pin, the pin level must be high
or low regardless of active mode or power-down mode. Do not set the pin level at medium.
•
Switching the pin function of P16/
,&
or P15/
,54
8
to P10/
,54
3
may be mistakenly identified
as edge detection and detection signal may be generated. To prevent this, operate as follows:
Set the interrupt enable/disable flag to disable before switching the pin function.
Clear the applicable interrupt request flag to 0 after switching the pin function and
executing another instruction.
Program example
:
MOV.B R0L,@IENR
⋅⋅⋅⋅⋅⋅
Interrupt disabled
MOV.B R1L,@PMR1
⋅⋅⋅⋅⋅⋅
Pin function change
NOP
⋅⋅⋅⋅⋅⋅
Optional instruction
BCLR m @IRQR
⋅⋅⋅⋅⋅⋅
Applicable interrupt clear
MOV.B R1L,@IENR
⋅⋅⋅⋅⋅⋅
Interrupt enabled
: