
GMS81C7208/7216
FEB. 2005 Ver 1.04
31
9. I/O PORTS
The GMS81C7208/16 has six ports (R0, R2, R3, R4, R5 and R6),
and LCD segment port SEG0~SEG11 and SEG16~SEG20 and
LCD common port COM0~COM3, which are multiplexed with
SEG24~SEG26.
These ports pins may be multiplexed with an alternate function
for the peripheral features on the device. In general, in a initial re-
set state, R0,R2,R3 ports are used as a general purpose input port
and R4, R5 and R6 ports are used as LCD segment drive output
port.
9.1 Port Data Registers
Port Data Registers
The Port Data Registers in I/O buffer in each six ports
(R0,R2,R3,R4,R5,R6) are represented as a Type D flip-flop,
which will clock in a value from the internal bus in response to a
"write to data register" signal from the CPU. The Q output of the
flip-flop is placed on the internal bus in response to a "read data
register" signal from the CPU. The level of the port pin itself is
placed on the internal bus in response to "read data register" sig-
nal from the CPU. Some instructions that read a port activating
the "read register" signal, and others activating the "read pin" sig-
nal
Port Direction Registers
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 num-
bered bits as input ports, write “55
H
” to address 0C8
H
(R0 port
direction register) during initial setting as shown in Figure 9-1.
Figure 9-1 Example of Port I/O Assignment
All the port direction registers in the MCU have 0 written to them
by reset function. On the other hand, its initial status is input.
Pull-up Control Registers
The R0, R2 and R3 ports have internal pull-up resistors.
Figure 9-2 shows a functional diagram of a typical pull-up port.
It is connected or disconnected by pull-up control register
(PUR
n
). The value of that resistor is typically 160k
.
When a port is used as input, input logic is firmly either low or
high, therefore external pull-down or pull-up resisters are re-
quired practically. The GMS81C7208/16 has internal pull-up, it
can be logic high by pull-up that can be able to configure either
connect or disconnect individually by pull-up control registers
R0PU, R2PU and R3PU.
When ports are configured as inputs and pull-up resistor is select-
ed by software, they are pulled to high.
Figure 9-2 Pull-up Port Structure
Open Drain Port Registers
The R0, R2 and R3 ports have open drain port resistors
R0CR~R3CR.
Figure 9-3 shows a open drain port configuration by control reg-
ister. It is selected as either push-pull port or open-drain port by
R0CR, R1CR, R2CR and R3CR.
Figure 9-3 Open Drain Port Structure
I : INPUT PORT
O : OUTPUT PORT
WRITE “55
H
” TO PORT R0 DIRECTION REGISTER
0
7
1
6
0
5
1
4
0
3
1
2
0
1
1
0
I
O
I
O
I
O
I
O
R0 DATA
R0 DIRECTION
R1 DATA
R1 DIRECTION
0C0H
0C1H
0C8H
0C9H
BIT
7
6
5
4
3
2
1
0
PORT
~
~
PULL-UP RESISTOR
Typ. 160k
PORT PIN
1: Connect
0: Disconnect
Pull-up control bit
VDD
GND
VDD
PORT PIN
1: Open drain
0: Push-pull
Open drain port selection bit
GND