
MS51
Dec. 17, 2019
Page
196
of 316
Rev 1.01
M
S51
SE
RIES
TE
CHNICA
L REF
ERE
N
CE MA
NU
A
L
Bit
Name
Description
0
P2.0
Port 2 bit 0
P2.0 is an input-only pin when RPD (CONFIG0.2) is programmed as 0. When leaving RPD un-
programmed, P2.0 is always read as 0.
P3
Bit
Name
Description
0
P3.0
Port 3 bit 0
P3.0 is available only when the internal oscillator is used as the system clock. At this moment, P3.0
functions as a general purpose I/O.
If the system clock is not selected as the internal oscillator, P3.0 pin functions as OSCIN. A write to
P3.0 is invalid and P3.0 is always read as 0.
GPIO Mode Control
6.4.2.2
These registers control GPIO mode, which is configurable among four modes: input-only, quasi-
bidirectional, push-pull, or open-drain. Each pin can be configured individually.
As default after reset all GPIO setting as input only mode.
PnM1.X
PnM2.X
I/O Type
0
0
Quasi-bidirectional
0
1
Push-pull
1
0
Input-only (high-impedance)
1
1
Open-drain
PnM1
– Port Mode Select 1
Register
SFR Address
Reset Value
P0M1
B1H, Page 1
1111_1111 b
P1M1
B3H, Page 1
1111_1111 b
P3M1
C2H, Page 1
0000_0001 b
PnM2
– Port Mode Select 2
Register
SFR Address
Reset Value
P0M2
B2H, Page 1
0000_0000 b
P1M2
B4H, Page 1
0000_0000 b
P3M2
C3H, Page 1
0000_0000 b
PnM1
– Port n Mode Select 1
[1]
7
6
5
4
3
2
1
0
PnM1.7
PnM1.6
PnM1.5
PnM1.4
PnM1.3
PnM1.2
PnM1.1
PnM1.0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
PnM2
– Port n Mode Select 2
[1]