English
Language : 

GMS81504 Datasheet, PDF (22/54 Pages) List of Unclassifed Manufacturers – CMOS SINGLE-CHIP 8-BIT MICROCONTROLLER
GMS81504
HYUNDAI MicroElectronics
I/O PORTS
The GMS81504/08 have five ports, R0, R1, R4, R5,
R6. These ports pins may be multiplexed with an
alternate function for the peripheral features on the
device. In general, when a initial reset state, all ports
are used as a general purpose input port.
All pins have data direction registers which can con-
figure these pins as output or input.
A "1" in the port direction register configures the
corresponding port pin as output. Conversely, write
"0" to the corresponding bit to specify as an input pin.
For example, to use the even numbered bit of R1 as
output ports and the odd numbered bits as input ports,
write "55H" to address C1H (R0 direction register)
during initial setting as shown in Figure 10.
WRITE "55H" TO PORT R0 DIRECTION REGISTER
C0H
C1H
:
C8H
C9H
R0 DATA
R0 DIRECTION
:
R4 DATA
R4 DIRECTION
01010101
7 6 5 4 3 2 1 0 BIT
IOIOIOIO
7 6 5 4 3 2 1 0 PORT
I: INPUT PORT
O: OUTPUT PORT
Figure 10. Example port I/O assignment
Reading data register reads the status of the pins
whereas writing to it will write to the port latch.
R0 and R0DD registers: R0 is a 8-bit bidirectional
I/O port (address C0H). Each pin is individually con-
figurable as input and output through the R0DD regis-
ter (address C1H).
Port 0 Data Register
ADDRESS: C0H
RESET VALUE: Undefined
R0 R07 R06 R05 R04 R03 R02 R01 R00
Input/ Output data
Port 0 Direction Register
ADDRESS: C1H
RESET VALUE: 00000000
R0DD R07 R06 R05 R04 R03 R02 R01 R00
Direction select
0: Input
1: Output
R4 and R4DD registers: R4 is an 8-bit bidirectional
I/O port (address C8H). Each pin is individually con-
figurable as input and output through the R4DD regis-
ter (address C9H).
In addition, Port R4 is multiplexed with various special
features. The control register PMR4 (address D0H)
controls to select alternate function. After reset, this
value is "0", port may be used as general I/O ports. To
select alternate function such as External interrupt or
External counter or Timer clock out, write "1" to the
corresponding bit of PMR4.
Port Pin
R40
R41
R44
R46
Alternate Function
INT0 (External Interrupt 0)
INT1 (External Interrupt 1)
EC0 (External Count Input to Timer/
Counter 0)
T1O (Timer 1 Clock-Out)
Regardless of the direction register R4DD, PMR4 is
selected to use as alternate functions, port pin can be
used as a corresponding alternate features.
Port 4 Data Register
ADDRESS: C8H
RESET VALUE: Undefined
R4 R47 R46 R45 R44 R43 R42 R41 R40
Input/ Output data
Port 4 Direction Register
ADDRESS: C9H
RESET VALUE: 00000000
R4DD R47 R46 R45 R44 R43 R42 R41 R40
Direction select
0: Input
1: Output
22