HYUNDAI MicroElectronics
GMS81508B/16B/24B
9. I/O PORTS
The GMS815xxB has seven ports (R0, R1, R2, R4, R5, and
R6).These ports pins may be multiplexed with an alternate
function for the peripheral features on the device.
All pins have data direction registers which can define
these ports as output or input. A “1” in the port direction
register configure the corresponding port pin as output.
Conversely, write “0” to the corresponding bit to specify it
as input pin. For example, to use the even numbered bit of
R0 as output ports and the odd numbered bits as input
ports, write “55
H
” to address 0C1
H
(R0 port direction reg-
ister) during initial setting as shown in Figure 9-1.
All the port direction registers in the GMS815xxB have 0
written to them by reset function. On the other hand, its in-
itial status is input.
R1 and R1DD register:
R1 is an 8-bit CMOS bidirection-
al I/O port (address 0C2
H
). Each I/O pin can independently
used as an input or an output through the R1DD register
(address 0C3
H
).
R1 Data Register
R1
ADDRESS: 0C2
H
RESET VALUE: Undefined
R17 R16 R15 R14 R13 R12 R11 R10
Input / Output data
R1 Direction Register
R1DD
ADDRESS: 0C3
H
RESET VALUE: 00
H
WRITE “55
H
” TO PORT R0 DIRECTION REGISTER
0C0
H
0C1
H
0C2
H
0C3
H
R0 data
R0 direction
R1 data
R1 direction
I O I O I O I O PORT
7 6 5 4 3 2 1 0
I: INPUT PORT
O: OUTPUT PORT
0 1 0 1 0 1 0 1
7 6 5 4 3 2 1 0
BIT
Port Direction
0: Input
1: Output
R2 and R2DD register:
R2 is an 8-bit CMOS bidirection-
al I/O port (address 0C4
H
). Each I/O pin can independently
used as an input or an output through the R2DD register
(address 0C5
H
).
R2 Data Register
R2
ADDRESS: 0C4
H
RESET VALUE: Undefined
R27 R26 R25 R24 R23 R22 R21 R20
Figure 9-1 Example of port I/O assignment
Input / Output data
R0 and R0DD register:
R0 is an 8-bit CMOS bidirection-
al I/O port (address 0C0
H
). Each I/O pin can independently
used as an input or an output through the R0DD register
(address 0C1
H
).
R0 Data Register
R0
ADDRESS: 0C0
H
RESET VALUE: Undefined
R2 Direction Register
R2DD
ADDRESS: 0C5
H
RESET VALUE: 00
H
Port Direction
0: Input
1: Output
R07 R06 R05 R04 R03 R02 R01 R00
Input / Output data
R0 Direction Register
R0DD
ADDRESS: 0C1
H
RESET VALUE: 00
H
Port Direction
0: Input
1: Output
DEC. 1999 Ver 1.04
31