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.
Page 3
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
Page 4
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
Page 20
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
Page 21
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
Page 22
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
Page 23
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
Page 24
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
Page 25
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
Page 28
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
Page 30
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.
This address value is the second byte (Operand) of command plus the data of Y-register, which assigns Memory in
Direct page.
This is same with above (2). Use Y register instead of X.
Y indexed absolute → !abs+Y
Sets the value of 16-bit absolute address plus Y-register
data as Memory. This addressing mode can specify memory in whole area.
Example; Y=55
F100: D500FA LDA !0FA00H+Y
0F100
0F101
0F102
0FA55
H
H
H
H
H
D5
00
FA
~
~
data
þ
0FA00H+55H=0FA55
~
~
H
À
data → A
Ã
FA00: 3F35 JMP [35H]
0E30A
0FA00
35
H
36
H
~
~
H
H
0A
E3
jump to address 0E30A
À
~
~
NEXT
~
~
3F
35
~
~
þ
H
X indexed indirect → [dp+X]
Processes memory data as Data, assigned by 16-bit pair
memory which is determined by pair data
[dp+X+1][dp+X] Operand plus X-register data in Direct
page.
ADC, AND, CMP, EOR, LDA, OR, SBC, STA
(6) Indirect Addressing
Direct page indirect → [dp]
Assigns data address to use for accomplishing command
which sets memory data (or pair memory) by Operand.
Also index can be used with Index register X,Y.
JMP, CALL
Example; G=0
Example; G=0, X=10
H
FA00: 1625 ADC [25H+X]
0E005
0FA00
35
H
36
H
~
~
H
~
~
H
05
E0
data
16
25
~
~
~
~
À
0E005
H
25 + X(10) = 35
þ
A + data + C → A
Ã
H
30November 2001 Ver 1.1
Page 33
HMS81C4x60
Y indexed indirect → [dp]+Y
Processes memory data as Data, assigned by the data
[dp+1][dp] of 16-bit p air memory paired by Operan d in Direct page plus Y-register data.
The program jumps to address specified by 16-bit absolute
address.
JMP
Example; G=0
FA00: 1F25E0 JMP [!0E025H]
PROGRAM MEMORY
0E025
H
0E026
H
~
~
0E725
0FA00
H
~
~
H
þ
25
E7
NEXT
1F
25
E0
~
~
~
address 0E725
H
jump to
À
~
November 2001 Ver 1.131
Page 34
HMS81C4x60
9. I/O PORTS
The HMS81C4x60 has 5 ports (R0, R1, R2, R3 and R4)
and OSD ports (R,G,B,YS,YM). These ports pins may be
multiplexed with an alternatefunction for the p eripheral
9.1 Registers for Port
Port Data Registers
The Port Data Registers (R0, R1, R2, R3, R4) are represented as a D-Type flip-flop, which will clock in a value
from the internal bus in response to a “write t o 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” signal from the CPU. Some inst ructions that read a
port activating the “read register” signal, and others activating the “read pin” signal.
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 specif y it
as input pin. For example, to use the even numbered bit of
R0 as output ports and the odd numbe red bits as input
ports, write “55
” to address 0C1H (R0 port direction reg-
H
features on the device. In general, in an initial reset state,
R ports are used as a general purpose digital port.
ister) during initial setting as sho w n in Figure 9-1.
All the port direction registers in the HMS81C 4x60 have
been written to zero by reset function. On the other hand,
its initial status is input.
WRITE “55
0C0
H
R0 DATA
0C1
R0 DIRECTION
H
~
~
0C8
0C9
H
R4 DIRECTION
H
R4 DATA
Figure 9-1 Example of port I/O assignment
” TO PORT R0 DIRECTION REGISTER
H
0 1 0 1 0 1 0 1
76543210
~
~
0 1 0 1 0 1 0 1
76543210
I O I O I O I O
76543210
I : INPUT PORT
O : OUTPUT PORT
BIT
BIT
PORT
32November 2001 Ver 1.1
Page 35
9.2 I/O Ports Configuration
HMS81C4x60
R0 Ports
R07 ~ R04 is an open drain bidirectional I/O port and R0 3
~ R00 is a CMOS bidirectional I/O port(a ddress 0C0
H
Each I/O pin can independently used as an input or an output through the R0DD register (address 0C1
).
H
The control registers for R0 are shown below.
R0 Data Register
R/W
R0
R0 Direction Register
R07
R0DD
R/W
R06
R/W
R05
Port Direction
0: Input
1: Output
ADDRESS : 00C0
RESET VALUE : Undefined
R/W
R/W
R04
R/W
R03
R02
ADDRESS : 00C1
RESET VALUE : 0000 0000
WWWWWWWW
R/W
R01
H
R/W
R00
H
b
R1 Ports
R1 is a 5-bit CMOS inpu t port only(ad dress 0C2
). Each
H
pin can independently used as an input through the R1DD
register (address 0C 3
). User can use R0DD register when
H
its bit is 0 only. The control registers for R1 are shown below.
Port R1 is multiplexed with various special features.The
control registers controls the selection of alternate function. After reset, this value is “0”, port may be used as normal input port. The way to select alternate function such as
comparator input will be shown in each peripheral section.
In addition, R1 port is used as key scan function which operate with normal input port.
Input or output is configured automatically by each function register (KSMR) regardless of R1DD.
R2 Port
R2 is a 6-bit CMOS bidirectional I/O port (addres s 0C4
).
H
Each I/O pin can independently used as an input or an output through the R2DD register (address 00C5
).The con-
H
trol registers for R2 are shown below.
R2 Data Register
R/WR/W
R/WR/W
R2
R2 Direction Register
R2DD
-
WWWWWW
R25
FUNC
MSBLSB
FUNC.5 ~ FUNC.1
0 : R2 Port
1 : INT mode, EC mode
ADDRESS : 00C4
RESET VALUE : Undefined
R/W
R/W
R23
R24
ADDRESS : 00C5
RESET VALUE : 0000 0000
WWWW-WW
Port Direction
0: Input
1: Output
ADDRESS: 00CE
INITIAL VALUE: 0000 0000
R/W
R22
INT 2 SINT 3 SEC2SEC3S--1
H
R/W
R21
R20
H
WW
H
WW
IN T1S
user must set 1
b
b
R1 port also can use the value bit5 ~ bit0 of AIPS register
to secondary function register. R1 port have secondary
R2 port also use the value bit5 ~ bit1 of FUNC register to
secondary function register. R2 port have seco ndary func-
As shown in Figure 10-1 , the clock generation Circuit con sist PLL that generate multiplicated frequency of Crystal
clock, Generation Circuit which create CPU clock, Prescaler which generate input clock of Basic Interval Timer
and variable hardware clock, Basic Interval timer which is
OSC
Circuit
PLL
ENPCK
8
0705
MUXBasic Interval Timer(8)Watch Dog Timer(6)
Clock Pulse Gene rator
PRESCALER (11)
BTCL
generate standard time, Wat ch Dog Timer wh ich i s pr otect
Software Overflow.
See “12.1 BASIC INTERVAL TIMER” on pag e for details.
Data Slicer Clock
OSD Clock
Internal System Clock
(16MHz typical)
Peripheral Circuit
11
IFBIT
WDTCL
6
CKCTRL
012345
6
8
Internal DATA BUS
10.1 Clock Generation Circuit
The clock signal come from crystal oscillator or ceramic
via Xin and Xout or from external clock via Xin is supplied
to Clock Pulse Generator and Prescaler.
Internal System Clock for CPU is made by Clock Pulse
COMPARATOR
6
WDTON
056
WDTRWDTCL
7
Generator, and several peripherial clock is divided by prescaler.
Clock Generation circuit of Crystal Oscillator or Ceramic
Resonator is shown as below.
IFWDT
to RESET
CIRCUIT
November 2001 Ver 1.135
Page 38
HMS81C4x60
Xout
Cout
GND
Xin
Cin
Figure 10-1 Cristal Oscillator or Ceramic Resonator
10.2 Phase Locked Loop
PLL(Phase Locked Loop) from OSC 4MHz clock circuit
generate Internal Syste m clock, Timer clock(PS0 ), Data
Figure 10-3 PLL Control Register
WWWWWW
PCF1PCF2----PLLON
PLLC
MSBLSB
PCF0
Slicer Clock, OSD clock, etc.
WW
Xout
Xin
Open
External Clock
Figure 10-2 External Clock
ADDRESS: 00CF
INITIAL VALUE: -000 0000
PLL clock freque nc y
0 : Off PLL
1 : On PLL, in the case system clock supply OSD circuit
The HMS81C4x60 interrupt circuits consist of Interrupt
enable register (IENH, IENL), Interrupt request flags of
IRQH and IRQL, Priority circuit and Master enable flag
("I" flag of PSW). 16 interrupt sources are provided. The
configuration of interrupt circuit is shown in Figure 11-2.
The External Interrupts can be transition-activated (1-to-0
or 0-to-1 transition).
When an external interrupt is generated, the flag that generated it is cleared by the hardware when the service routine is vectored to only if the interrupt was transitio nactivated.
The Timer/Counter Interrupts are generated by
TnIF(n=0~3), which is set by a matc h in their respect ive
timer/counter register.
The Basic Interval Timer Interrupt is generated by BITIF
which is set by a overflow in the timer register.
The interrupts are controlled by the interrupt master enable
flag I-flag (bit 2 of PSW), that is the interrupt enable register (IENH, IENL) and the interrupt request flags (in
IRQH,IRQL) except Power-on reset and software BRK interrupt.
Interrupt Mode Register
It controls interrupt priority. It takes only one specified interrupt.
Of course, interrupt’s priority is fixed by H/W, but sometimes user want to get specified interrupt even if higher
priority interrupt was occured. Higher priority interrupt is
occured the next time.
It contains 2bit data to enable priority selection and 4bit
data to select specified interrupt.
I-flag is i n PSW, it is c le a re d b y " DI", s e t by
"EI" in s t ru c tio n . When it g o e s i n te rr u p t s erv ice,
I-flag is cleared by hardware, thus any other
interrup t are inhibited. W hen interrupt service is
co mp le ted by "RET I" in s tru c ti o n , I- fla g is s e t to
"1" by h a rd ware .
Interrupt
Vector
Address
Generator
IENL [00F4H]
Interrupt Enable
Register (Lower byte)
Internal bus line
Figure 11-2 Block Diagram of Interrupt
November 2001 Ver 1.139
Page 42
HMS81C4x60
Interrupt request flag registers are shown in Figure 11-3.
Interrupt request is generated when suitab le bit is s et, and
suitable request flag of accepted interrup is clear when interrupt processing cycle. Suitable bit is set when interrupt
OSD
T3
R/W
R/WR/W
INT2
R/W
R/W
INTV
WDT
R/W R/WR/W
IRQH
IRQL
-
MSBLSB
R/W R/WR/W R/W R/W
T1
MSB
T0
R/W R/W
T2INT1
-
SLICE
I2CBIT
request is occured, but no accepted request flag is set to
hold when the interrupt is accepted. Also, interrupt req uest
flag register(IRQH, IRQL) is the register of read or write.
So, request flag can be changed by program.
VSync
-
ADDRESS: 00F7
INITIAL VALUE: 0000 0000
VSync interrupt request flag
Slicer interrupt request flag
Timer / Counter 2 interrupt request flag
Timer / Counter 0 interrupt request flag
External interrupt 2 interrupt request flag
External interrupt 1 interrupt request flag
On screen display interrupt request flag
ADDRESS: 00F5
INITIAL VALUE: 0000 000-
LSB
2
C interrupt request flag
I
H
b
H
b
Basic interval timer interrupt request flag
Watch-dog timer interrupt request flag
Interrupt interval measurement interrupt request flag (INT3/4)
Timer / Counter 3 interrupt request flag
Timer / Counter 1 interrupt request flag
Figure 11-3 Interrupt Request Flag Registers
40November 2001 Ver 1.1
Page 43
HMS81C4x60
Interrupt enable flag registers are shown in Figure 11 -4.
These registers are composed of interrupt enable flags of
each interrupt source , these flags determi nes whether an
interrupt will be accepted or not. When enable flag is "0",
OSD
T3
R/W
R/WR/W
INT2
R/W
R/W
INTV
WDT
R/W R/WR/W
IENH
IENL
-
MSBLSB
R/W R/WR/W R/W R/W
T1
MSB
T0
R/W R/W
T2INT1
-
SLICE
I2CBIT
a corresponding interrupt source is prohibited. Note that
PSW contains also a master enable bit, I-flag, which disables all interrupts at once.
VSync
-
ADDRESS: 00F6
INITIAL VALUE: 0000 0000
VSync interrupt enable flag
Slicer interrupt enable flag
Timer / Counter 2 interrupt enable flag
Timer / Counter 0 interrupt enable flag
External interrupt 2 interrupt enable flag
External interrupt 1 interrupt enable flag
On screen display interrupt enable flag
ADDRESS: 00F4
INITIAL VALUE: 0000 000-
LSB
2
C interrupt enable flag
I
H
b
H
b
Basic interval timer interrupt enable flag
Watch-dog timer interrupt enable flag
Interrupt interval measurement interrupt enable flag (INT3/4)
Timer / Counter 3 interrupt enable flag
Timer / Counter 1 interrupt enable flag
Figure 11-4 Interrupt Enable Flag Regesters
November 2001 Ver 1.141
Page 44
HMS81C4x60
11.1 Interrupt Sequence
An interrupt request is held until the interrupt is accepted
or the interrupt latch is cleared to "0" by a reset or an instruction. Interrupt acceptance sequence requires 8 f
µs at f
=4MHz) after the completion of the curr ent in -
MAIN
(2
ex
struction execution. The interrupt service task terminates
upon execution of an interrupt return instruction [RETI].
Interrupt acceptance
1. The interrupt master enable flag (I-flag) is cleared to
"0" to temporarily disable the acceptance of any following maskable interrupts. When a non-maskable interrupt is accepted, the acceptance of any following
interrupts is temporarily disabled.
System clock
Instruction Fetch
2. Interrupt request flag for the in ter rup t source accep ted
is cleared to "0".
3. The contents of the program counter (return address)
and the program status word are saved (pushed) onto
the stack area. The stack pointer decrements 3 times.
4. The entry address of the interrupt service program is
read from the vector table address, and the entry address is loaded to the program counter.
5. The instruction stored at the entry address of the interrupt service program is executed.
Address Bus
Data Bus
Internal Read
Internal Write
V.L. and V.H. are vector addresses.
ADL and ADH are start addresses of interrupt service routi ne as vector contents.
PC
Not used
SPSP-1
PCHPCL
Interrupt Processing StepInterrupt Service Task
SP-2V.H.New PC
PSWADLOP codeADH
Figure 11-5 Interrupt Service routine Entering Timing
V.L.
V.L.
42November 2001 Ver 1.1
Page 45
Basic Interval Timer
Vector Table Address
012
0FFE6
H
0FFE7
H
Correspondence between vector table address for BIT interrupt
and the entry address of the interrupt service program.
0E3
H
H
0E312
0E313
Entry Address
0E
H
2E
H
H
H
A maskable interrupt is not accepted until the I-flag is set
to "1" even if a maskable interrupt of higher priority than
that of the current interrupt being serviced.
HMS81C4x60
General-purpose register save/restore using push and pop
instructions;
main task
acceptance of
interrupt
interrupt return
interrupt
service task
saving
registers
restoring
registers
When nested interrupt service is necessary, the I-flag is set
to "1" in the interrupt service program. In this case, acceptable interrupt sources are selectively enabled by the individual interrupt enable flags.
Saving/Restoring General-purpose Register
During interrupt acceptance processing, the program
counter and the program status word are automatically
saved on the stack, but not the accumulator and other registers. These registers are saved by the program if necessary. Also, when nesting multiple interrupt services, it is
necessary to avoid using the same data memor y area for
saving registers.
The following method is used to save/restore the generalpurpose registers.
Example: Register save using push and pop instructions
INTxx:PUSHA
PUSHX
LDADPGR
PUSHA
;SAVE ACC.
;SAVE X REG.
;SAVE DPGR
; Direct page
; accessable reg.
;
11.2 BRK Interrupt
Software interrupt can be invoked by BRK instruction,
which is the lowest priority order.
Interrupt vector address of BRK is shared with the vector
of TCALL 0 (Refer to Program Memory Section). When
BRK interrupt is generated, B-flag of PSW is set to distinguish BRK from TCALL 0.
Each processing step is determined by B-flag as shown in
Figure 11-6.
=0
=1
TCALL0
ROUTINE
RET
BRK or
TCALL0
B-FLAG
BRK
INTERRUPT
ROUTINE
RETI
interrupt processing
:
:
Figure 11-6 Execution of BRK/TCALL0
POPA
STADPGR
POPX
POPA
RETI
;RESTORE DPGR
;RESTORE X REG.
;RESTORE ACC.
;RETURN
November 2001 Ver 1.143
Page 46
HMS81C4x60
11.3 Multi Interrupt
If two requests of different priority levels are received simultaneously, the request of higher priority level is serviced. If requests of the same priority level are received
simultaneously, an internal polling sequence determines
by hardware which request is serviced.
Main Program
service
Occur
TIMER1 interrupt
Occur
INT0
TIMER 1
service
enable INT0
disable other
EI
enable INT0
enable other
INT0
service
However, multiple processing through software for special
features is possible. Generally when an interrupt is accepted, the I-flag is cleared to disable any further interru pt. But
as user set I-flag in interrupt routine, some further interrupt
can be serviced even if certain interrupt is in progress.
Example: Even though Timer1 interrupt is in progress,
INT0 interrupt serviced without any susp end.
TIMER1: PUSHA
PUSHX
PUSHY
LDMIENH,#20H;
LDMIENL,#0;
EI;
:
:
:
:
:
:
LDMIENH,#FFH;
LDMIENL,#FEH
POPY
POPX
POPA
RETI
Enable INT1 only
Disable other
Enable Interrupt
Enable all interrupts
In this example, the INT0 interrupt can be serviced without any
pending, even TIMER1 is in progress.
Because of re-setting the interrupt enable registers IENH,IENL
and master enable "EI" in the TIMER1 routine.
Figure 11-7 Execution of Multi Interrupt
44November 2001 Ver 1.1
Page 47
11.4 External Interrupt
HMS81C4x60
The external interrupt on INT1, INT2... pins are edge triggered depending the edge selection register.
Refer to “6. PORT STRUCTURES” on page 12.
The edge detection of external interrupt has three transition
activated mode: rising edge, falling edge, both edge.
INT1 pin
INT2 pin
INT3 pin
[00F2
edge selection
IEDS
]
H
INT1IF
INT2IF
INT3IF
INT1 INTERRUPT
INT2 INTERRUPT
INT3 INTERRUPT
INT1, INT2 and INT3 are multiplexed with general I/O
ports. To use external interrupt pin, the bit of port function
register FUNC1 should be set to "1" correspondingly.
Response Time
The INT1, INT2 and INT3 edge are latched into INT1IF,
INT2IF and INT3IF at every machine cycle. The values
are not actually polled by the circui try until the next machine cycle. If a request is active and conditions are right
for it to be acknowledged, a hardware subroutine call to the
requested service routine will be the next instruction to be
executed. For example, the DIV instruction takes twelve
machine cycles. Thus, a minimum of twelve complete machine cycles elapse between activation of an external interrupt request and the beginning of execution of the first
instruction of the service routine
Figure 11-8 External Interrupt Block Diagram
System clock
Instruction Fetch
Last instruction execution (0~12cycle)Enter interrupt service routine (8cycle)
The HMS81C4x60 has one 8-bit Basic Interval Timer that
is free-run and can not be stopped. Block diagram is shown
in Figure 12-1.
The Basic Interval Timer generates the time base for
watchdog timer counting, and etc. It also provides a Basic
interval timer interrupt (BITIF). As the count overflow
from FF
to 00H, this overflow causes th e interrupt to be
H
4
f
2
PS4
PS5
PS6
PS7
PS8
PS9
PS10
PS11
Clock control register
ex
f
ex
f
ex
f
ex
f
ex
f
ex
f
ex
f
÷
ex
Select Input clock
[0D6H]
CKCTLR
÷
5
2
÷
6
2
÷
7
2
÷
8
2
÷
9
2
÷
10
2
÷
11
2
WDT
ON
source
clock
MUX
BITCK
3
ENPCK BTCL BTS2 BTS1 BTS0
8-bit up-counter
[0D6
Internal bus line
]
H
BITR
clear
BTCL
generated. The Basic Interval T imer is controlled by the
clock control register (CKCTLR) shown in Figure 12-2.
Source clock can be selected by lower 3 bits of CKCTLR.
BITR and CKCTLR are located at same address, and ad-
dress 00D6
overflow
is read as a BITR and written to CKCTLR..
H
BITIF
Basic Interval Timer Interrupt
Watchdog timer clock (WDTCK)
Caution
WWWWWW
CKCTLR
MSBLSB
:
Both register are in same address,
when write, to be a CKCTLR,
when read, to be a BITR.
Timer 0, 1 consists of prescaler, multiplexer, 8-bit compare
data register, 8-bit count register, Control register, and
Comparator as shown in Figure 12-3 and Figure 12-4.
These Timers can run separated 8bit timer or combined
16bit timer. These timers are operated by internal clock.
The contents of TDR1 are compared with the contents of
up-counter T1. If a match is f ound, a t imer /coun ter 1 in terrupt (T1IF) is generated, an d the counter is cleared. C ounting up is resumed after the counter is cleared.
R/W R/W R/W R/W R/W R/W
TM0
MSBLSB
T0CNT0STT1SL0T1SL1T1ST-T0SL0
Note: You can read Timer 0, Timer 1 value from TDR0 or
TDR1. But if you write data to TDR0 or TDR1, it changes
Timer 0 or Timer 1 modulo data, not Timer value.
The content of TDR0, TDR1 must be initiali zed (by software) with the value between 01
and FFH,not to 00H.
H
Or not, Timer 0 or Timer 1 can not count up forever.
The control registers for Timer 0,1 are shown below.
LDMTDR1,#0
LDMTM0,#0011_1101b; 4uSEC PRESCALER FOR T0
:
:
November 2001 Ver 1.147
Page 50
HMS81C4x60
.
TM0TDR0
Internal bus line
TDR1
PS2
PS4
PS6
PS8
NC
PS2
PS4
PS6
TDR0
T0CN
Timer 0
MUX
Clock
T0ST
MUX
T1ST
8bit Comparator
T0IF
Figure 12-4 Simplified Block Diagram of 8bit Timer0, 1
disable
clear & start
stop
~
~
~
~
8bit Comparator
T1IF
Timer 1
ClockClearClear
enable
up-count
TIME
Timer 0 (T0IF)
Interrupt
T0ST
Start & Stop
T0CN
Control count
Occur interruptOccur interrupt
T0ST = 1
T0ST = 0
T0CN = 1
T0CN = 0
Figure 12-5 Count Example of Timer
48November 2001 Ver 1.1
Page 51
TM0TDR0
00
T0CN
HMS81C4x60
Internal bus line
TDR1
16bit Comparator
T1IF
PS2
PS4
PS6
PS8
Timer 0
MUX
Clock
T0ST
Figure 12-6 Simplified Block Diagram of 16bit Timer0, 1
Timer 1
ClockClearClear
November 2001 Ver 1.149
Page 52
HMS81C4x60
12.3 Timer / Event Counter 2, 3
Timer 2, 3 consists of prescaler, multiplexer, 8-bit compare
data register, 8-bit count register, Control register, and
Comparator as shown in Figure 12-7 and Figure 12-8.
These Timers have two operating modes. One is the timer
mode which is operated by internal clock, other is event
counter mode which is opera ted by external cloc k from pin
R24/EC2, R25/EC3.
These Timers can run separated 8bit timer or combined
16bit timer.
R/W R/W R/W R/W R/W R/W
TM2
MSBLSB
T3CNT3STT3SL0T3SL1T3 ST-T3SL0
Note: You can read Timer 2, Timer 3 value from TDR2 or
TDR3. But if you write data to TDR2 or TDR3, it changes
Timer 2 or Timer 3 modulo data, not Timer value.
The content of TDR2, TDR3 must be initiali zed (by software) with the value between 01
and FFH,not to 00H.
H
Or not, Timer 2 or Timer 3 can not count up forever.
The control registers for Timer 2,3 are shown below
Figure 12-8 Simplified Block Diagram of 8bit Timer/Event Counter 2,3
disable
enable
8bit Comparator
T3IF
Timer 2 (T2IF)
Interrupt
T2ST
Start & Stop
T2CN
Control count
clear & start
stop
~
~
Occur interruptOccur interrupt
T2ST = 1
T2ST = 0
~
~
up-
T2CN = 1
T2CN = 0
Figure 12-9 Count Example of Timer / Event counter
unt
co
TIME
November 2001 Ver 1.151
Page 54
HMS81C4x60
TM2TDR2
00
T0CN
Internal bus line
TDR3
16bit Comparator
T3IF
EC2
PS4
PS6
PS8
MUX
Timer 2
Clock
T0ST
Figure 12-10 Simplified Block Diagram of 16bit Timer/Event Counter 2,3
Timer Mode
In the timer mode, the internal clock is used for counting
up. Thus, you can think of it as counting internal clock input. The contents of TDRn (n=0~3) are compared with the
contents of up-counter, Tim er n. I f mat ch is fou nd , a t ime r
Start count
Source clock
Up-counter
TDRn (n=0~3)
TnIF (n=0~3) interrupt
0
12 3
N
Timer 3
ClockClearClear
n interrupt (TnIF) is generated and the up-counter is
cleared to 0. Counting up is resumed after the up-counter
is cleared.
As the value of TDRn is changeable by software, time interval is set as you want
~
~
~
~
~
~
~
~
~
~
~
~
N-2
N-1
Match
Detect
N
U
14
0
Counter
Clear
2
3
Figure 12-11 Timer Mode Timing Chart
Event Counter Mode
In event timer mode, counting up is started by an external
trigger. This trigger means falling edge of the ECn (n=0~1
) pin input. Source clock is used as an internal clock selected with TM2. The contents of TDRn are comp ared with the
contents of the up-cou nter. If a match is fo und, an TnIF interrupt is generated, and t h e coun ter is cleared to 00
. The
H
counter is restarted by the falling edge of the ECn pin in-
put.
The maximum frequency applied to the ECn pin is f
ex
[Hz] in main clock mode.
In order to use event counter fun ction, the bit EC0S, EC 1S
of the Port Function Se lect Regist er FUNC(address 0CE
H
is required to be set to "1".
After reset, the value of TDRn is undefined, it should be
52November 2001 Ver 1.1
/2
)
Page 55
initialized to between 01H~FF
ECn (n=2~3) pin
Up-counter
TDRn (n=2~3)
S
not to 00HU
H
Start count
0
HMS81C4x60
~
~
~
~
1
N
2
~
~
~
~
~
~
N-1
0N
1
2
TnIF (n=2~3) interrupt
Figure 12-12 Event Counter Mode Timing Chart
The interval period of Timer is calculated as below eq uation.
1
------
Prescaler× ratio
=
Period
TDR2
Timer 2 (T2IF)
Interrupt
f
ex
~
~
Occur interruptOccur interruptOccur interrupt
TDR×n
1
0
TDR2=n
up
3
2
coun
-
4
t
7
6
5
~
~
n
n-1
n-2
~
~
8
P
CP
Interrupt period
= P
x n
CP
~
~
TIME
Figure 12-13 Count Example of Timer / Event counter
November 2001 Ver 1.153
Page 56
HMS81C4x60
TDR2
Timer 2 (T2IF)
Interrupt
T2ST
Start & Stop
T2CN
Control count
disable
clear & start
stop
~
~
Occur interruptOccur interrupt
T2ST = 1
T2ST = 0
enable
~
~
T2CN = 1
T2CN = 0
Figure 12-14 Count Operation of Timer / Event counter
up-
unt
co
TIME
54November 2001 Ver 1.1
Page 57
13. A/D Converter
HMS81C4x60
The A/D converter circuit is shown in Figure 13-1.
The A/D converter circuit consists of the comparator and
control register AIPS(00EF
ADR(00F1
). The AIPS register select normal port or an-
H
Data Bus
ADCM [F0
]
H
AN0
AN1
AN2
AN3
AN4
), ADCM(00F0H),
H
5
ADEN ADS2 ADS1 ADS0 ADST ADSF
Control circuit
port
select
MUX
0
S/H
alog input. The ADCM registe r control A/D converter’s
activity. The ADR register stores A/D converted 8bit result. The more details are shown Figure 13-2.
8
ADR [F1H]
Comparator
Vref
Register ladder
+
−
0 1 2 3 4 5 6 7
8
IFA
Succesive
Approximation
Circuit
8
Figure 13-1 Block Diagram of A/D convertor circuit
Control
The HMS81C4x60 contains a A/D converter module
which has six analog inputs.
1. First of all, you h ave to select an alog input pin by set the
ADCM and AIPS.
2. Set ADEN (A/D enable bit : ADCM bit5).
3. Set ADST (A/D start bit : ADCM bit1). We recommend
you do not set ADEN and ADST at once, it makes worse
A/D converted result.
4. ADST bit will be cleared 1 cycle automatically after you
set this.
[Example]
;Set AIPS, change ? to what you want
;0 : digital port
;1 : analog port
LDM AIPS,#0000_1000b
; Set ADEN, xxx is analog port number
LDM ADCM,#0010_1100b
; or “SET1 ADEN”
; Set ADST, xxx is analog port number
LDM ADCM,#0010_11110b
BBC ADCM.ADSF,$
LDA ADR
; or “SET1 ADST”
:
:
5. After A/D conversion is completed, ADSF bit and inter-
rupt flag IFA will be set. (A/D conversion takes 36 machine cycle : 18uS when f
Note: Make sure AIPS bits, if you usin g a port which is set
digital input by AIPS, analog voltage will be flow into MCU
internal logic not A/D converter. Sometimes device or port
is damaged permanently.
5. CNTB controls all PWM counter enable.
If CNTB=0, than Counter is disabled.
14bit PWM Control
1. 14bit PWM’s operation concept is not the same as 8bit
PWM.
1 PWM frame contains 64 sub PWMs.
PWM5H : Set sub PWM’s basic Pulse Width.
PWM5L : Number of sub PWM wh ich i s added 1 clock.
2. PWM polarity is selected by POL1’s value.
If POL1=0, Positive Polarity.
3. Calulate Frame cycle and Pulse width is as following.
Main PWM Frame Cycle = 2
The HMS81C4x60 can support 512 OSD chacters and font
size is used 12×10, 12×12, 12×14, 12×16, 16×18. It can
support 48 character columns and 2 line buffers resp ectively and also support full screen OSD whe n use interrupt.
Each characters have bit plane of 24bit and support attribute with OSD line and full screen OSD respectively.
OSD circuit consists of the Position attribute register, Line
register, Full screen screen control register, I/O polarity
register, font ROM, VRAM, etc. On Screen Display block
diagram is shown in Fig ure 17-1 and the more detai ls about
display characters are shown in Figure 17-2.
Display On/Off Control
register
Field detection register
FDWSET [AE3H]
Edge color register
EDGECOL [AE4
]
H
I/O Porarity Rigister
OSDCON3 [AE2H]
DACColor Pallet
R
G
B
HSYNC
VSYNC
Font ROM
Synchronization
Circuit
VRAM
Output
OSD Generation Circuit
dot clock
Xin
PLL
Control
Circuit
Figure 17-1 Block Diagram of On Screen Display circuit
YS
YM
November 2001 Ver 1.165
Page 68
HMS81C4x60
[12 × 10 Character Font]
[12 × 12 Character Font]
- italic (only 12 × 12 mode can be supported)
[12 × 14 Character Font]
Foreground Character
- 512 color (8 pallet)
- color selecting : VRAM n-character bit 19~16
Background
- 512 color (8 pallet)
- color selecting : VRAM n-character bit 23~20
Foreground Character outline
- setting by LnATTR register
- color selecting : EDGECOL register
[12 × 16 Character Font]
Character shadow
- setting by LnATTR register and VRAM n-character bit 9
- color selecting : EDGECOL register
Background shadow color
- setting by VRAM n-character bit 15~12
- color selecting : EDGECOL register
- 512 color (8 pallet)
[16 × 18 Character Font]
OSD background shadow
- Character flash
- background underline
Figure 17-2 OSD Character Font Example
66November 2001 Ver 1.1
Page 69
17.1 Feature of OSD
HMS81C4x60
The Feature of OSD shown in below.
- Font pixel matrix
: 12×10, 12×12, 12×14, 12× 16, 16× 18 dots
- The number of font pattern
: 512 fonts
- Display ability
: 48Character × n lines (multilined by OSD interrupt)
- 8 foreground pallet of 512 colors for each character
- 8 background pallet of 512 colors for each character
0000 : Transparency
0001 : Half blank
0010 : white
0011 : Black
0111 ~ 0100 : Reserved
1000 : color 0
1001 : color 1
1010 : color 2
1011 : color 3
1100 : color 4
1101 : color 5
1110 : color 6
1111 : color 7
H
b
Figure 17-3 OSD Control Registers - 1
OSDCON1
bit 0: STOCK
It stop or start OSD clock. If oscillation is stoped, IC’s
power consumption is decreased.
bit 1: DDCLK
If you set this bit to 1, OSD input clock is divided by two ,
than it makes OSD horisontal image size as doubled.
bit 2: DLINE
If you set this bit to 1, OSD vertical scan co unter input
clock is doubled from normal state. It makes OSD vertical
November 2001 Ver 1.167
Page 70
HMS81C4x60
image size as doubled.
bit 3: PRSCN
It control progressive scan line mode.
bit clear than interace mode and bit set than processive
mode.
R/W R/W R/W R/W R/W R/W
OSDCON2
MSBLSB
FS0FS1FS 2FS 3OBGWFLARTOSDON
bit 7~4: FSBC3 ~ FSBC0
It controls full screen background color as figure shows.
NOTE:
Data slicer operate when OSDCON1.PRSCN(0AE0.3) bit of OSD register is
cleared. Namely, it operate interace scan display mode.
FDWSET (Field Detection Window Setting) register detects the begin of Vsync(Vertical Sync.) signal and distinguishs its current field is Even field or Odd field.
The region of FMIN[2:0] ~ FMAX[3:0] is field detection
WW
FMIN1
ADDRESS: 0AE3
INITIAL VALUE: 0111 1010
Field Detection Min. Pointer
Field Detection Polarity
0 : Masking between Min. and Max.
1 : Detect between Min. and Max.
Field Detection Max. Pointer
H
b
window.
FMAX[3:0] can divide the region between Hsync(Hori-
zontal Sync.) by 16 windows. You can assume there is 4
bit horizontal counter, for example HCOUNT[3:0](hptr[10
:7]) which count 0~15.
November 2001 Ver 1.169
Page 72
HMS81C4x60
Ex1: VSync(Odd)
Ex2: VSync(Even)
HSync
FMIN
If the start of Vsync is detected at the window, next field is
even. Else if Vsync is d etected another r egion o f th e window, next field is odd.
It means start of Vsync is detected during FMIN[2:0] <
HCOUNT[3:0] < FMAX[3:0] and DBFLG value is 0, it
distinguish odd field.
And, start of Vsync is detected during FM IN[2:0] <
HCOUNT[3:0] < FMAX[3:0] and DBFLG value is 1, it
distinguish even field.
FMAX
Figure 17-6 FDWSET detection region
R/W R/W R/W R/W R/W R/W
EDG2C3
EDGECOL
MSBLSB
EDG2C2 EDG2C1 EDG2C0 EDG1C3 EDG1C2 EDG1C1 EDG1C0
FMIN[2:0], FMAX[3:0] are compared with the horizontal
counter in OSD block.
R/W R/W
ADDRESS: 0AE4
INITIAL VALUE: 1000 0111
Edge 1 color of shadow, outline, edge
0000 : Transparency
0001 : Reserved
0010 : white
0011 : Black
0100 : Same as foreground character color
0111 ~ 0101 : Reserved
1000 : color 0
1001 : color 1
1010 : color 2
1011 : color 3
1100 : color 4
1101 : color 5
1110 : color 6
1111 : color 7
Edge 2 color of shadow, outline, edge
0000 : Transparency
0001 : Reserved
0010 : white
0011 : Black
0100 : Same as foreground character color
0111 ~ 0101 : Reserved
1000 : color 0
1001 : color 1
1010 : color 2
1011 : color 3
1100 : color 4
1101 : color 5
1110 : color 6
1111 : color 7
H
b
Figure 17-7 Character, Window color Register
EDGECOL
bit 7 ~ bit 0 : EDG1C0,EDG1C1,EDG1C2,EDG1C3
EDG2C0,EDG2C1,EDG2C2,EDG2C3
It control shadow color, outline color and edge color.
Low 4 bits controls edge 1 shadow, outline color and high
4 bits controls edge 2 shadow, outline color.
70November 2001 Ver 1.1
Page 73
HMS81C4x60
CHEDCL
WWWWWW
MSBLSB
WW
SHEC2SHEC3W INC0W INC1WINC2WINC3SH EC0
SHEC1
Figure 17-8 Scroll window color Register
ADDRESS: 0AE5
INITIAL VALUE: Undefined
Foreground shadow, outline edge color
0000 : Transparency
0001 : Reserved
0010 : white
0011 : Black
0100 : Same as foreground character color
0111 ~ 0101 : Reserved
1000 : color 0
1001 : color 1
1010 : color 2
1011 : color 3
1100 : color 4
1101 : color 5
1110 : color 6
1111 : color 7
Scroll window background color
0000 : Transparency
0001 : Reserved
0010 : White
0011 : Black
0111 ~ 0100 : Reserved
1000 : Color 0
1001 : Color 1
1010 : Color 2
1011 : Color 3
1100 : Color 4
1101 : Color 5
1110 : Color 6
1111 : Color 7
H
CHEDCL
bit 7 ~ bit 0 : SHEC0,SHEC1,SHEC2,SHEC3
WINC0,WINC1,WINC2,WINC3
It controls foreground shadow and ou tline edge color and
RRRRRR
OSDLN
MSBLSB
Figure 17-9 OSD Line Register
OSDLN
bit 4 ~ bit 0 : VLR4 ~ VLR0
It shows current display OSD line from 1 to 31.
scroll window background color.
Low 4 bits controls scroll window background color and
high 4 bits controls foreground shadow outline edge color.
RR
VLR2VLR3VLR4---VLR0
VLR1
LHPOS
MSBLSB
ADDRESS: 0AE6
INITIAL VALUE: ---0 0000
OSD line being displayed
00000 : Not displayed any OSD line yet after Vsync
00001 : 1st line OSD being displayed
.......
.......
11111 : 31st line OSD being displayed
WWWWWW
OSD Line Horizontal Posi tio n 00H~ FF
H
H
ADDRESS: 0AE7
INITIAL VALUE: Undefined
LH2LH3LH4LH5LH6LH7LH0
LH1
H
WW
H
November 2001 Ver 1.171
Page 74
HMS81C4x60
Figure 17-10 OSD Line Horizontal Position Register
LHPOS
bit 7 ~ bit 0 : LH7 ~ LH0
WWWWWW
DLLMOD
MSBLSB
RRRRRR
DLLTST
MSBLSB
Figure 17-11 DLL mode Register
DLLMOD
bit 2 ~ 0 : If you set this bit to 1, the status is ch anged test
mode.
bit 7 ~ bit 3 : DCKF4 ~ DCKF0
It control dot clock frequency.
Dot clock frequency is as below.
Value
DCKF4 DCKF4 DCKF4DCKF4 DCKF4
00000stop dll clock
00001reserved
00010reserved
0001164.00MHz
0010051.20MHz
0010142.67MHz
0011036.57MHz
0011132.00MHz
0100028.44MHz
0100125.60MHz
0101023.27MHz
Frequency
It control OSD line horizontal position. Position value
from 00h to FFh.
WW
-DCKF0DCKF1DCKF2DCKF3DCKF4-
-
RR
-------
-
DCKF4 DCKF4 DCKF4DCKF4 DCKF4
0101121.33MHz
0110019.69MHz
0110118.29MHz
0111017.07MHz
0111116.00MHz
1000015.05MHz
1000114.22MHz
1001013.47MHz
1001112.80MHz
1010012.19MHz
1010111.63MHz
1011011.13MHz
1011110.67MHz
11000reserved
11001reserved
ADDRESS: 0AE8
INITIAL VALUE: 0000 0000
1 : OSD test mode
1 : Dll test mode
1 : Reset clock count test mode
Dot clock frequency
ADDRESS: 0AE9
INITIAL VALUE: --00 0000
Value
H
H
H
H
Frequency
Table 17-1 Dot Clock Frequency (fex=4Mhz)
72November 2001 Ver 1.1
Page 75
HMS81C4x60
L1ATTR
bit 0 : L1V8
L1ATTR
WWWWWW
MSBLSB
WW
CSZ10CSZ11ENSH1ENOL1WDSL1OBGH1L1V8
FSC1
Figure 17-12 OSD line 1 attribute register
bit 4: ENSH1
It enables line 1’s character(foreground) shadow.
ADDRESS: 0AEA
INITIAL VALUE: 0000 0000
OSD line 1 vertical position (bit 8)
Foreground sh adow or outline color select
0 : Edge 1 color
1 : Edge 2 color
Size of character
00 : Normal
01 : 1.5 times
10 : 2 times
11 : Reserv ed
Enable/disable of shadow
0 : Disable
1 : Enable
Enable/disable of outline
0 : Disable
1 : Enable
Width of shadow, outline
0 : 1 dot
1 : Proportional to character size
OSD chraracter background height
0 : font height
1 : font height + 2
H
H
It is equivalent to L1VPOS’s most significant bit(bit 8).
See more details in L1VPOS.
bit 1: FSC1
It selects character outline and shadow color. If it is 1, it se-
lect EDGE2 color of EDGECOL register. Or not, it select
EDGE1 color. According to EDGECOL register and this
bit character and shadow colors are selected simulteneously
bit 3~2: CSZ11~CSZ10
It controls OSD ch aracter’s size ( norm al, 1.5 times, 2
times). You can use this register and DDCLK, DLINE bit,
horizontal / vertical size can be controlled (x1, x1.5, x2).
bit 5: ENOL1
It enables line 1’s character(foreground) outline.
bit 6: WDSL1
It shows thickness of lin e 1’s shadow an d outl ine.This bit
is set than one dot and bit clear is proportional to character
size. If only character size is 2 times, 2 times per vertically
and horizontally. In case 1 dot width would be enable.
bit 7: OBGH1
It controls character’s b ackground heig ht. Defaul t height is
16dots. If its value is set, 2 dots (background color) are
added both top and bottom side of character.
November 2001 Ver 1.173
Page 76
HMS81C4x60
WWWWWW
L1EATR
MSBLSB
L1EATR
It shows OSD line 1 extend attribute register.
L1VPOS
WWWWWW
MSBLSB
OSD line 1 vertical position 000H~ 1FFH
ADDRESS: 0AEC
INITIAL VALUE: Undefined
WW
LIV2LIV3LIV4LIV5LIV6LIV7LIV0
LIV1
WW
SEL1FLSEL1OWSEL1UL---SEL1SH
SEL1IT
ADDRESS: 0AEB
INITIAL VALUE: Undefined
Select shadow/round of line 1 each character when
VRAM.ENRND is set.
0 : round character
1 : shadow character
Select italic/upper edge of line 1 each character.
Italic character can be displayed only when character
size is 1, 1.5 times, and VRAM.BSU is set.
0 : Upper edge character
1 : Italic character
Select flash/left edge of line 1 character when
VRAM.BSL is set.
0 : Left edge character
1 : Flash
Select OSD/window when display. If this bit is 0,
background window would be displayed.
0 : Background window selected
1 : OSD line selected
Select underline /lower edge of line 1 each character
0 : Underline
1 : Lower edge line
H
L1ATTR.
L2EATR
H
WWWWWW
MSBLSB
ADDRESS: 0AEE
INITIAL VALUE: Undefined
SEL2FLSEL2OWSEL2UL---SEL2SH
H
WW
SEL2IT
L2EA TR
L1VPOS
It shows OSD line 2’s extened attribute register.
It shows OSD line 1’s vertical position in 9bit format
(LIV8 + L1VPOS, 000 ~ 1FF
L2ATTR
WWWWWW
MSBLSB
).
H
ADDRESS: 0AED
INITIAL VALUE: Undefined
WW
CSZ21CSZ22ENSH2ENO L2WDSL2OBG H2L2V2
FSC2
L2VPOS
WWWWWW
H
MSBLSB
ADDRESS: 0AEF
INITIAL VALUE: Undefined
L2V2L2V3L2V4L2V5L2V6L2V7L2V0
H
WW
L2V1
L2VPOS
It shows OSD line 2’s vertical position. Its functio n is the
same as L1VPOS.
L2ATTR
It shows OSD line 2’s attributes. Its function is the same as
74November 2001 Ver 1.1
Page 77
HMS81C4x60
WINSH
WWWWWW
WINSH7
WINSH6 W INSH5 W INSH4 WINSH3 WINSH2 WINSH1 WINSH0
MSBLSB
OSD scroll window start horizontal position
ADDRESS: 0AF0
INITIAL VALUE: Undefined
H
WW
WINSH
It shows OSD scroll window start horiz ontal position.
WINSY
WWWWWW
WINSY7
WINSY6 WINSY5 WINSY4 WINSY3 WINSY2 WINSY1 WINSY0
MSBLSB
OSD scroll window start vertical position
ADDRESS: 0AF1
INITIAL VALUE: Undefined
H
WW
WINSY
It shows OSD scroll window start vertical position.
WINEH
WWWWWW
WINEH7
WINEH6 W INEH5 W INEH4 W INEH3 W INEH2 W INEH1 WINEH0
MSBLSB
OSD scroll window end horizontal position
ADDRESS: 0AF2
INITIAL VALUE: Undefined
H
WW
WINEH
It shows OSD scroll window end horizontal position.
WINEY
WWWWWW
WINEY7
WINEY6 WINEY5 WINEY4 WINEY3 WINEY2 WINEY1 WINEY0
MSBLSB
OSD scroll window end vertical position
ADDRESS: 0AF3
INITIAL VALUE: Undefined
H
WW
VCNT
RRRRRR
MSBLSB
Current scan line line vertical position [6:0]
ADDRESS: 0AF4
INITIAL VALUE: Undefined
VCNT6VCNT6VCNT6VCNT6VCNT6VCNT6FLDID
Current display field
0 : Odd field
1 : Even field
H
RR
VCNT6
VCNT
It shows Vsync count register and counted by pixel clock.
VCNT counter clock start at Vsync start edge.
HCNT
RRRRRR
MSBLSB
Horizontal counter hptr[10:3]
ADDRESS: 0AF5
INITIAL VALUE: Undefined
HCNT2HCNT3HCNT4HCNT5HCNT6HCNT7HCNT0
H
RR
HCNT1
HCNT
It shows Hsync count register and counted by pixel clock.
HCNT counter clock start at Hsync start edge.
CULTAD
WWWWWW
MSBLSB
Normal/Test mode select
00 : Normal mode
01 ~ 11 : Test mode
ADDRESS: 0AF9
INITIAL VALUE: Undefined
-------
1.5 times character mode
0 : line double mode 1.5 times
1 : field interleaving mode 1.5 times
H
WW
FIL15
CULTAD
It shows normal and test mode and 1.5 times mode.
WINEY
It shows OSD scroll window end vertical p os ition.
November 2001 Ver 1.175
Page 78
HMS81C4x60
17.3 VRAM
VRAM contains a OSD li ne buffer, 48 character’s attributes.
Each character’s attribute is constructed with 3 bytes, it
contains color data for background, shadow, o utline, char acter and character number ( 000
~ 1FFH, 512 characters
H
), etc.
Line
00~08
Character
No.
No.
add. No.
1
46AADA6DA2D
47AAEA6EA2E
48AAFA6FA2F
2
46BADB6DB2D
47BAEB6EB2E
48BAFB6FB2F
Table 17-2 VRAM memory map
Bit
09ENRND
0ABSCUL
NameFunction
CG8
~CG0
Address (bit 47~0)
Hexa decimal
1A80A40A00
2A81A41A01
3A82A42A02
::::
1B80B40B00
2B81B41B01
3B82B42B02
::::
Character font code
1FFh ~ 000h
Round enable/disable
0 : disable
1 : enable
Edge color of upper and left
background shadow edge
0 : edge 1 color
1 : edge 2 color
Bit
No.
0BBSCDR
0CBSU
0DBSD
0EBSL
0FBSR
10~13
14~17
NameFunction
FC3
~FC0
BC3
~BC0
Edge color of lower and right
background shadow edge
0 : edge 1 color
1 : edge 2 color
Background shadow upper eddge
control/italic depend on
LxEATR.SELxIT
0 : disable
1 : enable
if(LxEATR.SELxIT == 0) backgro und
shadow upper edge enable
else(LxEATR.SELxIT == 1) italic
enable
Background shadow lower edge
control/underline depend on
LxEATR.SELxUL
0 : disable
1 : enable
if(LxEATR.SELxUL == 0)
background shadow lower edge
enable
else(LxEATR.SELxUL ==
1)underline enable
Background shadoww left edge
control/flash(blInking) depend on
LxEATR.SELxFL
0 : disable
1 : enable
if(LxEATR.SELxFL == 0) background
shadow left edge enable
else(LxEATR.SELxFL == 1)
flash(flicking) enable
Background shadow right edge
control
0 : disable
1 : enable
Foreground color for character (11
colors)
Background color for character (12
colors)
Table 17-3 VRAM attribute
76November 2001 Ver 1.1
Page 79
HMS81C4x60
Composition of VRAM
LINE 1
(page A)
LINE 2
(page B)
CG8
0A80 0A40 0A00
0A81 0A41 0A01
0A82 0A42 0A02
: : :
0AAF 0A6F 0A2F
0B80 0B40 0B00
0B81 0B41 0B01
0B82 0B42 0B02
: : :
0BAF 0B6F 0B2F
CG2CG3CG 4CG5CG6CG7CG0
BSCULBSCDRBSUBSDBSLBSRCG 8
Character 1 Attr.
Character 2 Attr.
Character 3 Attr.
Character 48 Attr.
Character 1 Attr.
Character 2 Attr.
Character 3 Attr.
Character 48 Attr.
CG1
ENRND
FC2FC3BC0BC1BC2BC3FC0
FC1
RESET VALUE: Undefined
Character font address (512 fonts)
see table 17-3 VRAM attribute
Character color select (11 characters)
0000 : Transparency
0001 : Reserved
0010 : White
0011 : Black
0111 ~ 0100 : Reserved
1000 : Color 0
1001 : Color 1
1010 : Color 2
1011 : Color 3
1100 : Color 4
1101 : Color 5
1110 : Color 6
1111 : Color 7
Background color select (12 characters)
0000 : Transparency
0001 : Reserved
0010 : White
0011 : Black
0111 ~ 0100 : Reserved
1000 : Color 0
1001 : Color 1
1010 : Color 2
1011 : Color 3
1100 : Color 4
1101 : Color 5
1110 : Color 6
1111 : Color 7
November 2001 Ver 1.177
Page 80
HMS81C4x60
17.4 Character ROM
The HMS81C4x60 Character ROM are used 512 types of
Font Dot Pattern data. As displayed one ch aracter, need 12
× 10 ~ 16 × 18bits Dot Pattern data.
1. Each horizontal data (12dots) needs 2bytes ROM.
2. One character is constructed with 16 horizontal data to
vertically. As a result, one character needs 32bytes (2 × 16
bytes).
3. HMS81C4x60 contains 512 characters. Total Font
ROM memory size is calculated as 16,384bytes ( 32bytes
/ character × 512 characters )
4. Font ROM memory is located from 10000
~ 17FFFH,
H
this memory can not be accessed by user program.
Charact
er code
000
H
001
H
002
H
Upper 8bitLower 8bit
14000H ~ 14011
14020H ~ 14031
14040H ~ 14051
:::
xyz
(14000H + xyz0H) ~
H
(14000H + 2*xyzFH)
:::
1FD
1FE
1FF
17FA0H ~ 17FB1
H
17FC0H ~ 17FD1
H
17FE0H ~ 17FF1
H
Address range
10000H ~ 10011
H
10020H ~ 10031
H
10040H ~ 10051
H
(10000H + xyz0H) ~
(10000H + 2*xyzFH)
13FA0H ~ 13FD1
H
13FC0H ~ 13FD1
H
13FE0H ~ 13FF1
H
H
H
H
H
H
H
5. A character’s address and dot position in font ROM is
described in Figure 17-13.
Composition of color 3
Red : {R02, R01,R00}
Green : {G02,G01,G00}
Blue : {B02,B01,B00}
RESET VALUE : Undefined
WWW
210
Composition of color 0
Composition of color 1
Composition of color 2
HMS81C4x60
[Example] Color data table
Color_example_table:
db 0000_0000b ;color 0 = Gray
db 0000_0011b ;color 1 = Red
db 0010_1011b ;color 2 = Green
;
db 0000_0000b ;color 3 = Yellow
db 0000_0101b ;color 4 = Blue
db 0100_1101b ;color 5 = Magenta
;
db 0000_0000b ;color 6 = Cyan
db 1001_0001b ;color 7 = half blue
db 1111_0001b
Figure 17-14 Color look up table
November 2001 Ver 1.179
Page 82
HMS81C4x60
18. DATA SLICER
HMS81C4x60 supports Clos ed Caption decodi ng standard
with 0.5MHz data rate. Also it can capture 4 horizontal
lines information per frame, because it has 4 horozontal
lines capture memory. It is able to select even or odd field
18.1 Data Slicer Circuit
Figure 18-1 shown the data slicer circuit.
SCAP
560pF
CVBS
0.47uF
Figure 18-1 Data Slicer Circuit
HMS81C4x60
18.2 Configuration of Data Slicer
Figure 18-2 shows the block diagram of the Data Slicer.
at one field interval. Data Slicer captures caption information from line 21 in vertical blanking interval of CVBS,
and stores these data to buffer memory.
CVBS signal is en tere d to CVBS p in via 0 .47uF capacit or.
The black level of signal is about 2V. SCAP pin is connected to external 560pF capacitor which adjust the referance
voltage of comparator. Its slicer level is adapted to input
signal.
Run-in key timing
Sync-tip timing
Data capture
timing
CVBS
Data
Filter
Reference
Voltage
Figure 18-2 Data Slicer Block Diagram
This data slicer block separates caption information from
CVBS signal. Data slicer composes high speed comparator
and on-chip low pass filter. The outp ut data of comparator
Timing
Controller
Memory
Interface
Controller
CPU control
Slicer
Memory
is stored in memory through the filter and m emory interface controller, which should be decoded to caption data
by software. Slicer memory addressed 600h ~ 6FFh.
80November 2001 Ver 1.1
Page 83
18.3 Slicer Registers
HMS81C4x60
Slicer Control Register
Slicer Control Register is the specific control register,
R/W R/W R/W R/W R/W R/W
SLCON
MSBLSB
DEME1--SELCKRIKTST-SLON
Figure 18-3 Slicer Control Register
Slicer Information Register 0
Slicer Information Register 0 selects even or odd field
which select operating freque ncy of the slicer, slicer decoding method and switch slicer on/off.
buffer of line 0 and slicer line 0 position. Also it is used to
select line number in Vertical blanking interval.
WWWWWW
SLINF0
MSBLSB
SLPOS0
Figure 18-4 Slicer Information Register 0
Slicer Information Register 1
Slicer Information Register 1 selects even or odd field
WWWWWW
SLINF1
MSBLSB
SLPOS1
Figure 18-5 Slicer Information Register 1
WW
LFC0
LFC0
ADDRESS: 0BE1
INITIAL VALUE: 0000 0000
Line0 enable
00 : disable all line 0
01 : reserved
10 : reserved
11 : enable all line 0 (even and odd field)
Slicer line 0 position
H
b
buffer of line 1 and slicer line 1 position. Also it is used to
select line number in Vertical blanking interval.
WW
LFC1
LFC1
ADDRESS: 0BE2
INITIAL VALUE: 0000 0000
Line 1 Field
00 : disable all line 1
01 : reserved
10 : reserved
11 : enable all line 1 (even and odd field)
Slicer line 1 position
H
b
November 2001 Ver 1.181
Page 84
HMS81C4x60
Run-in key Start/End position Register
RIKST points the start postion of run-in key, it is delayed
from start edge of Hsync. RIKED points the end position
of run-in key, it is also delayed from start edge of Hsync.
WWWWWW
RIKST
MSBLSB
RIKST2RIKST3RIKST4RIKST5RIKST6RIKST7RIKST0
Figure 18-6 Run-in key Start Position Register
WWWWWW
RIKED
MSBLSB
RIKED2RIKED3RIKED4RIKED5RIKED 6RIKED7RIKED0
Figure 18-7 Run-in key End Position Register
Sync Start/End Position Register
Sync Start and End position Register are used to make
Sync tip window. Both timmings are counted up by
Both timmings are counted up by 8MHz clock. The referance voltage of comparator is charged by external signal
during this time interval. Figure 18-6 and Figure 18-7
shows the RIK register’s configure.
WW
RIKST1
WW
RIKED1
ADDRESS: 0BE3
INITIAL VALUE: XXXX XXXX
Run-in key window start position
ADDRESS: 0BE4
INITIAL VALUE: XXXX XXXX
Run-in key window end position
H
b
H
b
16MHz clock. Figure 18-8 and Figure 18-9 shows the
Sync-tip register’s configur e.
Figure 18-10 shows the closed caption signal. The signal
composes color burst, clock run-in, start bit(001), 16bit
ASCII data with 2 parity bit. Sliced raw datas are sampled
by 4MHz frequency.
[ CAPTIO N D ATA ]
TWO (7 BIT + PARITY )
CHARACTERS
( D ATA )
33.76us
3.972us
51.26us
61.342us
program
color
burst
CLOCK RUN IN
START BIT(001)
12.91us
Figure 18-10 Closed caption signal
Address assign
Table 18-1 shows the map of assigned buffer memory.
SettingAddress
Interrupt occurrence
The slicer interrupt is occured after writing the sliced two
lines data to memory buffer.
Signal timing
Figure 18-11 shows an example of variable signals, which
includes Vsync(vertical Sync.), Hsync(horizontal Sync.),
CVBS(composit video in), SCAP(slicer capacitor), Run-in
key and Sync tip. Line 21 closed caption sign al run after
Vsync interrupt. The signal’s black(base) level voltage is
charged on Sync-tip switch-on period, and the re ferance
voltage of comparator is charged on RIK switch-on perid.
Because RIK time is related to SCAP voltage(comparator
referance voltage or slicer level ) which is charged by cl ock
run-in signal, user can adjust the slicer level by RIK time.
The sliced data is stored to RAM buffer. (0600h~ 06FFh)
First Line
Secont Line
Even Field0600h ~ 063Fh
Odd Field0640h ~ 067Fh
Even Field0680h ~ 06BFh
Odd Field06C0h ~ 06FFh
Table 18-1 Address assign
November 2001 Ver 1.183
Page 86
HMS81C4x60
Vsync
5V
1
Hsync
CVBS
SCAP
RIK
Sync_tip
2
1 Hsync cycle
5V
5V
5V
2.5V
2V
line 21 signal
2.2V
0.5V
Slicer capacitor charging level
5V
3
4
Run-in key start/stop timming
0V
5V
Sync-tip start/stop timming
0V
Figure 18-11 Signal timing
[Example]
Initializing slicer register.
CCD_INIT: LDMSLINF0,#0011_0011b; slicer line 21
LDMSLINF1,#0000_0000b; no field
LDMRIKST,#01; run-in key start : 1 -> 0.125uS(8MHz)
LDMRIKED,#8Ch; run-in key end : 8ch -> 17.5uS(8MHz)
LDMSNCST,#01; sync tip start : 1 -> 0.0625uS(16MHz)
LDMSNCED,#58h; sync tip end : 58h -> 5.5uS(16MHz)
LDMSLCON,#01h; normal clock, 16MHz, slicer start
84November 2001 Ver 1.1
Page 87
19. I2C Bus Interface
HMS81C4x60
The I2C Bus interface circuit is shown in Figure 19-1.
The multi-master I
tions circuit, conforming to the Phlips I
2
C Bus interface is a serial communica-
2
C Bus data transfer format. This interface, offering both arbitration lost
detection and a synchronous functions, is useful for the
multi-master serial communications.
SDA5 SDA4 SDA3 SDA2 SDA1 SDA0 RWb
SAD6
D6D5D4D3D2D1D0
D7
BB
Circuit
AL
Circuit
SDA
SCL
Noise
Elimination
Circuit
Noise
Elimination
Circuit
ICAR [D8H]
ICDR [D9H]
Data
Control
Circuit
Clock
Control
Circuit
This multi-master I
2
I
C address register, the I2C data shift regi ster, the I2C
clock control register, the I
2
C Bus interface circuit consists of the
2
C control register, the I2C sta-
tus register and other control circuits.
The more details about registers are shown Figure 19-2~
Figure 19-5.
Address
ICSR [00DA
ICCR [00DB
comparator
MST TRXBB PINAL AD0 ADRb LRB
]
H
BSEL1
]
H
ACKbCCR2 CCR1 CCR0
BSEL1
Interrupt
Generation
Circuit
CCR3ESO
Clock division
IFI2CR
Clock Source
Figure 19-1 Block Diagram of multi-master I2C circuit
Control
2
The HMS81C4x60 contains two I
C Bus interface modules. It supports multi-master function, so it contains arbitration lost detection, synchronization function,etc.
ITEMFunction
Format
Philips
7bit addressing format
standard
I2C
2
I
C address register
It contains slave address (7bit) which is used during slave
mode and Read/Write
bit.
Bit 7 ~ 1 : Slave address 6~0
Note: Bit 7~1 (SAD6~0) store slave address. Th e ad dre ss
data transmitted fro m the mast er is compa red w ith th e con tents of these bits.
Master transmitter
Communication
mode
Master receiver
Slave transmitter
Slave receiver
November 2001 Ver 1.185
Page 88
HMS81C4x60
The more details about its bits are shown Table 19-1.
ICAR
ADDRESS : 00D8
RW RW RW
SDA5 SDA4 SDA3 SDA2 SDA1 SDA0 RWb
SAD6
Slave address
RESET VALUE : 0000 0000
RW RW RW R
RW
H
Read/Write Bit
b
Figure 19-2 I2C address Register
I2C data shift register [ICDR]
2
C data shift register is an 8bit shift register to store
The I
received data and write transmit data.
When transmit data is written int o this regi ster, it is transfered to the outside from bit7 in synchronization with the
SCL clock, and each time one-bi t data is outp ut, the data of
this register are shifted one bit to the left. When data is received, it is input to this register from bit0 in synchronization with the SCL clock, and each time one-bit data is
input, the data of this register are shifted one bit to the left.
2
The I
C data shift register is in a write enable status only
when the ESO bit of the I
00DC
) is “1”. The bit counter is reset by a write ins truc-
H
tion to the I
2
I
C data shift register is always enabled reg ardless of the
2
C data shift register. Reading data from the
2
C control register (address
ESO bit value.
ICDR
ADDRESS : 00D9
RW RW RW RW RW RW RW RW
D6D5D4D3D2D1D0
D7
Shift left 1-bit each SCL
RESET VALUE : 0000 0000
Figure 19-3 Data shift register
H
b
I2C status register
2
C status register controls the I2C Bus interface sta-
The I
tus. The low-order 4bits are read only bits and the high-order 4bits can be read out and written to.
The first transmitted data from master is compared with
2
C address register (ICAR, 00D8H). At this time R/W is
I
not compared but it determines next data opera tion. i.e,
transmitting or receiving data
Slave -> Master (with 7bit address)
START
Slave addr.
7bit
R/W
(“1”)
ACK
Data
ACK
Data
ACK
STOP
Figure 19-10 Address data communication format
Data block from master to slave
Data block from slave to master
November 2001 Ver 1.189
Page 92
HMS81C4x60
20. WATCHDOG TIMER
The watchdog timer rapidly detects the CPU malfunction
such as endless looping caused by noise or the like, and resumes the CPU to the normal state.
The watchdog timer signal for detecting malfunction can
be selected either a reset CPU or a interrupt request.
Clock source
(BIT overflow : IFBIT)
[00D7
6-bit up- counter
WDT
clear
6-bit compare data
comparator
6
WDTCL[bit6]
WDTR[bit5~0]
WDTR
Watchdog Timer Register
]
H
Figure 20-1 Block Diagram of Watchdog Timer
Watchdog Timer Control
When the watchdog tim er is not being us ed for malfunction detection, it can be used as a tim er to generate an interrupt at fixed intervals.
[00D6
IFWDT
enable
WDTON[bit5]
CKCTLR
Clock control Register
]
H
Watchdog Timer interrupt
to reset CPU
Figure 20-2 shows the watchdog timer control register.
The watchdog timer is automatically disab led aft e r reset.
The CPU malfunction is detected as setting the detection
time, selecting output, and clearing the binary counter. Repeatedly clearing the binary count er with in th e settin g detection time.
If the malfunction occurs for any cause, the watchdog timer output will become active at the rising overflow from
the binary counters unless the binary counter are cleared.
At this time, when WDTON=1 a reset is generated, which
drives the RESET
pin low to reset the intern al hardware.
When WDTON=0, a watchdog timer interr upt (IFWDT) is
generated.
ADDRESS : 00D6
RESET VALUE : 0000 0000
WWWR
BTCL BTS2 BTS1 BTS0
ADDRESS : 00D7
RESET VALUE : -011 1111
Slave address
CKCTLR
WDTR
W
W
WDT ENP
ON CK
Watchdog timer On/Off control
0: Normal 6bit timer, Watchdog off
1: Watchdog timer
WWWWWWW
WDT
WDTR5 ~ 0
CL
Watchdog timer Clear
0: Watchdog timer free run
1: Watchdog timer clear and free run
Watchdog timer is enabled by setting WDTON (bit 5 in
CKTCLR) to "1". WDTON is initialized to "0" during reset, WDTON should be set to "1" to operate after reset is
released.
Example: Enables watchdog timer reset
:
LDMCKTCLR,#001?????b ;WDTON←1
:
:
The watchdog timer is disabled by clearing bit 5 (WDTON) of CKTCLR.
Watchdog Timer Interrupt
The watchdog timer can also be u sed as a simple 6-bit timer by clearing bit 5 (WDTON) of CKTCLR. The interval
of watchdog timer interrupt is decided by Basic Interval
Timer.
Interval equation is shown as below.
TWDTR Interval of BIT×=
Clear Counter and set value(??????b)
You have to set WDTR first, for prevent unpredictable interrupt
It should be set properly that current flow through port
doesn't exist.
First conseider the setting to input mode. Be sure that there
is no current flow after considering its relationship wi th
external circuit. In input mode, the pin impedance viewing
from external MCU is very high that the cur rent doesn’t
flow.
But input voltage level should be V
or VDD. Be careful
SS
10
3
WDTR ← "0100_0011b"
that if unspecified voltage, i.e. if unfirmed v oltage level is
applied to input pin, there can b e litt le current (max . 1mA
at around 2V) flow.
If it is not appropriate to set as an input m ode, then set to
output mode considering th ere is no current flow. Settin g
to High or Low is decided considering its relationship with
external circuit. For example, if there is external pull-u p resistor then it is set to output mode, i.e. to High, and if there
is external pull-down register, it is set to low. See Figure
20-4.
2
30
Counter
Clear
Match
Detect
92November 2001 Ver 1.1
Page 95
HMS81C4x60
INPUT PIN
V
DD
i
GND
X
Weak pull-up current flows
INPUT PIN
OPEN
i
Very weak current flows
X
internal
pull-up
V
DD
V
DD
O
V
DD
OPEN
O
V
DD
i=0
O
i=0
GND
O
OUTPUT PIN
ON
ON
OFF
i
GND
X
In the left case, much current flows from port to GND.
OUTPUT PIN
V
DD
ON
OFF
i
L
GND
X
In the left case, Tr. base current flows from port to GND.
To avoid power consumption, low output to the port .
OFF
ON
OFF
OFF
ON
O
i=0
O
O
OPEN
V
DD
GND
V
DD
L
When port is configured as an input, input level should
be closed to 0V or 5V to avoid power consumption.
Figure 20-4 Application example of Port under Power Consumption
November 2001 Ver 1.193
Page 96
HMS81C4x60
21. OSCILLATOR CIRCUIT
The HMS81C4x60 has two oscillation circuits internally.
X
and X
IN
are input and output for main frequency and
OUT
OSC1 and OSC2 are input and output for OSD(On Screen
C1
C2
External Clock
fc (MHz)
X
OUT
X
IN
V
SS
Crystal Oscillator
Open
X
OUT
X
IN
Figure 21-1 Oscillation Circuit
display) frequency, respectively, of a inverting amplifier
which can be configured fo r use as an on-chip oscillator, as
shown in Figure 21-1 .
Recommend
fc (MHz)4C1 & C2 (pF)
15
External Oscillator
Oscillation components have their own characteristics, so
user should consult the component manufacturers for appropriate values of external components.
In addition, see Figure 21-2 for the layout of the crystal.
Note: Minimize the wiring length. Do not allow wiring to intersect with other signal conductors. Do not allow wiring to
come near changing high current. Set the potential of the
grounding position of the oscillator capacitor to that of V
Do not ground to any ground pattern where high current is
present. Do not fetch signals from the oscillator.
SS
X
OUT
X
IN
.
Figure 21-2 Layout example of Oscillator PCB circuit
94November 2001 Ver 1.1
Page 97
22. RESET
HMS81C4x60
The HMS81C4x60 have two types of reset generatio n procedures; one is an external reset input, other is a watch-dog
timer reset. Table 22-1 show s on-chip hardware initialization by reset action.
On-chip HardwareInitial ValueOn-chip HardwareInitial Value
Program counterPC
RAM page registerDPGR
(FFFFH) - (FFFEH)
00
H
Peripheral clockOff
Watchdog timerDisable
G-flag of PSWG0Control registersRefer to Table 8-1 on page 22
Table 22-1 Initializing Internal Status by Reset Action
22.1 External Reset Input
The reset input is the RESET pin, which is the inpu t to a
Schmitt Trigger. A reset in accomplished by holding the
RESET pin low for at least 8 oscillator periods, within the
operating voltage range and oscillation stable, a reset is applied and the internal state is initialized. After reset, 64ms
(at 4 MHz) add with 7 oscillator periods are required to
start execution as shown in Figure 22-2 .
Internal RAM is not affected by reset. When V
is turned
DD
on, the RAM content is indeterminate. Therefore, this
RAM should be initialized before reading or testing it.
When the RESET
pin input goes high, the reset operation
is released and the program execution starts at the vector
address stored at addresses FFFE
- FFFFH.
H
A connecting for simple p ower-on-reset is shown in Figure
22-1 .
V
DD
RESET
+
−
GND
Figure 22-1 Simple Power-on-Reset Circuit
MCU
Oscillator
(X
pin)
IN
RESET
Fetch
ADDRESS
BUS
DATA
BUS
~
~
~
~
~
~
?
?
Stabilization Time
t
ST
~
~
~
~
~
~
= 62.5mS at 4.19MHz
1234567
~
~
?
??
??
RESET Process Step
t
=
ST
f
MAIN
1
÷1024
Figure 22-2 Timing Diagram after RESET
FFFE FFFF
FE?ADL
x 256
ADH
Start
OP
MAIN PROGRAM
November 2001 Ver 1.195
Page 98
HMS81C4x60
22.2 Watchdog Timer Reset
Refer to “20. WATCHDOG TIMER” on page 90.
96November 2001 Ver 1.1
Page 99
23. OTP Programming
23.1 HMS87C4x60 OTP Programming
HMS81C4x60
User can burn out HMS87C4x60 OTP th rough the general
Gang programmer using special ROM writer. In Devleopment tool package auxiliary, HMS87C4x60 has ROM
writer socket. HMS87C4x60 have two ROM memory areas. One is Program ROM memory and the other is Font
ROM memory. Program ROM area is from 1000h to
FFFFh Font ROM area is from 10000h to 17FFFh .
Blank Che ck
Figure 23-1 HMS87C4x60 OTP Memory Map
1000H
FFFFH
17FFFH
Program
Memory
OSD Font
Memory
Program Writing
There are two kind of OTP file. One is program OTP
file(***.OTP) and the other is font OTP file(***.FNT).
You can make each file through ASMLINKER.exe and
OSDFONT.exe respectively. All OTP file is Motolora Sformat. You can burn the program file and font file respectively or together. To burn progra m file and font file respectively, refer following procedure
1. Make program OTP file and font OTP file repectively.