Heung-il Bae(hibae@hynix.com) , Byoung-jin Lim( bjinlim@hynix.com)
2001 Hynix Semiconductor Inc. All rights reserved.
Additional information of this manual may be served by Hynix Semiconductor offices in Korea or Distributors and Representatives listed at address directory.
Hynix Semiconductor reserves the right to make changes to any information here in at any time without notice.
The information, diagrams and other data in this manual are correct and reliable; however, Hynix Semiconductor is in no
way responsible for any violations of patents or other rights of the third party generated by the use of this manual.
HMS81C4x60
HMS81C4x60
CMOS SINGLE-CHIP 8-BIT MICROCONTROLLER
FOR TELEVISION
1. OVERVIEW
1.1 Description
The HMS81C4x60 is an advanced CMOS 8-bit micro controller with 60 K bytes of ROM. This is one of the HMS8 00 family.
This is a powerful microcontroller which provides a high flexibility and cost effective solution to many TV applications. The
HMS81C4x60 provides following standard features: 60K bytes of ROM, 1024 bytes of RAM, 8/16-bit timer/counter, onchip PLL oscillator and clock circuitry. In addition, there are othe r package types, HMS81C4360(32PDIP),
HMS81C4360SK(32SKDIP), HMS81C4 460 (42SDIP).
This document is explained for the base of HMS81C4x60, the eliminated functions are same as below.
- Character, Background color : 512 colors, 8 pallet
- Special functions : Rounding, Outline, Shadow,
Underline, Double scanned line OSD
• Buzzer Driving Port
- 500Hz ~ 250KHz @4MHz (Duty 50%)
• Vertical Blanking Interveral Information capture for EIA-608(Closed Caption) or VPS, etc
November 2001 Ver 1.11
HMS81C4x60
1.3 Development Tools
Note: There are several setting switches in the Emulator.
User should read carefully and do setting properly before
developing the program. Otherwise, the Emulator may not
work properly.
The HMS87C4x60 is sup po rte d b y a fu ll-f eat ured mac ro ass embler, an in-circuit emulator CHOICE-Dr.
grammers. There are two different type progra mmers such as
single type and gang type. For more de tail, refer to EP ROM Pro gramming chapter. Macro assembler operates under the MSWindows 95/98
Please contact sales part of Hynix Semiconductor.
TM
.
TM
and EPROM pro-
1.4 Ordering Information
Device na meROM Size (bytes)RAM sizePackage
Mask ROM versionHMS81C426060K bytes1024 bytes52SDIP
OTP ROM versionHMS87C426060K bytes EPROM (OTP)1024 bytes52SDIP
Mask ROM versionHMS81C4360SK60K bytes1024 bytes32SKDIP
OTP ROM versionHMS87C4360SK60K bytes EPROM (OTP)1024 bytes32SKDIP
Mask ROM versionHMS81C436060K bytes1024 bytes32PDIP
OTP ROM versionHMS87C436060K bytes EPROM (OTP)1024 bytes32PDIP
Mask ROM versionHMS81C446060K bytes1024 bytes42SDIP
OTP ROM versionHMS87C446060K bytes EPROM (OTP)1024 bytes42SDIP
Supply voltage...........................................-0.3 to +6.0 V
Storage Temperature ................................-40 to +125 °C
Voltage on any pin with respect to Ground (V
................................ ............................... -0.3 to V
SS
)
DD
+0.3
Maximum current out of Vss pin.........................160 mA
Maximum current into V
Maximum current sunk by(I
Maximum output current sourced by (I
pin ..........................160 mA
DD
per I/O Pin) .........20 mA
OL
per I/O Pin)
OH
.................................................................................8 mA
7.2 Recommended Operating Conditions
ParameterSymbolCondition
Supply Voltage
Operating Frequency
Operating Temperature
V
f
T
DD
XIN
OPR
VDD=4.5~5.5V
f
XIN
7.3 DC Electrical Characteristics
=4MHz
Maximum current (ΣI
Maximum current (ΣI
)....................................100 mA
OL
)......................................80 mA
OH
Note: Stresses above those listed under “Absolute Maximum Ratings” may cause per manent damage to the d evice. This is a stress ra ting only and functional ope r ati on of
the device at any oth er c ond iti ons ab ov e tho se ind ic ated in
the oper ati o na l se c ti ons of this s pe c ifi ca t io n i s no t i m pl ie d .
Exposure to absolute maximum rating conditions for extended periods may affect device reliability.
Analog Input Voltage Range
Overall AccuracyCAIN-Non Linearity ErrorNNLE-Differential Non Linearity ErrorNDNLE-Zero Offset ErrorNZOE-Full Scale Error NFSE-Gain Error NGE-Conversion Time TCONV
V
AN
f
MAIN
-
=4MHz
Min.Typ.Max.
VSS-0.3
Specifications
-
1.5
±
1.5
±
1.5
±
0.5
±
0.75
±
1.5
±
--15µS
VDD+0.3
2.5
±
2.5
±
2.5
±
2.0
±
1.0
±
2.0
±
Unit
V
LSB
November 2001 Ver 1.117
HMS81C4x60
7.6 Typical Characteristics
These graphs and tables are for design guidance only and
are not tested or guaranteed.
In some graphs or tables, the datas presented are outside specified operating range (e.g. outside specified
VDD range). This is for information only and devices
are guaranteed to operate properly only within the
specified range.
I
OH
(mA)
-16
-14
-12
-10
I
OH
70°C
-8
-6
-4
-2
0
V
−
OH
-20°C
25°C
2.03.0
, VDD=5.2V
4.0
5.0
V
(V)
OH
The data is a statistical summary of data collected on units
from different lots over a period of time. “Typical” represents the mean of the distribution while “max” or “min”
represents (mean + 3σ) and (mean − 3σ) r espectively
where σ is standard deviation
I
OL
(mA)
40
30
20
10
I
OL
-20°C
, VDD=5.2V
V
−
OL
25°C
70°C
1.03.02.0
4.0
V
(V)
OL
V
V
−
DD
Hysterisis
f
=4MHz
MAIN
Ta=25°C
44.5
IH
55.5
V
DD
(V)
6
V
V
−
DD
IH
V
IH1
f
=4MHz
MAIN
(V)
Ta=25°C
4
3
2
1
0
44.5
55.5
V
DD
(V)
6
V
IH2
(V)
4
3
2
1
0
18November 2001 Ver 1.1
HMS81C4x60
V
V
−
DD
V
V
−
DD
IL
V
V
IL1
f
=4MHz
MAIN
(V)
Ta=25°C
IL1
(V)
Hysterisis
f
=4MHz
MAIN
Ta=25°C
IL
3
2
1
44.5
Operating Area
f
MAIN
Ta= -20~70°C
(MHz)
(Main-clock)
6
5
4
3
2
1
0
44.555.56.5
55.5
6
3
2
V
DD
(V)
6
1
44.5
55.5
V
DD
(V)
6
Normal Mode (Main opr.)
I
V
−
DD1
I
DD
(mA)
60
50
40
30
V
(V)
DD
20
DD
Ta=25°C
f
=4MHz
MAIN
44.555.56
V
DD
(V)
November 2001 Ver 1.119
HMS81C4x60
8. MEMORY ORGANIZATION
The GMS81C4x60 has separate address spaces for Program memory, Data Memory and D isplay memory. Program memory can only be read, not written to. It can be up
8.1 Registers
This device has six registers that are the Program Counter
(PC), a Accumulator (A), two index registers (X, Y), the
Stack Pointer (SP), and the Program Status Word (PSW).
The Program Counter consists of 16-bit register.
A
X
Y
SP
PCLPCH
PSW
Figure 8-1 Configuration of Registers
Accumulator: The Accumulato r is the 8-bit gen eral purpose register, used for data operation such as transfer, temporary saving, and conditional judgement, etc.
The Accumulator can be used as a 16-bit register with Y
Register as shown below.
ACCUMULATOR
X REGISTER
Y REGISTER
STACK POINTER
PROGRAM COUNTER
PROGRAM STATUS
WORD
to 60K bytes of Program mem ory. Data memory can be
read and written to up to 1024 bytes including the stack area. Font memory has prepared 32K bytes for OSD.
Generally, SP is automatically updated when a subrout ine
call is executed or an interrupt is accepted. However, if it
is used in excess of the stack area permitted by the data
memory allocating configuration, the user-processed data
may be lost.
The stack can be located at any position within 0 0
to FF
H
of the internal data memory. The SP is not initialized by
hardware, requiring to write the initial value (the location
with which the use of the stack starts) by using the initialization routine. Normally, the initial value of “FF
H”
is
used.
Stack Address (00
15087
1
Hardware fixed
~ FFH)
H
SP
Caution:
The Stack Pointer must be initialized by software be-
cause its value is undefined after RESET.
Example: To initialize the SP
H
Y
YA
A
LDX#0FFH
TXSP; SP ← FFH
Program Counter: The Program Count er is a 16-bit wid e
Two 8-bit Registers can be used as a “YA” 16-bit Register
which consists of two 8-bit registers, PCH and PCL. This
counter indicates the address of the next instruction to be
Figure 8-2 Configuration of YA 16-bit Register
X, Y Registers: In the addressing mode which uses these
index registers, the register conten ts a re added to the specified address, which becomes the actual address. These
modes are extremely effective for referencing subroutine
tables and memory tables . The index regi sters also h ave increment, decrement, comparison and data transfer functions, and they can be used as simple accumulators.
Stack Pointer: The Stack Pointer is an 8-bit register used
for occurrence interrupts and calling out subroutines. Stack
Pointer identifies the location in the stack to be accessed
(save or restore).
executed. In reset state, the program counter has reset routine address (PC
:0FFH, PCL:0FEH).
H
Program Status Word: The Program Status Word (PSW)
contains several bits that reflect the current state of the
CPU. The PSW is described in Figure 8-3. It contains the
Negative flag, the Overflow flag, the Break flag the Half
Carry (for BCD operation), the Interrupt enable flag, the
Zero flag, and the Carry flag.
[Carry flag C]
This flag stores any carry or borrow from the ALU of CPU
after an arithmetic operation and is also changed by the
Shift Instruction or Rotate Instruction.
20November 2001 Ver 1.1
HMS81C4x60
[Zero flag Z]
This flag is set when the result of an arithmetic operat ion
MSBLSB
N
PSW
NEGATIVE FLAG
OVERFLOW FLAG
SELECT DIRECT PAGE
when g=1, page is addressed by RPR
BRK FLAG
Figure 8-3 PSW (Program Status Word) Register
VGBHIZC
[Interrupt disable flag I]
This flag enables/disables all interrupts except interrupt
caused by Reset or software BRK instruction. All interrupts are disabled when cleared to “0”. This flag immediately becomes “0” when an interrupt is served. It is set by
the EI instruction and cleared by the DI instruction.
or data transfer is “0” and is cleared by any other result.
RESET VALUE : 00
CARRY FLAG RECEIVES
CARRY OUT
ZERO FLAG
INTERRUPT ENABLE FLAG
HALF CARRY FLAG RECEIVES
CARRY OUT FROM BIT 1 OF
ADDITION OPERLANDS
H
This flag assigns RAM page for direct addressing mode. In
the direct addressing mode, addressing area is from zero
page 00
to 0FFH when this flag is "0". If it is set to "1",
H
addressing area is assigned by RPR register (address
0F3
). It is set by SETG instruction and cleared by CLRG.
H
[Overflow flag V]
[Half carry flag H]
After operation, this is set when there is a carry from bit 3
of ALU or there is no borrow from bit 4 of ALU. This bit
can not be set or cleared except CLRV instruction with
Overflow flag (V).
[Break flag B]
This flag is set by software BRK instruction to distinguish
BRK from TCALL instruction with the same vector address.
[Direct page flag G]
This flag is set to “1” when an overflow occurs as the result
of an arithmetic operation involving signs. An overflow
occurs when the result of an addition or subtraction ex-
ceeds +127 (7F
) or −128 (80H). The CLRV instruction
H
clears the overflow flag. There is no set instruction. When
the BIT instruction is executed, bit 6 of memory is copied
to this flag.
[Negative flag N]
This flag is set to match the sign bit (bit 7) status of the re-
sult of a data or arithmetic operation. When the BIT in-
struction is executed, bit 7 of memory is copied to this flag.
November 2001 Ver 1.121
HMS81C4x60
At execution of a
CALL/TCALL/PCALL
01BC
01BD
01BE
01BF
SP before
execution
SP after
execution
PCL
PCH
01BF
01BD
Push
down
01BC
01BD
SP before
execution
SP after
execution
01BC
01BD
01BE
01BF
At execution
of PUSH instruction
PUSH A (X,Y,PSW)
01BE
01BF
A
01BF
01BE
At acceptance
of interrupt
PSW
PCL
PCH
01BF
01BC
Push
down
Push
down
01BC
01BD
01BE
01BF
At execution
of RET instruction
01BC
01BD
01BE
01BF
At execution
of POP instruction
POP A (X,Y,PSW)
PCL
PCH
01BD
01BF
A
01BE
01BF
Pop
up
Pop
up
At execution
of RETI instruction
01BC
0100
01BF
PSW
H
H
01BD
01BE
01BF
PCL
PCH
01BC
01BF
Stack
depth
Pop
up
Figure 8-4 Stack Operation
22November 2001 Ver 1.1
8.2 Program Memory
HMS81C4x60
A 16-bit program counter is capable of addressing up to
64K bytes, but this device has 6 0K bytes program memory
space only physically implemented. Accessing a location
above FFFF
will cause a wrap-around to 0000H.
H
Figure 8-5 shows a map of Program Memory. After reset,
the CPU begins execution from reset vector which is stored
in address FFFE
and FFFFH as shown in Figure 8-6.
H
As shown in Figure 8-5, each area is assigned a fix ed location in Program Memory. Program Memory area contains
the user program.
1000
H
PROGRAM
FEFF
FF00
FFC0
FFDF
FFE0
FFFF
H
H
H
H
H
INTERRUPT
VECTOR ARE A
H
TCALL
AREA
MEMORY
PCALL
AREA
Example: Usage of TCALL
LDA#5
TCALL 15;
:;
:;
;
;TABLE CALL ROUTINE
;
FUNC_A: LDALRG0
RET
;
FUNC_B: LDALRG1
RET
;
;TABLE CALL ADD. AREA
;
ORG0FFC0H;
DWFUNC_A
DWFUNC_B
1BYTE INSTRUCTION
INSTEAD OF 2 BYTES
NORMAL CALL
1
2
TCALL ADDRESS AREA
The interrupt causes the CPU to jum p to specific location,
where it commences the execution of the service routine.
The External interrupt 1, for example, is assigned to location 0FFF8
interval: 0FFF6
0FFE8
Any area from 0FF00
. The interrupt service locations spaces 2-byte
H
and 0FFF7H for External Interru pt 2,
H
and 0FFE9H for External Interrupt 3, etc.
H
to 0FFFFH, if it is not going to be
H
used, its service location is available as general purpose
Program Memory.
Figure 8-5 Program Memory Map
Page Call (PCALL) area contains subroutine program to
reduce program byte length by using 2 bytes PCALL instead of 3 bytes CALL instruction. If it is frequently called,
it is more useful to save program byte length .
Table Call (TCALL) c auses the CPU to jump to each
TCALL address, where it commences the execution of the
service routine. The Table Call service area spaces 2-byte
for every TCALL: 0FFC0
;********************************************
; MAIN PROGRAM *
;********************************************
;
RESET:DI;Disable All Interrupts
CLRG
LDX#0
RAM_CLR:LDA#0;RAM Clear(!0000H->!00BFH)
STA{X}+
CMPX#0C0H
BNERAM_CLR
;
LDX#0FFH;Stack Pointer Initialize
TXSP
;
LDMPLLC,#0000_0101b;16MHz system clock
;
LDMR0, #0FFh;Normal Port 0
LDMR0DIR,#0FFh;Normal Port Direction
:
:
LDMTM0,#0000_0000B;timer stop
:
:
CALLVRAM_CLR;Clear VRAM
:
:
HMS81C4x60
November 2001 Ver 1.125
HMS81C4x60
8.3 Data Memory
Figure 8-8 shows the internal Data Memory space available. Data Memory is divided in to four groups, a user RAM,
control registers, Stack, and OSD memory.
0000H
00C0H
0100H
0200H
0300H
0400H
0440H
0500H
0600H
0700H
0A00H
0AC0H
0B00H
0BC0H
0C00H
RAM (192 bytes)
Peripheral Reg. (64 bytes)
RAM (256 bytes)
Stack area
RAM (256 bytes)
RAM (256 bytes)
RAM (64 bytes)
NOT USED
NOT USED
RAM (Slicer RAM)
( 256 Byte)
Not Used
OSD RAM (192 bytes)
Peripheral Reg. (32 bytes)
OSD RAM (192 bytes)
Peripheral Reg. (32 bytes)
NOT USED
Page0
Page1
Page2
Page3
Page4
Page5
Page6
PageA
PageB
in each peripheral section.
Note: Write only registers can not be accessed by bit manipulation instruction. Do not use read-modify-write instruction. Use byte manipulation instruction.
Example; To write at CKCTLR
LDMCKCTLR,#05H ;Divide ratio ÷ 8
Stack Area
The stack provides the area where the return address is
saved before a jump is performed during the processing
routine at the execution of a subroutine call instruction or
the acceptance of an interrupt.
When returning from the processing routine, execu ting the
subroutine return instruction [RET] restores the contents of
the program counter from the stack; ex ecuting the interrupt
return instruction [RETI] restores the contents of the program counter and flags.
The save/restore locations in the stack are determined by
the stack pointed (SP). The SP is automatically decreased
after the saving, and increased before the restoring. This
means the value of the SP indicates the stack location
number for the next save. Refer to Figure 8-4 on page 22.
0FFFH
Figure 8-8 Data Memory Map
User Memory
The GMS81C4x60 has 1,024 × 8 bits for the user memory
(RAM) except Peripheral Reg. (64 bytes) .
Control Registers
The control registers are used by the CPU and Peripheral
function blocks for controlling the desired operation of the
device. Therefore these registers contain control and status
bits for the interrupt system, the timer/ counters, analog to
digital converters and I/O ports. The control registers are in
address range of 0C0
to 0FFH.
H
Note that unoccupied addresses may not be implemented
on the chip. Read accesses to these addresses will in general return random data, and write accesses will have an indeterminate effect.
More detailed informations of each register are explained
1. "byte, bit" means that register can be addressed by not only bit
but byte manipulation instruction.
2. "byte" means that register can be addressed by only byte
manipulation instruction. On the other hand, do not use any
read-modify-write instruction such as bit manipulation for clearing bit.
byte, bit
byte, bit
byte, bit
byte, bit
byte, bit
byte, bit
byte, bit
byte, bit
-
-
-
-
-
-
-
-
-
-
-
-
-
-
byte, bit
byte, bit
byte, bit
byte
byte
byte
byte
byte
byte
byte
byte, bit
byte, bit
byte
byte, bit
byte, bit
byte, bit
byte
byte
byte
byte
byte
byte
byte
byte, bit
byte, bit
byte, bit
byte
byte
byte
byte
November 2001 Ver 1.127
HMS81C4x60
8.4 Addressing Mode
The GMS81C4x60 uses six addressing modes;
• Register addressing
• Immediate addressing
• Direct page addressing
• Absolute addressing
• Indexed addressing
• Register-indirect addressing
(1) Register Addressing
Register addressing accesses the A, X, Y, C and PSW.
(2) Immediate Addressing → #imm
In this mode, second byte (operand) is accessed as a data
immediate ly.
Example:
FE0435ADC#35
MEMORY
H
04
35
A+35H+C → A
(3) Direct Page Addressing → dp
In this mode, a address is specified within direct page.
Example; G=0
E551: C535 LDA 35
35
H
data
H
;A ←RAM[35H]
À
0E550
0E551
~
~
H
H
C5
35
~
~
data → A
þ
þ : direct page
(4) Absolute Addressing → !abs
Absolute addressing sets corresponding memory data to
Data, i.e. second byte (Operand I) of command bec omes
lower level address and third byte (Operand II) becomes
upper level address.
With 3 bytes command, it is possible to access to whole
memory area.