SN8P1829
8-Bit MCU build-in 12-bit ADC + PGIA + Charge-pump Reg 128 dots LCD driver
SONiX TECHNOLOGY CO., LTD
Page 107
Version 1.0
I/O PORT MODE
The port direction is decided by P
N
M register. Port 0 is always input mode. Port 1 and Port 5 can select input or output
direction.
P1M initial value = xx00 0000
0C1H
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
P1M
0 0 0 0
P13M
P12M
P11M
P10M
- - - -
R/W
R/W
R/W
R/W
P10M~P13M: P1.0~P1.3 I/O direction control bit. 0 = input mode, 1 = output mode.
P5M initial value = 0000 0000
0C5H
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
P5M
0
0
0
P54M P53M P52M P51M P50M
-
-
- R/W R/W R/W R/W R/W
P50M~P54M: P5.0~P5.4 I/O direction control bit. 0 = input mode, 1 = output mode.
The each bit of P
N
M is set to “0”, the I/O pin is input mode. The each bit of P
N
M is set to “1”, the I/O pin is output mode.
The P
N
M registers are read/write bi-direction registers. Users can program them by bit control
instructions (B0BSET, B0BCLR).
Example: I/O mode selection.
CLR
P1M
; Set all ports to be input mode.
CLR
P5M
MOV
A, #0FFH
; Set all ports to be output mode.
B0MOV
P1M,
A
B0MOV
P5M,
A
B0BCLR
P1M.1
; Set P1.1 to be input mode.
B0BSET
P1M.1
; Set P1.1 to be output mode.