ChipFind - документация

Электронный компонент: GMS87C1102

Скачать:  PDF   ZIP

Document Outline

8-BIT SINGLE-CHIP MICROCONTROLLERS
GMS81C1102
GMS81C1202
User's Manual
Jan. 2002
Ver 2.0
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
1. OVERVIEW ....................................................................................................................... 1
1.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Development Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2. BLOCK DIAGRAM(GMS81C1202) .................................................................................. 2
3. PIN ASSIGNMENT(GMS81C1202) .................................................................................. 2
4. BLOCK DIAGRAM(GMS81C1102) .................................................................................. 3
5. PIN ASSIGNMENT(GMS81C1102) .................................................................................. 3
6. PACKAGE DIMENSION(GMS81C1202) .......................................................................... 4
7. PACKAGE DIMENSION(GMS81C1102) .......................................................................... 5
8. PIN FUNCTION ................................................................................................................. 6
9. PORT STRUCTURES ....................................................................................................... 7
10. ELECTRICAL CHARACTERISTICS -GMS81C1102, GMS81C1202 .......................... 10
10.1 Absolute Maximum Ratings - GMS81C1102, GMS81C1202 . . . . . . . . . . . . . . . . 10
10.2 Recommended Operating Conditions - GMS81C1102, GMS81C1202 . . . . . . . . . 10
10.3 DC Electrical Characteristics - GMS81C1102, GMS81C1202 . . . . . . . . . . . . . . . . 11
10.4 A/D Converter Characteristics - GMS81C1102, GMS81C1202 . . . . . . . . . . . . . . . 13
10.5 AC Characteristics - GMS81C1102, GMS81C1202 . . . . . . . . . . . . . . . . . . . . . . . 14
10.6 Typical Characteristics - GMS81C1102, GMS81C1202 . . . . . . . . . . . . . . . . . . . . 15
11. ELECTRICAL CHARACTERISTICS - GMS87C1102, GMS87C1202 ......................... 19
11.1 Absolute Maximum Ratings - GMS87C1102, GMS87C1202 . . . . . . . . . . . . . . . . 19
11.2 Recommended Operating Conditions - GMS87C1102, GMS87C1202 . . . . . . . . . 19
11.3 DC Electrical Characteristics - GMS87C1102, GMS87C1202 . . . . . . . . . . . . . . . . 20
11.4 A/D Converter Characteristics - GMS87C1102, GMS87C1202 . . . . . . . . . . . . . . . 21
11.5 AC Characteristics - GMS87C1102, GMS87C1202 . . . . . . . . . . . . . . . . . . . . . . . 22
11.6 Typical Characteristics - GMS87C1102, GMS87C1202 . . . . . . . . . . . . . . . . . . . . 23
12. MEMORY ORGANIZATION ......................................................................................... 26
12.1 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
12.2 Program Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
12.3 Data Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
12.4 Addressing Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
13. I/O PORTS .................................................................................................................... 38
13.1 RA and RAIO registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
13.2 RB and RBIO registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
13.3 RC and RCIO registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
14. CLOCK GENERATOR ................................................................................................. 41
14.1 Oscillation Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
15. BASIC INTERVAL TIMER ........................................................................................... 43
16. TIMER / COUNTER ...................................................................................................... 44
16.1 8-bit Timer/Counter Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
16.2 16-bit Timer/Counter Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
16.3 8-bit Compare Output ( 16-bit ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
16.4 8-bit Capture Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
16.5 16-bit Capture Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
16.6 PWM Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
17. BUZZER OUTPUT FUNCTION .................................................................................... 53
18. ANALOG TO DIGITAL CONVERTER .......................................................................... 54
19. INTERRUPTS ............................................................................................................... 57
19.1 Interrupt Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
19.2 BRK Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
19.3 Multi Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
19.4 External Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
20. WATCHDOG TIMER .................................................................................................... 62
21. POWER SAVING MODE .............................................................................................. 63
22. RESET .......................................................................................................................... 68
23. POWER FAIL PROCESSOR ........................................................................................ 69
24. OTP PROGRAMMING .................................................................................................. 71
APPENDIX
INSTRUCTION MAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i
INSTRUCTION SET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
1
GMS81C1102 / GMS81C1202
CMOS SINGLE-CHIP 8-BIT MICROCONTROLLER
1. OVERVIEW
1.1 Description
The GMS81C1102 and GMS81C1202 are an advanced CMOS 8-bit microcontroller with 2K bytes of ROM. The Hynix
GMS81C1102 and GMS81C1202 are a powerful microcontroller which provides a highly flexible and cost effective solution
to many small applications. The GMS81C1102 and GMS81C1202 provide the following standard features: 2K bytes of
ROM, 128 bytes of RAM, 8-bit timer/counter, 8-bit A/D converter, 10-bit High Speed PWM Output, Programmable Buzzer
Driving Port (GMS81C1202 only), on-chip oscillator and clock circuitry. In addition, the GMS81C1102 and GMS81C1202
support power saving modes to reduce power consumption.
This document is only explained for the base of GMS81C1202, the eliminated functions are same as below.
1.2 Features
2K bytes On-chip Program Memory
128 Bytes of On-Chip Data RAM
Minimum Instruction execution time:
- 500ns at 8MHz (2cycle NOP Instruction)
2.2V to 6.0V Wide Operating Range
Basic Interval Timer
Two 8-Bit Timer/ Counters
10-Bit High Speed PWM Output
Two external interrupt ports
(GMS81C1102 has one external interrupt port)
One Programmable Buzzer Driving port
(GMS81C1202 only)
15 Programmable I/O Lines
(GMS81C1102 has 11 programmable I/O lines)
Seven Interrupt Sources
(GMS81C1102 has Six interrupt sources)
8-Channel 8-Bit On-Chip Analog to Digital Con-
verter
Watch dog timer
Oscillation :
- Crystal
- Ceramic Resonator
- External Oscillator
- RC Oscillation
Power Down Mode
- STOP mode
- Wake-up Timer mode
- RC-WDT mode
Power Fail Processor
( Noise Immunity Circuit )
1.3 Development Tools
The GMS800 family is supported by a full-featured macro
assembler, an in-circuit emulators CHOICE-Dr.TM, and
add-on board type OTP writer Dr.WriterTM .
The availability of OTP devices is especially useful for
customers expecting frequent code changes and updates.
The OTP devices, packaged in plastic packages, permit the
user to program them once.
Device name
ROM Size
RAM Size
I/O
BUZ
INT1
Package
GMS81C1102
2K bytes
128 bytes
11
NO
NO
16DIP/SOP
GMS81C1202
2K bytes
128 bytes
15
YES
YES
20DIP/SOP
GMS87C1102
2K bytes(OTP)
128 bytes
11
NO
NO
16DIP/SOP
GMS87C1202
2K bytes(OTP)
128 bytes
15
YES
YES
20DIP/SOP
In Circuit Emulator
CHOICE-Dr.
Assembler
Hynix Semiconductor
Macro Assembler
OTP Writer
Dr.Writer
GMS81C1102 / GMS81C1202
2
Jan. 2002 ver 2.0
2. BLOCK DIAGRAM(GMS81C1202)
3. PIN ASSIGNMENT(GMS81C1202)
ALU
Accumulator
Stack Pointer
Interrupt Controller
Data
Memory
8-bit
Converter
A/D
8-bit
Counter
Timer/
Program
Memory
Data Table
PC
8-bit Basic
Timer
Interval
Watch-dog
Timer
Instruction
RA
RB
RC
Buzzer
Driver
PSW
System controller
Timing generator
System
Clock Controller
Clock
Generator
RESET
Xin
Xout
RA0 / EC0
RA1 / AN1
RA2 / AN2
RA3 / AN3
RA4 / AN4
RA5 / AN5
RA6 / AN6
RA7 / AN7
RB0 / AN0 / Avref
RB1 / BUZ
RB2 / INT0
RB3 / INT1
RB4 / CMP0 / PWM
RC0
RC1
V
DD
V
SS
Power
Supply
Decoder
High
PWM
Speed
1
2
3
4
5
6
7
8
9
10
20
19
18
17
16
15
14
13
12
11
RA3 / AN3
RA2 / AN2
RA1 / AN1
RA0 / EC0
RC1
RC0
V
SS
RESET
Xout
Xin
AN4 / RA4
AN5 / RA5
AN6 / RA6
AN7 / RA7
V
DD
AN0 / AVref / RB0
BUZ / RB1
INT0 / RB2
INT1 / RB3
PWM / COMP0 / RB4
RA3 / AN3
RA2 / AN2
RA1 / AN1
RA0 / EC0
RC1
RC0
V
SS
RESET
Xout
Xin
AN4 / RA4
AN5 / RA5
AN6 / RA6
AN7 / RA7
V
DD
AN0 / AVref / RB0
BUZ / RB1
INT0 / RB2
INT1 / RB3
PWM / COMP0 / RB4
20 DIP
20 SOP
1
2
3
4
5
6
7
8
9
10
20
19
18
17
16
15
14
13
12
11
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
3
4. BLOCK DIAGRAM(GMS81C1102)
5. PIN ASSIGNMENT(GMS81C1102)
ALU
Accumulator
Stack Pointer
Interrupt Controller
Data
Memory
8-bit
Converter
A/D
8-bit
Counter
Timer/
Program
Memory
Data Table
PC
8-bit Basic
Timer
Interval
Watch-dog
Timer
Instruction
RA
RB
PSW
System controller
Timing generator
System
Clock Controller
Clock
Generator
RESET
Xin
Xout
RA0 / EC0
RA1 / AN1
RA2 / AN2
RA3 / AN3
RA4 / AN4
RA5 / AN5
RA6 / AN6
RA7 / AN7
RB0 / AN0 / Avref
RB2 / INT0
RB4 / CMP0 / PWM
V
DD
V
SS
Power
Supply
Decoder
High
PWM
Speed
1
2
3
4
5
6
7
8
9
10
16
15
14
13
12
11
RA3 / AN3
RA2 / AN2
RA1 / AN1
RA0 / EC0
V
SS
RESET
Xout
Xin
AN4 / RA4
AN5 / RA5
AN6 / RA6
AN7 / RA7
V
DD
AN0 / AVref / RB0
INT0 / RB2
PWM / COMP0 / RB4
RA3 / AN3
RA2 / AN2
RA1 / AN1
RA0 / EC0
V
SS
RESET
Xout
Xin
AN4 / RA4
AN5 / RA5
AN6 / RA6
AN7 / RA7
V
DD
AN0 / AVref / RB0
INT0 / RB2
PWM / COMP0 / RB4
16 DIP
16 SOP
1
2
3
4
5
6
7
8
9
10
16
15
14
13
12
11
GMS81C1102 / GMS81C1202
4
Jan. 2002 ver 2.0
6. PACKAGE DIMENSION(GMS81C1202)
26.2
0.3
0.46
0.07
1.45
0.2
TYP 2.54
TYP 7.62
6.54
0.3
0.25
0.05
0 ~ 15
MAX 4.57
MIN 0.38
3.3
0.25
7.5
0.1
10.35
0.2
12.8
0.2
2.5
0.15
0.42
0.08
TYP 1.27
0.2
0.1
0.26
0.05
0 ~ 8
0.7
0.3
20 DIP
20 SOP
unit : mm
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
5
7. PACKAGE DIMENSION(GMS81C1102)
19.2
0.2
0.46
0.07
1.45
0.2
TYP 2.54
TYP 7.62
6.3
0.3
0.25
0.05
0 ~ 15
MAX 4.32
MIN 0.38
3.3
0.25
7.5
0.1
10.35
0.2
10.25
0.05
2.5
0.15
0.42
0.08
TYP 1.27
0.18
0.05
0.27
0.04
0 ~ 8
0.7
0.3
16 DIP
16 SOP
unit : mm
0.75
0.3
GMS81C1102 / GMS81C1202
6
Jan. 2002 ver 2.0
8. PIN FUNCTION
V
DD
: Supply voltage.
V
SS
: Circuit ground.
RESET: Reset the MCU.
X
IN
: Input to the inverting oscillator amplifier and input to
the internal clock operating circuit.
X
OUT
: Output from the inverting oscillator amplifier. If
RC Option is used, the oscillator frequency divided by 4
(Xin/4) comes out from Xout pin.
RA0~RA7: RA is an 8-bit, CMOS, bidirectional I/O port.
RA pins can be used as outputs or inputs according to "1"
or "0" written in the Port Direction Register(RAIO).
In addition, RA serves the functions of the various special
features in Table 8-1.
RB0~RB4: RB is a 5-bit, CMOS, bidirectional I/O port.
RB pins can be used as outputs or inputs according to "1"
or "0" written in the Port Direction Register(RBIO).
RB serves the functions of the various following special
features.
RC0~RC1: RC is a 2-bit, CMOS, bidirectional I/O port.
RC pins can be used as outputs or inputs according to "1"
or "0" written in the Port Direction Register(RCIO)
.
Port pin
Alternate function
RA0
RA1
RA2
RA3
RA4
RA5
RA6
RA7
EC0 ( Event Counter Input Source )
AN1 ( Analog Input Port 1 )
AN2 ( Analog Input Port 2 )
AN3 ( Analog Input Port 3 )
AN4 ( Analog Input Port 4 )
AN5 ( Analog Input Port 5 )
AN6 ( Analog Input Port 6 )
AN7 ( Analog Input Port 7 )
Table 8-1 RA Port
Port pin
Alternate function
RB0
RB1
RB2
RB3
RB4
AN0 ( Analog Input Port 0 )
AVref ( External Analog Reference Pin )
BUZ ( Buzzer Driving Output Port )
INT0 ( External Interrupt Input Port 0 )
INT1 ( External Interrupt Input Port 1 )
PWM ( PWM Output )
COMP0 ( Timer0 Compare Output )
Table 8-2 RB Port
PIN NAME
Pin No.
In/Out
Function
V
DD
5
-
Supply voltage
V
SS
14
-
Circuit ground
RESET
13
I
Reset signal input
X
IN
11
I
X
OUT
12
O
RA0 (EC0)
17
I/O (Input)
8-bit general I/O ports
External Event Counter input
RA1 (AN1)
18
I/O (Input)
Analog Input Port 1
RA2 (AN2)
19
I/O (Input)
Analog Input Port 2
RA3 (AN3)
20
I/O (Input)
Analog Input Port 3
RA4 (AN4)
1
I/O (Input)
Analog Input Port 4
RA5 (AN1)
2
I/O (Input)
Analog Input Port 5
RA6 (AN1)
3
I/O (Input)
Analog Input Port 6
RA7 (AN7)
4
I/O (Input)
Analog Input Port 7
RB0 (AVref/AN0)
6
I/O (Input)
5-bit general I/O ports
Analog Input Port 0 / Analog Reference
RB1 (BUZ)
7
I/O (Output)
Buzzer Driving Output
RB2 (INT0)
8
I/O (Input)
External Interrupt Input 0
RB3 (INT1)
9
I/O (Input)
External Interrupt Input 1
RB4 (PWM/COMP0)
10
I/O (Output/Output)
PWM Output or Timer Compare Output
RC0
15
I/O
2-bit general I/O ports
RC1
16
I/O
Table 8-3 Pin Description
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
7
9. PORT STRUCTURES
RESET
Xin, Xout
RA0/EC0
V
SS
Internal RESET
V
DD
V
SS
Xout
Xin
RC option
fxin
4
STOP
To System CLK
V
DD
0
1
Data Bus
Data Bus
Data Bus
Data Reg.
Direction Reg.
Read
EC0
GMS81C1102 / GMS81C1202
8
Jan. 2002 ver 2.0
RA1/AN1 ~ RA7/AN7
RB0 / AN0 / AVref
V
DD
V
SS
Data Bus
Data Bus
Data Bus
Read
To A/D Converter
Analog Input Mode
(ANSEL7 ~ 1)
Analog CH. Selection
(ADCM.4 ~ 2)
Data Reg.
Direction Reg.
V
DD
V
SS
Data Bus
Data Bus
Data Bus
Read
To A/D Converter
Analog Input Mode
(ANSEL0)
Analog CH0 Selection
(ADCM.4 ~ 2)
AVREFS
AVREFS
Internal V
DD
0
1
To Vref of A/D
Data Reg.
Direction Reg.
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
9
RB1/BUZ, RB4/PWM0/COMP
RB2/INT0, RB3/INT1
RC0, RC1
V
DD
V
SS
Data Bus
Data Bus
Data Bus
Read
0
1
Function
Select
PWM/COMP
BUZ
Data Reg.
Direction Reg.
V
DD
V
SS
Data Bus
Data Bus
Data Bus
Read
Function
Select
Pull-up
Select
INT0
INT1
Schmitt Trigger
Weak Pull-up
Data Reg.
Direction Reg.
V
DD
V
SS
Data Bus
Data Bus
Data Bus
Read
Data Reg.
Direction Reg.
GMS81C1102 / GMS81C1202
10
Jan. 2002 ver 2.0
10. ELECTRICAL CHARACTERISTICS -GMS81C1102, GMS81C1202
10.1 Absolute Maximum Ratings - GMS81C1102, GMS81C1202
Supply voltage ........................................... -0.3 to +6.5 V
Storage Temperature ................................-40 to +125
C
Voltage on any pin with respect to Ground (V
SS
)
............................................................... -0.3 to V
DD
+0.3
Maximum current out of V
SS
pin ........................200 mA
Maximum current into V
DD
pin ..........................150 mA
Maximum current sunk by (I
OL
per I/O Pin) ........25 mA
Maximum output current sourced by (I
OH
per I/O Pin)
...............................................................................15 mA
Maximum current (
I
OL
) .................................... 150 mA
Maximum current (
I
OH
).................................... 100 mA
Note: Stresses above those listed under "Absolute Maxi-
mum Ratings" may cause permanent damage to the
device. This is a stress rating only and functional op-
eration of the device at any other conditions above
those indicated in the operational sections of this
specification is not implied. Exposure to absolute
maximum rating conditions for extended periods
may affect device reliability.
10.2 Recommended Operating Conditions - GMS81C1102, GMS81C1202
Parameter
Symbol
Condition
Specifications
Unit
Min.
Max.
Supply Voltage
V
DD
f
XIN
=8MHz
4.5
6.0
V
f
XIN
=4.2MHz
2.2
6.0
Operating Frequency
f
XIN
V
DD
=4.5~6.0V
1
8
MHz
V
DD
=2.2~6.0V
1
4.2
Operating Temperature
T
OPR
-20
85
C
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
11
10.3 DC Electrical Characteristics - GMS81C1102, GMS81C1202
(V
DD
=4.5~6.0V, V
SS
=0V, f
XIN
=1MHz~8MHz, T
A
=-20



C~+85



C)
Parameter
Symbol
Pin
1
1.
RC0, RC1, RB1 and RB3 pins are applied for GMS81C1202 only.
Test Condition
Specification
Unit
Min
Typ
2
2.
Data in "Typ" column is at 5V, 25
C unless otherwise stated. These parameters are for design guidance only and are not tested.
Max
Input High Voltage
V
IH1
X
IN,
RESET
V
DD
=4.5~6.0V
0.8V
DD
V
DD
V
V
IH2
RB2, RB3
0.8V
DD
V
DD
V
IH3
RA,RB0,RB1,RB4,RC
0.7V
DD
V
DD
Input Low Voltage
V
IL1
X
IN,
RESET
V
DD
=4.5~6.0V
0
0.2V
DD
V
V
IL2
RB2, RB3
0
0.2V
DD
V
IL3
RA,RB0,RB1,RB4,RC
0
0.3V
DD
Output High Voltage
V
OH
RA, RB, RC
V
DD
= 5V, I
OH
= -2mA
V
DD
-1
V
Output Low Voltage
V
OL
RA, RB, RC
V
DD
= 5V, I
OL
= 10mA
1
V
Input
Leakage Current
I
IL
RESET,RA,RB,RC
V
IN
= V
SS
~V
DD
5
uA
I
IL
X
IN
20
Input Pull-up Current
I
PU
RB2, RB3
3
3.
This parameter is valid when the bit PUPSELx is selected and set the Input mode or Interrupt Input Function.
V
DD
= 5V, V
IN
= V
SS
-350
-280
-200
uA
Power Fail Detect Voltage
V
PFD
V
DD
2
3.5
4
V
Normal Operating Current
I
DD
V
DD
V
DD
=6.0V, f
XIN
=8MHz
4
6
mA
Wake-up Timer Mode
Current
I
WKUP
V
DD
V
DD
=6.0V, f
XIN
=8MHz
1
2
mA
RC-oscillated Watchdog
Timer Mode Current
I
RCWDT
V
DD
V
DD
= 6.0V,
f
XIN
= 8MHz
0.6
0.8
mA
STOP Mode Current
I
STOP
V
DD
V
DD
= 6.0V
0.5
2
uA
Hysteresis
V
T+
~ V
T-
RESET, RB2, RB3
0.5
V
Internal RC Oscillation
Period ( RC-WDT CLK )
T
RCWDT
X
OUT
V
DD
= 5V,
f
XIN
= 8MHz
100
200
uS
RC Oscillation Frequency
( System CLK )
f
RCOSC
4
4.
This parameter is measured in X
OUT
pin, and measured frequency is must be 4times to be internal system clock because of this
X
OUT
signal is divided by 4 of system clock.
X
OUT
R = 15K
, C=30pF
400
600
kHz
GMS81C1102 / GMS81C1202
12
Jan. 2002 ver 2.0
(V
DD
=2.2~6.0V, V
SS
=0V, f
XIN
=1MHz~4.2MHz, T
A
=-20



C
~+85



C
)
Parameter
Symbol
Pin
1
1.
RC0, RC1, RB1 and RB3 pins are applied for GMS81C1202 only.
Test Condition
Specification
Unit
Min
Typ
2
2.
Data in "Typ" column is at 3V, 25
C unless otherwise stated. These parameters are for design guidance only and are not tested.
Max
Input High Voltage
V
IH1
X
IN
V
DD
=2.2~6.0V
0.8V
DD
V
DD
V
V
IH2
RESET
0.9V
DD
V
DD
V
IH3
RB2, RB3
0.8V
DD
V
DD
V
IH4
RA,RB0,RB1,RB4,RC
0.7V
DD
V
DD
Input Low Voltage
V
IL1
X
IN
V
DD
=2.2~6.0V
0
0.2V
DD
V
V
IL2
RESET
0
0.1V
DD
V
IL3
RB2, RB3
0
0.2V
DD
V
IL4
RA,RB0,RB1,RB4,RC
0
0.3V
DD
Output High Voltage
V
OH
RA, RB, RC
V
DD
= 3V, I
OH
= -2mA
2.5
V
Output Low Voltage
V
OL
RA, RB, RC
V
DD
= 3V, I
OL
= 5mA
0.7
V
Input
Leakage Current
I
IL
RESET,RA,RB,RC
V
IN
= V
SS
~V
DD
5
uA
I
IL
X
IN
15
Input Pull-up Current
I
PU
RB2, RB3
3
3.
This parameter is valid when the bit PUPSELx is selected and set the Input mode or Interrupt Input Function.
V
DD
= 3V, V
IN
= V
SS
-100
-60
-40
uA
Power Fail Detect Voltage
V
PFD
V
DD
2
3.5
4
V
Normal Operating Current
I
DD
V
DD
V
DD
= 3V, f
XIN
= 4MHz
2
3
mA
Wake-up Timer Mode
Current
I
WKUP
V
DD
V
DD
= 3V, f
XIN
= 4MHz
0.5
1
mA
RC-oscillated Watchdog
Timer Mode Current
I
RCWDT
V
DD
V
DD
= 3V, f
XIN
= 4MHz
0.3
0.6
mA
STOP Mode Current
I
STOP
V
DD
V
DD
= 3V
0.2
1
uA
Hysteresis
V
T+
~ V
T-
RESET, RB2, RB3
0.5
V
Internal RC Oscillation
Period ( RC-WDT CLK )
T
RCWDT
X
OUT
V
DD
= 3V, f
XIN
= 4MHz
200
400
uS
RC Oscillation Frequency
( System CLK )
f
RCOSC
4
4.
This parameter is measured in X
OUT
pin, and measured frequency is must be 4times to be internal system clock because of this
X
OUT
signal is divided by 4 of system clock.
X
OUT
V
DD
= 3V,
R = 47K
, C=7pF
200
300
kHz
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
13
10.4 A/D Converter Characteristics - GMS81C1102, GMS81C1202
(V
SS
=0V, V
DD
=3.072V/@f
XIN
=4MHz, V
DD
=5.12V/@f
XIN
=8MHz, T
A
=-20



C~+85



C )
Parameter
Symbol
Condition
Specifications
Unit
Min.
Typ.
Max.
Analog Input Voltage Range
V
AIN
AVREFS=0
V
SS
-
V
DD
V
AVREFS=1
V
SS
-
V
REF
Analog Power Supply Input Voltage Range
V
REF
AVREFS=1
3
-
V
DD
V
Overall Accuracy
N
ACC
-
1.0
1.5
LSB
Non-Linearity Error
N
NLE
-
0.8
1.2
LSB
Differential Non-Linearity Error
N
DNLE
-
1.0
1.5
LSB
Zero Offset Error
N
ZOE
-
1.0
1.5
LSB
Full Scale Error
N
FSE
-
0.25
0.5
LSB
Gain Error
N
NLE
-
1.0
1.5
LSB
Conversion Time
T
CONV
f
XIN
=4MHz
-
-
20
S
f
XIN
=8MHz
-
-
10
AV
REF
Input Current
I
REF
f
XIN
=4MHz
-
0.4
0.6
mA
f
XIN
=8MHz
-
0.5
1.0
GMS81C1102 / GMS81C1202
14
Jan. 2002 ver 2.0
10.5 AC Characteristics - GMS81C1102, GMS81C1202
(T
A
=-20~+85
C, V
DD
=5V
10%
,
V
SS
=0V)
Figure 10-1 Timing Chart
Parameter
Symbol
Pins
Specifications
Unit
Min.
Typ.
Max.
Operating Frequency
f
CP
X
IN
1
-
8
MHz
External Clock Pulse Width
t
CPW
X
IN
50
-
-
nS
External Clock Transition Time
t
RCP,
t
FCP
X
IN
-
-
20
nS
External Input Pulse Width
t
EPW
INT0, INT1, EC0
2
-
-
t
SYS
RESET Input Width
t
RST
RESET
8
-
-
t
SYS
t
RCP
t
FCP
X
IN
INT0, INT1
EC0
0.5V
V
DD
-0.5V
0.2V
DD
RESET
0.2V
DD
0.8V
DD
t
RST
t
EPW
t
EPW
1/f
CP
t
CPW
t
CPW
t
SYS
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
15
10.6 Typical Characteristics - GMS81C1102, GMS81C1202
This graphs and tables provided in this section are for de-
sign guidance only and are not tested or guranteed.
In some graphs or tables the data presented are out-
side specified operating range (e.g. outside specified
V
DD
range). This is for imformation only and divices
are guranteed to operate properly only within the
specified range.
The data presented in this section 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
) respectively where
is standard deviation
Ta= 25
C
Ta=25
C
I
DD
-
V
DD
8
6
4
2
0
(mA)
I
DD
2
3
4
5
6
V
DD
(V)
Normal Operation
8
6
4
2
0
(MHz)
f
XIN
2
3
4
5
6
V
DD
(V)
Operating Area
4MHz
12
I
WKUP
-
V
DD
2.0
1.5
1.0
0.5
0
(mA)
I
DD
2
3
4
5
6
V
DD
(V)
Wake-up Timer Mode
I
RCWDT
-
V
DD
400
300
200
100
0
(
A)
I
DD
2
3
4
5
6
V
DD
(V)
RC-WDT in Stop Mode
Ta=25
C
f
XIN
= 8MHz
4MHz
f
XIN
= 4/8 MHz
4MHz
Ta=25
C
Frequency affects
the current so little.
10
I
STOP
-
V
DD
0.8
0.6
0.4
0.2
0
(
A)
I
DD
2
3
4
5
6
V
DD
(V)
Stop Mode
25
C , 125
C
Ta= - 40
C
f
XIN
=8MHz
f
XIN
= 8MHz
GMS81C1102 / GMS81C1202
16
Jan. 2002 ver 2.0
I
OL
-
V
OL
, V
DD
=5V
16
12
8
4
0
(mA)
I
OL
V
OL
(V)
I
OH
-
V
OH
, V
DD
=5V
-8
-6
-4
-2
0
(mA)
I
OH
4
4.5
5
V
OH
(V)
0.2
0.4
0.6
0.8
1.0
-40
C
125
C
25
C
-40
C
125
C
25
C
20
I
OL
-
V
OL
, V
DD
=3V
12
8
4
0
(mA)
I
OL
V
OL
(V)
0.2
0.4
0.6
0.8
1.0
125
C
-40
C
25
C
-10
I
OH
-
V
OH
, V
DD
=5V
-6
-4
-2
0
(mA)
I
OH
2
2.5
3
V
OH
(V)
-40
C
125
C
25
C
-8
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
17
V
DD
-
V
IH1
4
3
2
1
0
(V)
V
IH1
2
3
4
5
6
V
DD
(V)
V
DD
-
V
IH2
4
3
2
1
0
(V)
V
IH2
2
3
4
5
6
V
DD
(V)
1
X
IN
Hysteresis input
V
DD
-
V
IH4
4
3
2
1
0
(V)
V
IH4
2
3
4
5
6
V
DD
(V)
RESET
f
XIN
=4MHz
V
DD
-
V
IL1
4
3
2
1
0
(V)
V
IL1
2
3
4
5
6
V
DD
(V)
V
DD
-
V
IL2
4
3
2
1
0
(V)
V
IL2
2
3
4
5
6
V
DD
(V)
Ta=25
C
1
X
IN
Hysteresis input
V
D D
-
V
IL 4
4
3
2
1
0
(V )
V
IL 4
2
3
4
5
6
V
D D
(V )
R ES ET
V
DD
-
V
IH3
4
3
2
1
0
(V)
V
IH3
2
3
4
5
6
V
DD
(V)
Normal input
1
V
DD
-
V
IL3
4
3
2
1
0
(V)
V
IL3
2
3
4
5
6
V
DD
(V)
Normal input
1
f
X IN
=4M Hz
Ta=25
C
f
X IN
=4M Hz
Ta=25
C
f
X IN
=4M Hz
Ta=25
C
f
X IN
=4M Hz
Ta=25
C
f
X IN
=4M Hz
Ta=25
C
f
X IN
=4M Hz
Ta=25
C
f
X IN
=4M Hz
Ta=25
C
GMS81C1102 / GMS81C1202
18
Jan. 2002 ver 2.0
Table 10-1 RC Oscillator Frequencies
Cext
Rext
Average
Fosc @ 5V,25
C
24pF
20K
2.02MHz
14.11%
33K
1.34MHz
11.50%
47K
0.952MHz
10.30%
100K
0.48MHz
9.07%
39pF
20K
1.536MHz
14.79%
33K
1.012MHz
11.67%
47K
0.72MHz
10.42%
100K
0.364MHz
9.75%
100pF
20K
0.78MHz
13.53%
33K
0.512MHz
10.35%
47K
0.364MHz
9.48%
100K
0.18MHz
7.34%
T yp ica l R C O scilla to r
1.5
1 .0
0.5
0
(M H z)
F
O S C
2.5
3
4
5
6
V
D D
(V )
F re q u e n cy
V S
. V
D D
2.5
2.0
3.5
4.5
5.5
Ta=25
C
R = 2 0 k
R = 3 3K
R = 47 K
R = 10 0K
T ypical R C O scillato r
1.2
1.0
0.8
0
(M H z )
F
O S C
2.5
3
4
5
6
V
D D
(V )
F req ue n cy
V S
. V
D D
1.6
1.4
3.5
4 .5
5.5
R = 2 0 K
R = 47K
R = 100K
0.2
0.4
0.6
R = 33K
T yp ica l R C O scilla to r
0.6
0 .5
0.4
0
(M H z)
F
O S C
2.5
3
4
5
6
V
D D
(V )
F re q u e n cy
V S
. V
D D
0.8
0.7
3.5
4 .5
5 .5
R =2 0 K
R = 47 K
R = 10 0K
0.1
0.2
0.3
R = 3 3K
T yp ica l R C O scilla tor
1 .0 0 5
1.00 0
0.99 5
0 .9 7 5
F
O S C
0
10
30
5 0
7 0
V
D D
(V )
F re q ue n cy
V S
. T e m pe ra ture
1 .0 1 0
2 0
4 0
6 0
0 .9 8 0
0 .9 8 5
0 .9 9 0
V D D =5 V
V D D = 3V
F
O S C
(25
C )
C ext= 24pF
Ta= 25
C
C e xt= 3 9 p F
Ta=25
C
C e xt= 100p F
R = 25K
C ext=24pF
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
19
11. ELECTRICAL CHARACTERISTICS - GMS87C1102, GMS87C1202
11.1 Absolute Maximum Ratings - GMS87C1102, GMS87C1202
Supply voltage ........................................... -0.3 to +6.5 V
Storage Temperature ................................-40 to +125
C
Voltage on any pin with respect to Ground (V
SS
)
............................................................... -0.3 to V
DD
+0.3
Maximum current out of V
SS
pin ........................200 mA
Maximum current into V
DD
pin ..........................150 mA
Maximum current sunk by (I
OL
per I/O Pin) ........25 mA
Maximum output current sourced by (I
OH
per I/O Pin)
...............................................................................15 mA
Maximum current (
I
OL
) .................................... 150 mA
Maximum current (
I
OH
).................................... 100 mA
Note: Stresses above those listed under "Absolute Maxi-
mum Ratings" may cause permanent damage to the
device. This is a stress rating only and functional op-
eration of the device at any other conditions above
those indicated in the operational sections of this
specification is not implied. Exposure to absolute
maximum rating conditions for extended periods
may affect device reliability.
11.2 Recommended Operating Conditions - GMS87C1102, GMS87C1202
Parameter
Symbol
Condition
Specifications
Unit
Min.
Max.
Supply Voltage
V
DD
f
XIN
=8MHz
4.5
5.5
V
f
XIN
=4.2MHz
2.7
5.5
Operating Frequency
f
XIN
V
DD
=4.5~5.5V
1
8
MHz
V
DD
=2.7~5.5V
1
4.2
Operating Temperature
T
OPR
-20
85
C
GMS81C1102 / GMS81C1202
20
Jan. 2002 ver 2.0
11.3 DC Electrical Characteristics - GMS87C1102, GMS87C1202
(T
A
=-20~85
C, V
DD
=2.7~5.5V
,
V
SS
=0V)
Parameter
Symbol
Pin
1
1.
RC0, RC1, RB1 and RB3 pins are applied for GMS87C1202 only.
Test Condition
Specification
Unit
Min
Typ
2
2.
Data in "Typ" column is at 5V, 25
C unless otherwise stated. These parameters are for design guidance only and are not tested.
Max
Input High Voltage
V
IH1
X
IN,
RESET
0.8V
DD
V
DD
V
V
IH2
RB2, RB3
0.8V
DD
V
DD
V
IH3
RA,RB0,RB1,RB4,RC
0.7V
DD
V
DD
Input Low Voltage
V
IL1
X
IN,
RESET
0
0.2V
DD
V
V
IL2
RB2, RB3
0
0.2V
DD
V
IL3
RA,RB0,RB1,RB4,RC
0
0.3V
DD
Output High
Voltage
V
OH
RA, RB, RC
V
DD
= 5V, I
OH
= -5mA
V
DD
-1
V
Output Low
Voltage
V
OL
RA, RB, RC
V
DD
= 5V, I
OL
= 10mA
1.0
V
Input High
Leakage Current
I
IH1
RESET,RA,RB,RC
V
DD
= 5.5V
5
uA
I
IH2
X
IN
15
Input Low
Leakage Current
I
IL1
RESET,RA,RB,RC
V
DD
= 5.5V
-5
uA
I
IL2
X
IN
-15
Input Pull-up
Current
I
P
RB2, RB3
3
3.
This parameter is valid when the bit PUPSELx is selected and set the Input mode or Interrupt Input Function.
V
DD
= 5V
-350
-280
-200
uA
V
DD
= 3V
-100
-60
-40
Power Fail Detect Voltage
V
PFD
V
DD
V
DD
= 5V
2
3.5
4
V
Normal Operating Current
I
DD
V
DD
V
DD
= 5.5V,
f
XIN
= 8MHz
4
6
mA
V
DD
= 3V,
f
XIN
= 4MHz
2
3
Wake-up Timer Mode
Current
I
WKUP
V
DD
V
DD
= 5.5V,
f
XIN
= 8MHz
1
1.8
mA
V
DD
= 3V,
f
XIN
= 4MHz
0.5
1
RC-oscillated Watchdog
Timer Mode Current
I
RCWDT
V
DD
V
DD
= 5.5V,
f
XIN
= 8MHz
0.6
0.8
mA
V
DD
= 3V,
f
XIN
= 4MHz
0.3
0.6
STOP Mode Current
I
STOP
V
DD
V
DD
= 5.5V, f
XIN
= 8MHz
0.5
2
uA
V
DD
= 3V,
f
XIN
= 4MHz
0.2
1
Hysteresis
V
T+
~ V
T-
RESET, RB2, RB3
0.5
V
Internal RC Oscillation
Period ( RC-WDT CLK )
T
RCWDT
X
OUT
V
DD
= 5V
100
250
uS
V
DD
= 3V
200
500
RC Oscillation Frequency
( System CLK )
f
RCOSC
4
4.
This parameter is measured in X
OUT
pin, and measured frequency is must be 4times to be internal system clock because of this
X
OUT
signal is divided by 4 of system clock.
X
OUT
V
DD
= 5V,
R = 15K
, C=30pF
400
600
KHz
V
DD
= 3V,
R = 47K
, C=7pF
200
300
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
21
11.4 A/D Converter Characteristics - GMS87C1102, GMS87C1202
(T
A
=25
C, V
SS
=0V, V
DD
=5.12V @
f
XIN
=8MHz , V
DD
=3.072V @
f
XIN
=4MHz )
Parameter
Symbol
Condition
Specifications
Unit
Min.
Typ.
Max.
Analog Input Voltage Range
V
AIN
AVREFS=0
V
SS
-
V
DD
V
AVREFS=1
V
SS
-
V
REF
Analog Power Supply Input Voltage Range
V
REF
AVREFS=1
3
-
V
DD
V
Overall Accuracy
N
ACC
-
1.0
1.5
1
1.
This parameter is valid in the range from 02H to FFH, and typical value
1.3 LSB, maximum value
2.0 LSB in the other range (from
00H to 01H).
LSB
Non-Linearity Error
N
NLE
-
0.8
1.2
LSB
Differential Non-Linearity Error
N
DNLE
-
1.0
1.5
LSB
Zero Offset Error
N
ZOE
-
1.3
2.0
LSB
Full Scale Error
N
FSE
-
0.25
0.5
LSB
Gain Error
N
NLE
-
1.0
1.5
LSB
Conversion Time
T
CONV
f
XIN
=8MHz
-
-
10
S
f
XIN
=4MHz
-
-
20
AV
REF
Input Current
I
REF
AVREFS=1
-
0.5
1.0
mA
GMS81C1102 / GMS81C1202
22
Jan. 2002 ver 2.0
11.5 AC Characteristics - GMS87C1102, GMS87C1202
(T
A
=-20~+85
C, V
DD
=5V
10%
,
V
SS
=0V)
Figure 11-1 Timing Chart
Parameter
Symbol
Pins
Specifications
Unit
Min.
Typ.
Max.
Operating Frequency
f
CP
X
IN
1
-
8
MHz
External Clock Pulse Width
t
CPW
X
IN
50
-
-
nS
External Clock Transition Time
t
RCP,
t
FCP
X
IN
-
-
20
nS
Oscillation Stabilizing Time
t
ST
X
IN
, X
OUT
-
-
20
mS
External Input Pulse Width
t
EPW
INT0, INT1, EC0
2
-
-
t
SYS
RESET Input Width
t
RST
RESET
8
-
-
t
SYS
t
RCP
t
FCP
X
IN
INT0, INT1
0.5V
V
DD
-0.5V
0.2V
DD
RESET
0.2V
DD
0.8V
DD
EC0
t
RST
t
EPW
t
EPW
1/f
CP
t
CPW
t
CPW
t
SYS
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
23
11.6 Typical Characteristics - GMS87C1102, GMS87C1202
This graphs and tables provided in this section are for de-
sign guidance only and are not tested or guranteed.
In some graphs or tables the data presented are out-
side specified operating range (e.g. outside specified
V
DD
range). This is for imformation only and divices
are guranteed to operate properly only within the
specified range.
The data presented in this section 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
) respectively where
is standard deviation
Ta= 25
C
Ta=25
C
I
DD
-
V
DD
8
6
4
2
0
(mA)
I
DD
2
3
4
5
6
V
DD
(V)
Normal Operation
8
6
4
2
0
(MHz)
f
XIN
2
3
4
5
6
V
DD
(V)
Operating Area
f
XIN
= 8MHz
4MHz
10
I
WKUP
-
V
DD
2.0
1.5
1.0
0.5
0
(mA)
I
DD
2
3
4
5
6
V
DD
(V)
Wake-up Timer Mode
I
RCWDT
-
V
DD
20
15
10
5
0
(
A)
I
DD
2
3
4
5
6
V
DD
(V)
RC-WDT in Stop Mode
Ta=25
C
f
XIN
= 8MHz
4MHz
f
XIN
= 8MHz
4MHz
Ta=25
C
GMS81C1102 / GMS81C1202
24
Jan. 2002 ver 2.0
I
OL
-
V
OL
, V
DD
=5V
40
30
20
10
0
(mA)
I
OL
V
OL
(V)
I
OH
-
V
OH
, V
DD
=5V
-20
-15
-10
-5
0
(mA)
I
OH
2
3
4
5
6
V
OH
(V)
1
2
3
4
5
f
XIN
=4MHz
V
DD
-
V
IH1
4
3
2
1
0
(V)
V
IH1
2
3
4
5
6
V
DD
(V)
V
DD
-
V
IH2
4
3
2
1
0
(V)
V
IH2
2
3
4
5
6
V
DD
(V)
Ta=25
C
f
X IN
=4kH z
Ta=25
C
1
X
IN
, RESET
Hysteresis input
-25
C
85
C
25
C
-25
C
85
C
25
C
V
DD
-
V
IH3
4
3
2
1
0
(V)
V
IH3
2
3
4
5
6
V
DD
(V)
f
X IN
=4kH z
Ta=25
C
Normal input
f
XIN
=4MHz
V
DD
-
V
IL1
4
3
2
1
0
(V)
V
IL1
2
3
4
5
6
V
DD
(V)
V
DD
-
V
IL2
4
3
2
1
0
(V)
V
IL2
2
3
4
5
6
V
DD
(V)
Ta=25
C
f
X IN
=4kH z
Ta=25
C
1
X
IN
, RESET
Hysteresis input
V
DD
-
V
IL3
4
3
2
1
0
(V)
V
IL3
2
3
4
5
6
V
DD
(V)
f
X IN
=4kH z
Ta=25
C
Normal input
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
25
Table 11-1 RC Oscillator Frequencies
Cext
Rext
Average
Fosc @ 5V,25
C
24pF
20K
2.02MHz
14.11%
33K
1.34MHz
11.50%
47K
0.952MHz
10.30%
100K
0.48MHz
9.07%
39pF
20K
1.536MHz
14.79%
33K
1.012MHz
11.67%
47K
0.72MHz
10.42%
100K
0.364MHz
9.75%
100pF
20K
0.78MHz
13.53%
33K
0.512MHz
10.35%
47K
0.364MHz
9.48%
100K
0.18MHz
7.34%
T yp ica l R C O scilla to r
1.5
1 .0
0.5
0
(M H z)
F
O S C
2.5
3
4
5
6
V
D D
(V )
F re q u e n cy
V S
. V
D D
2.5
2.0
3.5
4.5
5.5
Ta=25
C
R = 2 0 k
R = 3 3K
R = 47 K
R = 10 0K
T ypical R C O scillato r
1.2
1.0
0.8
0
(M H z )
F
O S C
2.5
3
4
5
6
V
D D
(V )
F req ue n cy
V S
. V
D D
1.6
1.4
3.5
4 .5
5.5
R = 2 0 K
R = 47K
R = 100K
0.2
0.4
0.6
R = 33K
T yp ica l R C O scilla to r
0.6
0 .5
0.4
0
(M H z)
F
O S C
2.5
3
4
5
6
V
D D
(V )
F re q u e n cy
V S
. V
D D
0.8
0.7
3.5
4 .5
5 .5
R =2 0 K
R = 47 K
R = 10 0K
0.1
0.2
0.3
R = 3 3K
T yp ica l R C O scilla tor
1 .0 0 5
1.00 0
0.99 5
0 .9 7 5
F
O S C
0
10
30
5 0
7 0
V
D D
(V )
F re q ue n cy
V S
. T e m pe ra ture
1 .0 1 0
2 0
4 0
6 0
0 .9 8 0
0 .9 8 5
0 .9 9 0
V D D =5 V
V D D = 3V
F
O S C
(25
C )
C ext= 24pF
Ta= 25
C
C e xt= 3 9 p F
Ta=25
C
C e xt= 100p F
R = 25K
C ext=24pF
GMS81C1102 / GMS81C1202
26
Jan. 2002 ver 2.0
12. MEMORY ORGANIZATION
The GMS81C1202 has separated address spaces for Pro-
gram memory and Data Memory. Program memory can
only be read, not written to. It can be up to 2K bytes of Pro-
gram memory. Data memory can be read and written to up
to 128 bytes including the stack area.
12.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.
Figure 12-1 Configuration of Registers
Accumulator
The Accumulator is the 8-bit general 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
.
Figure 12-2 Configuration of YA 16-bit Register
X, Y Registers
In the addressing mode which uses these index registers,
the register contents are added to the specified address,
which becomes the actual address. These modes are ex-
tremely effective for referencing subroutine tables and
memory tables. The index registers also have 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 iden-
tifies the location in the stack to be accessed (save or re-
store).
Generally, SP is automatically updated when a subroutine
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 00
H
to7F
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 initial-
ization routine. Normally, the initial value of "7F
H
" is used
.
Note: The Stack Pointer must be initialized by software be-
cause its value is undefined after RESET.
Example: To initialize the SP
LDX
#07FH
TXSP
; SP
7F
H
Program Counter
The Program Counter is a 16-bit wide which consists of
two 8-bit registers, PCH and PCL. This counter indicates
the address of the next instruction to be executed. In reset
state, the program counter has reset routine address
(PC
H
:0FF
H
, PC
L
:0FE
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 12-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.
A
ACCUMULATOR
X REGISTER
Y REGISTER
STACK POINTER
PROGRAM COUNTER
PROGRAM STATUS
WORD
X
Y
SP
PCL
PCH
PSW
Two 8-bit Registers can be used as a "YA" 16-bit Register
Y
A
Y
A
SP
0
Stack Address ( 000
H
~ 07F
H
)
15
0
8
7
Hardware fixed
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
27
[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.
[Zero flag Z]
This flag is set when the result of an arithmetic operation
or data transfer is "0" and is cleared by any other result.
Figure 12-3 PSW (Program Status Word) Register
[Interrupt disable flag I]
This flag enables/disables all interrupts except interrupt
caused by Reset or software BRK instruction. All inter-
rupts are disabled when cleared to "0". This flag immedi-
ately becomes "0" when an interrupt is served. It is set by
the EI instruction and cleared by the DI instruction.
[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 ad-
dress.
[Overflow flag V]
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
H
) or -128(80
H
). The CLRV instruction
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.
N
NEGATIVE FLAG
V
-
B
H
I
Z
C
MSB
LSB
RESET VALUE : 00
H
PSW
OVERFLOW FLAG
BRK FLAG
CARRY FLAG RECEIVES
ZERO FLAG
INTERRUPT ENABLE FLAG
CARRY OUT
HALF CARRY FLAG RECEIVES
CARRY OUT FROM BIT 1 OF
ADDITION OPERLANDS
GMS81C1102 / GMS81C1202
28
Jan. 2002 ver 2.0
12.2 Program Memory
A 16-bit program counter is capable of addressing up to
64K bytes, but this device has 2K bytes program memory
space only the physically implemented. Accessing a loca-
tion above FFFF
H
will cause a wrap-around to 0000
H
.
Figure 12-4 shows a map of the upper part of the Program
Memory. After reset, the CPU begins execution from reset
vector which is stored in address FFFE
H
, FFFF
H
.
As shown in Figure 12-4, each area is assigned a fixed lo-
cation in Program Memory. Program Memory area con-
tains the user program, Page Call (PCALL) area contains
subroutine program, to reduce program byte length be-
cause of using by 2 bytes PCALL instead of 3 bytes CALL
instruction. If it is frequently called, more useful to save
program byte length.
Figure 12-4 Program Memory Map
The Device Configuration Area can be programmed or left
unprogrammed to select device configuration such as RC
oscillation option. This area is not accessible during nor-
mal execution but is readable and writable during program
/ verify.
More detail informations are explained in device configu-
ration area section.
Table Call (TCALL) causes the CPU to jump to each
TCALL address, where it commences execution of the
service routine. The Table Call service locations are
spaced at 2-byte interval : FFC0
H
for TCALL15, FFC2
H
for TCALL14, etc.
The interrupt causes the CPU to jump to specific location,
where it commences execution of the service routine. The
External interrupt 0, for example, is assigned to location
FFFA
H
. The interrupt service locations are spaced at 2-
byte interval : FFF8
H
for External Interrupt 1, FFFA
H
for
External Interrupt 0, etc.
As for the area from FF00
H
to FFFF
H
, if any area of them
is not going to be used, its service location is available as
general purpose Program Memory.
Page Call (PCALL) area contains subroutine program to
PROGRAM
MEMORY
PCALL
AREA
TCALL
AREA
INTERRUPT
VECTOR AREA
F800
H
FEFF
H
FF00
H
FFBF
H
FFC0
H
FFDF
H
FFE0
H
FFFF
H
DEVICE
NOT USED
0F50
H
0F50
H
0FF0
H
0FF0
H
ID
CONFIG
CONFIGURATION
AREA
0F60
H
ID
0F70
H
ID
0F80
H
ID
0F90
H
ID
0FA0
H
ID
0FB0
H
ID
0FC0
H
ID
0FD0
H
ID
0FE0
H
ID
Address
TCALL Name
FFC0H
FFC2H
FFC4H
FFC6H
FFC8H
FFCAH
FFCCH
FFCEH
FFD0H
FFD2H
FFD4H
FFD6H
FFD8H
FFDAH
FFDCH
FFDEH
TCALL15
TCALL14
TCALL13
TCALL12
TCALL11
TCALL10
TCALL9
TCALL8
TCALL7
TCALL6
TCALL5
TCALL4
TCALL3
TCALL2
TCALL1
TCALL0 / BRK
1
1.
The BRK software interrupt is using same address
with TCALL0.
Table 12-1 TCALL Vectors
Address
Vector Name
FFE0H
FFE2H
FFE4H
FFE6H
FFE8H
FFEAH
FFECH
FFEEH
FFF0H
FFF2H
FFF4H
FFF6H
FFF8H
FFFAH
FFFCH
FFFEH
Not Used
Not Used
Not Used
Basic Interval Timer
Watchdog Timer
A/D Converter
Not Used
Not Used
Not Used
Not Used
Timer / Counter 1
Timer / Counter 0
External Interrupt 1
External Interrupt 0
Not Used
RESET
Table 12-2 Interrupt Vectors
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
29
reduce program byte length by using 2 bytes PCALL in-
stead of 3 bytes CALL instruction. If it is frequently called,
it is more useful to save program byte length.
Table Call (TCALL) causes 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
H
for TCALL15, 0FFC2
H
for
TCALL14, etc., as shown in Figure 12-5 .
Example: Usage of TCALL
Figure 12-5 PCALL and TCALL Memory Area
LDA
#5
TCALL
0FH
;
1BYTE INSTR UCTIO N
:
;
INSTEAD O F 3 BYTES
:
;
NO R M AL C ALL
;
;TABLE CALL ROUTINE
;
FUNC_A:
LDA
LRG0
RET
;
FUNC_B:
LDA
LRG1
RET
;
;TABLE CALL ADD. AREA
;
ORG
0FFC0H
;
TCALL ADDRESS AREA
DW
FUNC_A
DW
FUNC_B
1
2
0FFC0
H
C1
Address
Program Memory
C2
C3
C4
C5
C6
C7
C8
0FF00
H
Address
PCALL Area Memory
0FFFF
H
PCALL Area
(256 Bytes)
* means that the BRK software interrupt is using
same address with TCALL0.
NOTE:
TCALL 15
TCALL 14
TCALL 13
TCALL 12
TCALL 11
TCALL 10
TCALL 9
TCALL 8
TCALL 7
TCALL 6
TCALL 5
TCALL 4
TCALL 3
TCALL 2
TCALL 1
TCALL 0 / BRK *
C9
CA
CB
CC
CD
CE
CF
D0
D1
D2
D3
D4
D5
D6
D7
D8
D9
DA
DB
DC
DD
DE
DF
GMS81C1102 / GMS81C1202
30
Jan. 2002 ver 2.0
PCALL
rel
4F35
PCALL 35H
TCALL
n
4A
TCALL
4
Example: The usage software example of Vector address and the initialize part.
4F
~
~
~
~
NEXT
35
0FF35H
0FF00H
0FFFFH
11111111 11010110
01001010
PC:
F
H
F
H
D
H
6
H
4A
~
~
~
~
25
0FFD6H
0FF00H
0FFFFH
F1
NEXT
0FFD7H
0F125H
Reverse
ORG
0FFE0H
DW
NOT_USED
; (0FFEO)
DW
NOT_USED
; (0FFE2)
DW
NOT_USED
; (0FFE4)
DW
BIT_INT
; (0FFE6) Basic Interval Timer
DW
WDT_INT
; (0FFE8) Watchdog Timer
DW
AD_INT
; (0FFEA) A/D
DW
NOT_USED
; (0FFEC)
DW
NOT_USED
; (0FFEE)
DW
NOT_USED
; (0FFF0)
DW
NOT_USED
; (0FFF2)
DW
TMR1_INT
; (0FFF4) Timer-1
DW
TMR0_INT
; (0FFF6) Timer-0
DW
INT1
; (0FFF8) Int.1
DW
INT0
; (0FFFA) Int.0
DW
NOT_USED
; (0FFFC)
DW
RESET
; (0FFFE) Reset
ORG
0F800H
;********************************************
;
MAIN PROGRAM
*
;********************************************
;
RESET:
DI
;Disable All Interrupts
LDX
#0
RAM_CLR: LDA
#0
;RAM Clear(!0000H->!007FH)
STA
{X}+
CMPX
#080H
BNE
RAM_CLR
;
LDX
#07FH
;Stack Pointer Initialize
TXSP
;
CALL
INITIAL
;
;
LDM
RA, #0
;Normal Port A
LDM
RAIO,#1000_0010B
;Normal Port Direction
LDM
RB, #0
;Normal Port B
LDM
RBIO,#1000_0010B
;Normal Port Direction
:
:
LDM
PFDR,#0
;Enable Power Fail Detector
:
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
31
12.3 Data Memory
Figure 12-6 shows the internal Data Memory space avail-
able. Data Memory is divided into two groups, a user
RAM(including Stack) and control registers.
Figure 12-6 Data Memory Map
Internal Data Memory addresses are always one byte wide,
which implies an address space of 128 bytes including the
stack area.
The stack pointer should be initialized within 00
H
to 7F
H
by software because its value is undefined after RESET.
The Stack area is defined at the Data Memory area, so the
stack should not be overlapped by manipulating RAM Da-
ta. For example, we assumed the Stack pointer is 6F. If this
address is accessed by program, the stack value is changed.
So the malfunction is occurred.
The control registers are used by CPU and Peripheral func-
tions 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, I/O ports. The control registers are in address
C0
H
to FF
H
.
Note that unoccupied addresses may not be implemented
on the chip. Read accesses to these addresses will in gen-
eral return random data, and write accesses will have an in-
determinate effect.
More detail informations of each register are explained in
each peripheral sections.
Note: Write only registers can not be accessed by bit ma-
nipulation instruction. Do not use read-modify-write
instruction. Use byte manipulation instruction.
Example; To write at CKCTLR
LDM
CKCTLR,#09H ;Divide ratio
16
Table 12-3 RESET Value of Control Registers
Note: Several names are given at same address. Refer to
below table.
Table 12-4 Various Register Name in Same Adress
DATA
MEMORY
CONTROL
REGISTERS
00
H
7F
H
C0
H
FF
H
(including STACK)
Address
Symbol
R/W
RESET Value
C0H
C1H
C2H
C3H
C4H
C5H
CAH
CBH
CCH
D0H
D1H
D1H
D1H
D2H
D3H
D3H
D4H
D4H
D4H
D5H
DEH
E2H
E3H
E4H
E5H
E6H
EAH
EBH
ECH
ECH
EDH
EFH
RA
RAIO
RB
RBIO
RC
RCIO
RAFUNC
RBFUNC
PUPSEL
TM0
T0
TDR0
CDR0
TM1
TDR1
T1PPR
T1
CDR1
T1PDR
PWMHR
BUR
IENH
IENL
IRQH
IRQL
IEDS
ADCM
ADCR
BITR
CKCTLR
WDTR
PFDR
R/W
W
R/W
W
R/W
W
W
W
W
R/W
R
W
R
R/W
W
W
R
R
R/W
W
W
R/W
R/W
R/W
R/W
R/W
R/W
R
R
W
R/W
R/W
Undefined
0000_0000
Undefined
---0_0000
Undefined
----_--00
0000_0000
---0_0000
----_--00
--00_0000
0000_0000
1111_1111
0000_0000
0000_0000
1111_1111
1111_1111
0000_0000
0000_0000
0000_0000
----_0000
1111_1111
0000_----
000-_----
0000_----
000-_----
----_0000
--00_0001
Undefined
0000_0000
-001_0111
0111_1111
----_-100
Addr.
When read
When write
Timer
Mode
Capture
Mode
PWM
Mode
Timer
Mode
PWM
Mode
D1H
T0
CDR0
-
TDR0
-
D3H
-
TDR1
T1PPR
D4H
T1
CDR1
T1PDR
-
T1PDR
ECH
BITR
CKCTLR
GMS81C1102 / GMS81C1202
32
Jan. 2002 ver 2.0
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, executing the
subroutine return instruction [RET] restores the contents of
the program counter from the stack; executing the interrupt
return instruction [RETI] restores the contents of the pro-
gram 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.
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
33
Address
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
C0H
RA
RA Port Data Register
C1H
RAIO
RA Port Direction Register
C2H
RB
RB Port Data Register
C3H
RBIO
RB Port Direction Register
C4H
RC
RC Port Data Register
C5H
RCIO
RC Port Direction Register
CAH
RAFUNC
ANSEL7
ANSEL6
ANSEL5
ANSEL4
ANSEL3
ANSEL2
ANSEL1
ANSEL0
CBH
RBFUNC
-
-
-
PWMO
INT1I
INT0I
BUZO
AVREFS
CCH
PUPSEL
-
-
-
-
-
-
PUPSEL1 PUPSEL0
D0H
TM0
-
-
CAP0
T0CK2
T0CK1
T0CK0
T0CN
T0ST
D1H
T0/TDR0/
CDR0
Timer0 Register / Timer Data Register 0 / Capture Data Register 0
D2H
TM1
POL
16BIT
PWME
CAP1
T1CK1
T1CK0
T1CN
T1ST
D3H
TDR1/
T1PPR
Timer Data Register 1/ PWM Period Register 1
D4H
T1/CDR1/
T1PDR
Timer1 Register / Capture Data Register 1 / PWM Duty Register 1
D5H
PWMHR
PWM High Register
DEH
BUR
BUCK1
BUCK0
BUR5
BUR4
BUR3
BUR2
BUR1
BUR0
E2H
IENH
INT0E
INT1E
T0E
T1E
-
-
-
-
E3H
IENL
ADE
WDTE
BITE
-
-
-
-
-
E4H
IRQH
INT0IF
INT1IF
T0IF
T1IF
-
-
-
-
E5H
IRQL
ADIF
WDTIF
BITIF
-
-
-
-
-
E6H
IEDS
-
-
-
-
IED1H
IED1L
IED0H
IED0L
EAH
ADCM
-
-
ADEN
ADS2
ADS1
ADS0
ADST
ADSF
EBH
ADCR
ADC Result Data Register
ECH
BITR
1
Basic Interval Timer Data Register
ECH
CKCTLR
Note1
-
WAKEUP
RCWDT
WDTON
BTCL
BTS2
BTS1
BTS0
EDH
WDTR
WDTCL
7-bit Watchdog Counter Register
EFH
PFDR
2
-
-
-
-
-
PFDIS
PFDM
PFDS
Table 12-5 Control Registers of GMS81C1202
These registers of shaded area can not be accessed by bit manipulation instruction as "SET1, CLR1
"
, so should be accessed by
register operation instruction as "LDM dp,#imm
"
.
1.
The register BITR and CKCTLR are located at same address. Address ECH is read as BITR, written to CKCTLR.
2.
The register PFDR only be implemented on devices, not on In-circuit Emulator.
GMS81C1102 / GMS81C1202
34
Jan. 2002 ver 2.0
12.4 Addressing Mode
The GMS87C1201 and GMS81C1202 use six addressing
modes.
Register addressing
Immediate addressing
Direct page addressing
Absolute addressing
Indexed addressing
Register-indirect addressing
Below example is shown for GMS81C1202.
(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
immediately.
Example:
0435
ADC
#35H
E45535
LDM
35H,#55H
(3) Direct Page Addressing
dp
In this mode, a address is specified within direct page.
Example;
C535
LDA
35H
;A
RAM[35H]
(4) Absolute Addressing
!abs
Absolute addressing sets corresponding memory data to
Data , i.e. second byte(Operand I) of command becomes
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.
ADC, AND, CMP, CMPX, CMPY, EOR, LDA, LDX,
LDY, OR, SBC, STA, STX, STY
Example;
0735F0
ADC
!0F035H
;A
ROM[0F035H]
35
A+35H+C
A
04
MEMORY
E4
0F900
H
data
55H
~
~
~
~
data
0035
H
35
0F902
H
55
0F901
H
data
35
0035
H
0F851
H
data
A
~
~
~
~
C5
0F850
H
07
0F900
H
~
~
~
~
data
0F035
H
F0
0F902
H
35
0F901
H
A+data+C
A
address: 0F035
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
35
The operation within data memory (RAM)
ASL, BIT, DEC, INC, LSR, ROL, ROR
Example; Addressing accesses the address 0035
H
.
983500
INC
!0035H
;A
RAM[035H]
(5) Indexed Addressing
X indexed direct page (no offset)
{X}
In this mode, a address is specified by the X register.
ADC, AND, CMP, EOR, LDA, OR, SBC, STA, XMA
Example; X=15
H
D4
LDA
{X}
;ACC
RAM[X].
X indexed direct page, auto increment
{X}+
In this mode, a address is specified within direct page by
the X register and the content of X is increased by 1.
LDA, STA
Example; X=35
H
DB
LDA
{X}+
X indexed direct page (8 bit offset)
dp+X
This address value is the second byte (Operand) of com-
mand plus the data of
-register. And it assigns the mem-
ory in Direct page.
ADC, AND, CMP, EOR, LDA, LDY, OR, SBC, STA
STY, XMA, ASL, DEC, INC, LSR, ROL, ROR
Example; X=015
H
C645
LDA
45H+X
98
0FA00
H
~
~
~
~
data
0035
H
00
0FA02
H
35
0FA01
H
data+1
data
address: 0035
data
D4
15
H
0FA50
H
data
A
~
~
~
~
data
DB
35
H
data
A
~
~
~
~
36H
X
data
45
5A
H
0FB51
H
data
A
~
~
~
~
C6
0FB50
H
45H+15H=5AH
GMS81C1102 / GMS81C1202
36
Jan. 2002 ver 2.0
Y indexed direct page (8 bit offset)
dp+Y
This address value is the second byte (Operand) of com-
mand 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 mem-
ory in whole area.
Example; Y=55
H
D500FA
LDA
!0FA00H+Y
(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;
3F35
JMP
[35H]
X indexed indirect
[dp+X]
Processes memory data as Data, assigned by 16-bit pair
m e m o r y w h i c h i s d e t e r m i n e d b y p a i r d a t a
[dp+X+1][dp+X] Operand plus
X-register data in Direct
page.
ADC, AND, CMP, EOR, LDA, OR, SBC, STA
Example; X=10
H
1625
ADC
[25H+X]
D5
0F900
H
data
A
~
~
~
~
data
0FA55
H
0FA00H+55H=0FA55H
FA
0F902
H
00
0F901
H
0A
35
H
jump to address 0FC0A
H
~
~
~
~
35
0FD00
H
FC
36
H
3F
0FC0A
H
NEXT
~
~
~
~
05
35
H
0F905
H
~
~
~
~
25
0FA00
H
F9
36
H
16
0F905
H
data
~
~
~
~
A + data + C
A
25 + X(10) = 35
H
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
37
Y indexed indirect
[dp]+Y
Processes momory data as Data, assigned by the data
[dp+1][dp] of 16-bit pair memory paired by Operand in Di-
rect page
plus Y-register data.
ADC, AND, CMP, EOR, LDA, OR, SBC, STA
Example; Y=10
H
1725
ADC
[25H]+Y
Absolute indirect
[!abs]
The program jumps to address specified by 16-bit absolute
address.
JMP
Example;
1F25F9
JMP
[!0F925H]
05
25
H
0F805
H
+ Y(10) = 0F815
H
~
~
~
~
25
0FA00
H
F8
26
H
17
0F815
H
data
~
~
~
~
A + data + C
A
E1
0F925
H
jump to
~
~
~
~
F9
0FA00
H
F9
0F926
H
25
0F9E1
H
NEXT
~
~
~
~
1F
PROGRAM MEMORY
address 0F9E1
H
GMS81C1102 / GMS81C1202
38
Jan. 2002 ver 2.0
13. I/O PORTS
The GMS81C1202 has three ports, RA, RB and RC. These
ports pins may be multiplexed with an alternate function
for the peripheral features on the device. In general, when
a initial reset state, all ports are used as a general purpose
input port.
All pins have data direction registers which can set these
ports as output or input. A "1" in the port direction register
defines the corresponding port pin as output. Conversely,
write "0" to the corresponding bit to specify as an input
pin. For example, to use the even numbered bit of RA as
output ports and the odd numbered bits as input ports, write
"55
H
" to address C1
H
(RA direction register) during initial
setting as shown in Figure 13-1.
Reading data register reads the status of the pins whereas
writing to it will write to the port latch.
Figure 13-1 Example of port I/O assignment
13.1 RA and RAIO registers
RA is an 8-bit bidirectional I/O port (address C0
H
). Each
port can be set individually as input and output through the
RAIO register (address C1
H
).
RA7~RA1 ports are multiplexed with Analog Input Port
( AN7~AN1 ) and RA0 port is multiplexed with Event
Counter Input Port ( EC0 )
.
Figure 13-2 Registers of Port RA
The control register RAFUNC (address CA
H
) controls to
select alternate function. After reset, this value is "0", port
may be used as general I/O ports. To select alternate func-
tion such as Analog Input or External Event Counter Input,
write "1" to the corresponding bit of RAFUNC.Regardless
of the direction register RAIO, RAFUNC is selected to use
as alternate functions, port pin can be used as a correspond-
ing alternate features ( RA0/EC0 is controlled by RB-
FUNC )
I : INPUT PORT
WRITE "55H" TO PORT RA DIRECTION REGISTER
0
1
0
1
0
1
0
1
I
O
I
O
I
O
I
O
RA DATA
RB DATA
RA DIRECTION
RB DIRECTION
C0H
C1H
C2H
C3H
7
6
5
4
3
2
1
0
BIT
7
6
5
4
3
2
1
0 PORT
O : OUTPUT PORT
RA7 RA6 RA5 RA4 RA3 RA2 RA1 RA0
INPUT / OUTPUT DATA
RA Data Register
RA
ADDRESS : C0H
RESET VALUE : Undefined
ANSEL0
RA Function Selection Register
RAFUNC
ADDRESS : CAH
RESET VALUE : 00000000
ANSEL7
ANSEL1
ANSEL2
ANSEL3
ANSEL4
ANSEL5
ANSEL6
0 : RB0
1 : AN0
0 : RA1
1 : AN1
0 : RA2
1 : AN2
0 : RA3
1 : AN3
0 : RA4
1 : AN4
0 : RA5
1 : AN5
0 : RA6
1 : AN6
0 : RA7
1 : AN7
0 : INPUT PORT
1 : OUTPUT PORT
DIRECTION SELECT
RA7 RA6 RA5 RA4 RA3 RA2 RA1 RA0
RA Direction Register
RAIO
ADDRESS : C1H
RESET VALUE : 00000000
PORT
RAFUNC.7~0
Description
RA7/AN7
0
RA7 ( Normal I/O Port )
1
AN7 ( ADS2~0=111 )
RA6/AN6
0
RA6 ( Normal I/O Port )
1
AN6 ( ADS2~0=110 )
RA5/AN5
0
RA5 ( Normal I/O Port )
1
AN5 ( ADS2~0=101 )
RA4/AN4
0
RA4 ( Normal I/O Port )
1
AN4 ( ADS2~0=100 )
RA3/AN3
0
RA3 ( Normal I/O Port )
1
AN3 ( ADS2~0=011 )
RA2/AN2
0
RA2 ( Normal I/O Port )
1
AN2 ( ADS2~0=010 )
RA1/AN1
0
RA1 ( Normal I/O Port )
1
AN1 ( ADS2~0=001 )
RA0/EC0
1
1. This port is not an Analog Input port, but Event Counter
clock source input port. ECO is controlled by setting
TOCK2~0 = 111.
The bit RAFUNC.0 (ANSEL0) controls the RB0/AN0/AVref
port ( Refer to Port RB).
RA0 ( Normal I/O Port )
EC0 ( T0CK2~0=111 )
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
39
13.2 RB and RBIO registers
RB is a 5-bit bidirectional I/O port (address C2
H
). Each
pin can be set individually as input and output through the
RBIO register (address C3
H
).
Figure 13-3 Registers of Port RB
In addition, Port RB is multiplexed with various special
features. The control register RBFUNC (address CB
H
)
controls to select alternate function. After reset, this value
is "0", port may be used as general I/O ports. To select al-
ternate function such as External interrupt or Timer com-
pare output, write "1" to the corresponding bit of
RBFUNC.
Regardless of the direction register RBIO, RBFUNC is se-
lected to use as alternate functions, port pin can be used as
a corresponding alternate features.
RB4 RB3 R B 2
RB1 RB0
INPUT / OUTPUT DATA
RB Data Register
RB
ADDRESS : C2H
RESET VALUE : Undefined
AVREFS
RB Function Selection Register
RBFUNC
ADDRESS : CBH
RESET VALUE : ---00000
BUZO
INT0I
INT1I
PWMO
0 : RB0 when ANSEL0 = 0, AN0 when ANSEL0 = 1
0 : RB1
1 : BUZ Output
0 : RB4
1 : PWM0 Output or
0 : RB2
1 : INT0
0 : RB3
1 : INT1
PUP0
Pull-up Selection Register
PUPSEL
ADDRESS : CCH
RESET VALUE : ------00
-
PUP1
-
-
-
0 : No Pull-up
1 : With Pull-up
0 : No Pull-up
1 : With Pull-up
IED0L
Interrupt Edge Selection Register
IEDS
ADDRESS : E6H
RESET VALUE : ----0000
IED0H
IED1L
IED1H
External Interrupt Edge Select
INT0
INT1
00 : Normal I/O port
01 : Falling ( 1-to-0 transition )
10 : Rising ( 0-to-1 transition )
11 : Both ( Rising & Falling )
Compare Output
RB2 / INT0 Pull-up
RB3 / INT1 Pull-up
1 : AVref
0 : INPUT PORT
1 : OUTPUT PORT
DIRECTION SELECT
-
-
-
RB4 RB3 RB2 RB1 RB0
RB Direction Register
RBIO
ADDRESS : C3H
RESET VALUE : ---00000
The shaded areas are only related with in GMS81C1202.
So in GMS81C1102, this area must be written to "0".
PORT
RBFUNC.4~0
Description
RB4/
PWM0/
COMP0
0
RB4 ( Normal I/O Port )
1
PWM0 Output /
Timer1 Compare Output
RB3/INT1
0
RB3 ( Normal I/O Port )
1
External Interrupt Input 1
RB2/INT0
0
RB2 ( Normal I/O Port )
1
External Interrupt Input 0
RB1/BUZ
0
RB1 ( Normal I/O Port )
1
Buzzer Output
RB0/AN0/
AVref
0
1
RB0 ( Normal I/O Port ) /
AN0 (ANSEL0=1)
1
2
External Analog Reference
Voltage
1. When ANSEL0 = "0", this port is defined for normal I/O port
( RB0 ).
When ANSEL0 = "1" and ADS2~0 = " 000", this port
can be used Analog Input Port ( AN0 ).
2. When this bit set to "1", this port defined for AVref , so it can
not be used Analog Input Port AN0 and Normal I/O
Port RB0.
GMS81C1102 / GMS81C1202
40
Jan. 2002 ver 2.0
13.3 RC and RCIO registers
RC is an 4-bit bidirectional I/O port (address C4
H
). Each
pin can be set individually as input and output through the
RCIO register (address C5
H
).
Figure 13-4 Registers of Port RC
-
RC1 RC0
INPUT / OUTPUT DATA
0 : INPUT PORT
1 : OUTPUT PORT
DIRECTION SELECT
RC Data Register
RC
ADDRESS : C4H
RESET VALUE : Undefined
RC1 RC0
RC Direction Register
RCIO
ADDRESS : C5H
RESET VALUE : ------00
-
-
-
-
-
-
-
-
-
-
-
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
41
14. CLOCK GENERATOR
The clock generator produces the basic clock pulses which
provide the system clock to be supplied to the CPU and pe-
ripheral hardware.
The main system clock oscillator oscillates
with a crystal resonator or a ceramic resonator
connected to the
Xin and Xout pins. External clocks can be input to the main
system clock oscillator. In this case, input a clock signal to
the Xin pin and open the Xout pin
Figure 14-1 Block Diagram of Clock Pulse Generator
14.1 Oscillation Circuit
X
IN
and X
OUT
are the input and output, respectively, a in-
verting amplifier which can be set for use as an on-chip os-
cillator, as shown in Figure 14-2 .
Figure 14-2 Oscillator Connections
To drive the device from an external clock source, Xout
should be left unconnected while Xin is driven as shown in
Figure 14-3. There are no requirements on the duty cycle
of the external clock signal, since the input to the internal
clocking circuitry is through a divide-by-two flip-flop, but
minimum and maximum high and low times specified on
the data sheet must be observed.
Oscillation circuit is designed to be used either with a ce-
ramic resonator or crystal oscillator. Since each crystal and
ceramic resonator have their own characteristics, the user
should consult the crystal manufacturer for appropriate
values of external components
In addition, the GMS81C1202 has an ability for the exter-
nal RC oscillated operation. It offers additional cost sav-
ings for timing insensitive applications. The RC
oscillator frequency is a function of the supply voltage, the
external resistor (Rext) and capacitor (Cext) values, and
the operating temperature.
The user needs to take into account variation due to toler-
ance of external R and C components used. Figure 14-4
shows how the RC combination is connected to the
GMS81C1202.
Figure 14-3 External Clock Connections
Note: When using a system clock oscillator, carry out wir-
ing in the broken line area in Figure 14-2 to prevent
any effects from wiring capacities.
- 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
SS
. Do not ground to
any ground pattern where high current is present.
- Do not fetch signals from the oscillator.
Internal system clock
PRESCALER
CLOCK PULSE
1
Peripheral clock
2
4
8
16
128
256
512
1024
32
64
GENERATOR
2048
STOP
WAKEUP
fxin
OSCILLATION
CIRCUIT
Xout
Xin
Vss
C1
C2
Recommended: C1, C2 = 30pF
10pF for Crystals
R1
R1 = 1M
Xout
Xin
Vss
OPEN
External
Clock
Source
GMS81C1102 / GMS81C1202
42
Jan. 2002 ver 2.0
Figure 14-4 RC Oscillator Connections
The oscillator frequency, divided by 4, is output from the
Xout pin, and can be used for test purpose or to synchroze
other logic.
To set the RC oscillation, it should be programmed
RCOPT bit to "1" to CONFIG (0FF0
H
). ( Refer to DE-
VICE CONFIGURATION AREA )
Note: When using a system clock oscillator, carry out wir-
ing in the broken line area in Figure 14-2 to prevent
any effects from wiring capacities.
-
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 os-
cillator capacitor to that of V
SS
.
Do not ground to
any ground pattern where high current is
present.
- Do not fetch signals from the oscillator.
Xout
Xin
Vdd
Cext
fxin
4
Rext
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
43
15. Basic Interval Timer
The GMS81C1202 has one 8-bit Basic Interval Timer that
is free-run, can not stop. Block diagram is shown in Figure
15-1 .The 8-bit Basic interval timer register (BITR) is in-
creased every internal count pulse which is divided by
prescaler. Since prescaler has divided ratio by 8 to 1024,
the count rate is 1/8 to 1/1024 of the oscillator frequency.
As the count overflows from FF
H
to 00
H
, this overflow
causes to generate the Basic interval timer interrupt. The
BITF is interrupt request flag of Basic interval timer.
When write "1" to bit BTCL of CKCTLR, BITR register is
cleared to "0" and restart to count-up. The bit BTCL be-
comes "0" after one machine cycle by hardware.
If the STOP instruction executed after writing "1" to bit
WAKEUP of CKCTLR, it goes into the wake-up timer
mode. In this mode, all of the block is halted except the os-
cillator, prescaler ( only fxin
2048 ) and Timer0.
If the STOP instruction executed after writing "1" to bit
RCWDT of CKCTLR, it goes into the internal RC oscillat-
ed watchdog timer mode. In this mode, all of the block is
halted except the internal RC oscillator, Basic Interval
Timer and Watchdog Timer. More detail informations are
explained in Power Saving Function. The bit WDTON de-
cides Watchdog Timer or the normal 7-bit timer
Note: All control bits of Basic interval timer are in CKCTLR
register which is located at same address of BITR
(address EC
H
). Address EC
H
is read as BITR, writ-
ten to CKCTLR. Therefore, the CKCTLR can not be
accessed by bit manipulation instruction.
.
Figure 15-1 Block Diagram of Basic Interval Timer
Figure 15-2 CKCTLR : Clock Control Register
8
16
128
256
512
1024
32
64
STOP
WAKEUP
0
1
MUX
8
3
fxin
BITR (8BIT)
BITIF
BTS[2:0]
RCWDT
Internal RC OSC
Basic Interval Timer
Interrupt
BTCL
Clear
To Watchdog Timer
Clock Control Register
CKCTLR
ADDRESS : ECH
RESET VALUE : -0010111
-
WAKEUP
RCWDT
WDTON
BTCL
BTS2
BTS1
BTS0
Basic Interval Timer Clock Selection
000 : fxin
8
001 : fxin
16
100 : fxin
128
101 : fxin
256
110 : fxin
512
111 : fxin
1024
010 : fxin
32
011 : fxin
64
Symbol
Function Description
WAKEUP
1: Enables Wake-up Timer
0: Disables Wake-up Timer
RCWDT
1: Enables Internal RC Watchdog Timer
0: Disables Internal RC Watchdog Time
WDTON
1: Enables Watchdog Timer
0: Operates as a 7-bit Timer
BTCL
1: BITR is cleared and BTCL becomes "0" automatically
after one machine cycle, and BITR continue to count-up
Bit Manipulation Not Available
GMS81C1102 / GMS81C1202
44
Jan. 2002 ver 2.0
16. TIMER / COUNTER
The GMS81C1202 has two Timer/Counter registers. Each
module can generate an interrupt to indicate that an event
has occurred (i.e. timer match).
Timer 0 and Timer 1 can be used either the two 8-bit Tim-
er/Counter or one 16-bit Timer/Counter by combining
them.
In the "timer" function, the register is increased every in-
ternal clock input. Thus, one can think of it as counting in-
ternal clock input. Since a least clock consists of 2 and
most clock consists of 2048 oscillator periods, the count
rate is 1/2 to 1/2048 of the oscillator frequency in Timer0.
And Timer1 can use the same clock source too. In addition,
Timer1 has more fast clock source ( 1/1 to 1/8 ).
In the "counter" function, the register is increased in re-
sponse to a 0-to-1 (rising edge) transition at its correspond-
ing external input pin, EC0.
And in the "capture" function, the register is increased in
response external interrupt same with timer function.
When external interrupt edge input, the count register is
captured into capture data register CDRx.
Timer1 is shared with "PWM" function and "Compare out-
put" function
It has seven operating modes: "8-bit timer/counter", "16-
bit timer/counter", "8-bit capture", "16-bit capture", "8-bit
compare output", "16-bit compare output" and "10-bit
PWM" which are selected by bit in Timer mode register
TM0 and TM1 as shown in Figure 16-1 and Table 16-1.
Figure 16-1 Timer 0 and Timer 1 Mode Register
Timer 0 Mode Register
TM0
ADDRESS : D0H
RESET VALUE : --000000
-
-
CAP0
T0CK2
T0CK1
T0CK0
T0CN
T0ST
Timer 1 Mode Register
TM1
ADDRESS : D2H
RESET VALUE : 00000000
POL
16BIT
PWME
CAP1
T1CK1
T1CK0
T1CN
T1ST
CAP0
Capture mode selection bit.
0 : Disables Capture
1 : Enables Capture
T0CN
Continue control bit
0 : Stop counting
1 : Start counting continuously
T0CK[2:0]
Input clock selection
000 : fxin
2
100 : fxin
128
001 : fxin
4
101 : fxin
512
010 : fxin
8
110 : fxin
2048
011 : fxin
32
111 : External Event ( EC0 )
T0ST
Start control bit
0 : Stop counting
1 : Start countingn
POL
PWM Output Polarity
0 : Duty active low
1 : Duty active high
T1CK[2:0]
Input clock selection
00 : fxin
10 : fxin
8
01 : fxin
2
11 : using the Timer 0 clock
16BIT
16-bit mode selection
0 : 8-bit mode
1 : 16-bit mode
T1CN
Continue control bit
0 : Stop counting
1 : Start counting continuously
PWME
PWM enable bit
0 : Disables PWM
1 : Enables PWM
T1ST
Start control bit
0 : Stop counting
1 : Start countingn
CAP1
Capture mode selection bit.
0 : Disables Capture
1 : Enables Capture
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
45
16.1 8-bit Timer/Counter Mode
The GMS81C1202 has two 8-bit Timer/Counters, Timer 0
and Timer 1, as shown in Figure 16-2 .
The "timer" or "counter" function is selected by mode reg-
isters TM0, TM1 as shown in Figure 16-1 and Table 16-1
. To use as an 8-bit timer/counter mode, bit CAP0 of TM0
is cleared to "0" and bits 16BIT of TM1 should be cleared
to "0"(Table 16-1).
Figure 16-2 8-bit Timer / Counter Mode
16BIT
CAP0
CAP1
PWME
T0CK[2:0]
T1CK[1:0]
PWMO
1
TIMER 0
TIMER1
0
0
0
0
XXX
XX
0
8-bit Timer
8-bit Timer
0
0
1
0
111
XX
0
8-bit Event Counter
8-bit Capture
0
1
0
0
XXX
XX
1
8-bit Capture
8-bit Compare output
0
0
0
1
XXX
XX
1
8-bit Timer/Counter
10-bit PWM
1
0
0
0
XXX
11
0
16-bit Timer
1
0
0
0
111
11
0
16-bit Event Counter
1
1
X
2
0
XXX
11
0
16-bit Capture
1
0
0
0
XXX
11
1
16-bit Compare output
Table 16-1 Operating Modes of Timer 0 and Timer 1
1.
This bit is the bit4 of RB Function register(RBFUNC).
2.
X : The value is "0" or "1" corresponding your operation.
1
2
8
TM0
ADDRESS : D0H
RESET VALUE : --000000
-
-
CAP0
T0CK2
T0CK1
T0CK0
T0CN
T0ST
TM1
ADDRESS : D2H
RESET VALUE : 00000000
POL
16BIT
PWME
CAP1
T1CK1
T1CK0
T1CN
T1ST
-
-
0
X
X
X
X
X
X
0
0
0
X
X
X
X
2
4
128
512
8
32
fxin
EC0
Edge Detector
MUX
MUX
1
1
T0 ( 8-bit )
TDR0 ( 8-bit )
T0IF
CLEAR
COMPARATOR
TIMER 0
INTERRUPT
T1 ( 8-bit )
TDR1 ( 8-bit )
T1IF
CLEAR
COMPARATOR
TIMER 1
INTERRUPT
T0ST
0 : Stop
1 : Start
T1ST
0 : Stop
1 : Start
T0CN
T1CN
T0CK[2:0]
T1CK[1:0]
F/F
COMP0 PIN
2048
X : The value "0" or "1" corresponding your operation.
GMS81C1102 / GMS81C1202
46
Jan. 2002 ver 2.0
These timers have each 8-bit count register and data regis-
ter. The count register is increased by every internal or ex-
ternal clock input. The internal clock has a prescaler divide
ratio option of 2, 4, 8, 32,128, 512, 2048 (selected by con-
trol bits T0CK2, T0CK1 and T0CK0 of register TM0) and
1, 2, 8 (selected by control bits T1CK1 and T1CK0 of reg-
ister TM1). In the Timer 0, timer register T0 increases
from 00
H
until it matches TDR0 and then reset to 00
H
. The
match output of Timer 0 generates Timer 0 interrupt
(latched in T0F bit). As TDRx and Tx register are in same
address, when reading it as a Tx, written to TDRx.
In counter function, the counter is increased every 0-to 1
(rising edge) transition of EC0 pin. In order to use counter
function, the bit RA0 of the RA Direction Register RAIO
is set to "0". The Timer 0 can be used as a counter by pin
EC0 input, but Timer 1 can not.
Figure 16-3 Counting Example of Timer Data Registers
Figure 16-4 Timer Count Operation
~~
Timer 1 (T1IF)
Interrupt
TDR1
TIME
interrupt occurs
Interrupt period
up-
count
~~
~~
0
1
2
3
4
5
6
7
8
9
n
n-1
P
CP
= P
CP
x (n+1)
interrupt occurs
interrupt occurs
Timer 1 (T1IF)
Interrupt
TDR1
TIME
stop
clear & start
disable
enable
Start & Stop
T1ST
T1CN
Control count
up-c
ount
~~
~~
T1ST = 0
T1ST = 1
T1CN = 0
T1CN = 1
interrupt occurs
interrupt occurs
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
47
16.2 16-bit Timer/Counter Mode
The Timer register is being run with 16 bits. A 16-bit timer/
counter register T0, T1 are increased from 0000
H
until it
matches TDR0, TDR1 and then resets to 0000
H
. The
match output generates Timer 0 interrupt not Timer 1 in-
terrupt.
The clock source of the Timer 0 is selected either internal
or external clock by bit T0CK2, T0CK1 and T0SL0.
In 16-bit mode, the bits T1CK1,T1CK0 and 16BIT of TM1
should be set to "1" respectively.
Figure 16-5 16-bit Timer / Counter Mode
16.3 8-bit Compare Output ( 16-bit )
The GMS87C1201 and GMS81C1202 has a function of
Timer Compare Output. To pulse out, the timer match can
goes to port pin( COMP0 ) as shown in Figure 16-2 and
Figure 16-5 . Thus, pulse out is generated by the timer
match. These operation is implemented to pin, RB4/
COMP0/PWM.
This pin output the signal having a 50 : 50 duty square
wave, and output frequency is same as below equation.
In this mode, the bit PWMO of RB function register (RB-
FUNC) should be set to "1", and the bit PWME of timer1
mode register ( TM1 ) should be set to "0".
In addition, 16-bit Compare output mode is also available.
16.4 8-bit Capture Mode
The Timer 0 capture mode is set by bit CAP0 of timer
mode register TM0 (bit CAP1 of timer mode register TM1
for Timer 1) as shown in Figure 16-6.
As mentioned above, not only Timer 0 but Timer 1 can also
be used as a capture mode.
The Timer/Counter register is increased in response inter-
nal or external input. This counting function is same with
normal timer mode, and Timer interrupt is generated when
timer register T0 (T1) increases and matches TDR0
(TDR1).
TM0
ADDRESS : D0H
RESET VALUE : --000000
-
-
CAP0
T0CK2
T0CK1
T0CK0
T0CN
T0ST
TM1
ADDRESS : D2H
RESET VALUE : 00000000
POL
16BIT
PWME
CAP1
T1CK1
T1CK0
T1CN
T1ST
-
-
0
X
X
X
X
X
X
1
0
0
1
1
X
X
2
4
128
512
8
32
fxin
EC0
Edge Detector
MUX
1
T1 ( 8-bit )
TDR1 ( 8-bit )
T0IF
CLEAR
COMPARATOR
TIMER 0
INTERRUPT
T0 ( 8-bit )
TDR0 ( 8-bit )
T0ST
0 : Stop
1 : Start
T0CN
T0CK[2:0]
F/F
COMP0 PIN
2048
X : The value "0" or "1" corresponding your operation.
Oscillation Frequency
2
Prescaler Value
TDR
1
)
+
(
--------------------------------------------------------------------------------
=
GMS81C1102 / GMS81C1202
48
Jan. 2002 ver 2.0
This timer interrupt in capture mode is very useful when
the pulse width of captured signal is more wider than the
maximum period of Timer.
For example, in Figure 16-8 , the pulse width of captured
signal is wider than the timer data value (FF
H
) over 2
times. When external interrupt is occured, the captured
value (13
H
) is more little than wanted value. It can be ob-
tained correct value by counting the number of timer over-
flow occurence.
Timer/Counter still does the above, but with the added fea-
ture that a edge transition at external input INTx pin causes
the current value in the Timer x register (T0,T1), to be cap-
tured into registers CDRx (CDR0, CDR1), respectively.
After captured, Timer x register is cleared and restarts by
hardware.
It has three transition modes: "falling edge", "rising edge",
"both edge" which are selected by interrupt edge selection
register IEDS (Refer to External interrupt section). In ad-
dition, the transition at INTx pin generate an interrupt.
Note: The CDRx, TDRx and Tx are in same address. In
the capture mode, reading operation is read the
CDRx, not Tx because path is opened to the CDRx,
and TDRx is only for writing operation.
Figure 16-6 8-bit Capture Mode
1
2
8
TM0
ADDRESS : D0H
RESET VALUE : --000000
-
-
CAP0
T0CK2
T0CK1
T0CK0
T0CN
T0ST
TM1
ADDRESS : D2H
RESET VALUE : 00000000
POL
16BIT
PWME
CAP1
T1CK1
T1CK0
T1CN
T1ST
-
-
1
X
X
X
X
X
X
0
0
1
X
X
X
X
2
4
128
512
8
32
fxin
EC0
Edge Detector
MUX
MUX
1
1
T0 ( 8-bit )
CDR0 ( 8-bit )
T0IF
CLEAR
COMPARATOR
TIMER 0
INTERRUPT
T0ST
0 : Stop
1 : Start
T0CN
T1CN
T0CK[2:0]
T1CK[1:0]
TDR0 ( 8-bit )
INT0IF
INT 0
INTERRUPT
INT0
T1 ( 8-bit )
CDR1 ( 8-bit )
T1IF
CLEAR
COMPARATOR
TIMER 1
INTERRUPT
TDR1 ( 8-bit )
INT1IF
INT 1
INTERRUPT
INT1
T0ST
0 : Stop
1 : Start
IEDS[1:0]
IEDS[3:2]
CAPTURE
CAPTURE
2048
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
49
Figure 16-7 Input Capture Operation
Figure 16-8 Excess Timer Overflow in Capture Mode
~~
Ext. INT0 Pin
Interrupt Request
T0
TIME
up
-c
oun
t
~~
~~
0
1
2
3
4
5
6
7
8
9
n
n-1
Capture
( Timer Stop )
Clear & Start
Interrupt Interval Period
Delay
( INT0F )
Ext. INT0 Pin
Interrupt Request
( INT0F )
This value is loaded to CDR0
Interrupt Interval Period = FF
H
+ 01
H
+ FF
H
+01
H
+ 13
H
= 213
H
FF
H
FF
H
Ext. INT0 Pin
Interrupt Request
( INT0F )
00
H
00
H
Interrupt Request
( T0F )
T0
13
H
GMS81C1102 / GMS81C1202
50
Jan. 2002 ver 2.0
16.5 16-bit Capture Mode
16-bit capture mode is the same as 8-bit capture, except
that the Timer register is being run will 16 bits.
The clock source of the Timer 0 is selected either internal
or external clock by bit T0CK2, T0CK1 and T0CK0.
In 16-bit mode, the bits T1CK1,T1CK0 and 16BIT of TM1
should be set to "1" respectively.
Figure 16-9 16-bit Capture Mode
16.6 PWM Mode
The GMS81C1202 has a two high speed PWM (Pulse
Width Modulation) functions which shared with Timer1.
In PWM mode, pin RB4/COMP0/PWM0 outputs up to a
10-bit resolution PWM output. This pin should be defined
as a PWM output by setting "1" bit PWMO in RBFUNC
register.
The period of the PWM output is determined by the
T1PPR (PWM0 Period Register) and PWM0HR[3:2]
(bit3,2 of PWM0 High Register) and the duty of the PWM
output is determined by the T1PDR (PWM0 Duty Regis-
ter) and PWM0HR[1:0] (bit1,0 of PWM0 High Register).
The user writes the lower 8-bit period value to the T1PPR
and the higher 2-bit period value to the PWM0HR[3:2].
A n d w r i t e s d u t y v a l u e t o t h e T 1 P D R a n d t h e
PWM0HR[1:0] same way.
The T1PDR is configured as a double buffering for glitch-
less PWM output. In Figure 16-10 , the duty data is trans-
fered from the master to the slave when the period data
matched to the counted value. ( i.e. at the beginning of next
duty cycle )
PWM Period = [ PWM0HR[3:2]T1PPR ] X Source Clock
PWM Duty = [ PWM0HR[1:0]T1PDR ] X Source Clock
The relation of frequency and resolution is in inverse pro-
portion. Table 16-2 shows the relation of PWM frequency
vs. resolution.
TM0
ADDRESS : D0H
RESET VALUE : --000000
-
-
CAP0
T0CK2
T0CK1
T0CK0
T0CN
T0ST
TM1
ADDRESS : D2H
RESET VALUE : 00000000
POL
16BIT
PWME
CAP1
T1CK1
T1CK0
T1CN
T1ST
-
-
1
X
X
X
X
X
X
1
0
X
1
1
X
X
2
4
128
512
8
32
fxin
EC0
Edge Detector
MUX
1
T0 + T1 ( 16-bit )
TDR1
T0IF
CLEAR
COMPARATOR
TIMER 0
INTERRUPT
T0ST
0 : Stop
1 : Start
T0CN
T0CK[2:0]
TDR0
INT0IF
INT 0
INTERRUPT
INT0
IEDS[1:0]
CAPTURE
CDR1
CDR0
( 8-bit ) ( 8-bit ) ( 8-bit ) ( 8-bit )
2048
X : The value "0" or "1" corresponding your operation.
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
51
If it needed more higher frequency of PWM, it should be
reduced resolution.
The bit POL of TM1 decides the polarity of duty cycle.
If the duty value is set same to the period value, the PWM
output is determined by the bit POL ( 1: High, 0: Low ).
And if the duty value is set to "00
H
", the PWM output is
determined by the bit POL ( 1: Low, 0: High ).
It can be changed duty value when the PWM output. How-
erver the changed duty value is output after the current pe-
riod is over. And it can be maintained the duty value at
present output when changed only period value shown as
Figure 16-12 . As it were, the absolute duty time is not
changed in varying frequency. But the changed period val-
ue must greater than the duty value
Note: At PWM output start command, one first pulse would
be output abnormally. Because if user writes regis-
ter values while timer is in operaiton, these register
could be set with certain values at first. To prevent
this operation, user must stop PWM timer clock and
then set the duty and the period register values.
.
Figure 16-10 PWM Mode
Resolution
Frequency
T1CK[1:0]
= 00(125nS)
T1CK[1:0]
= 01(250nS)
T1CK[1:0]
= 10(1uS)
10-bit
7.8KHz
3.9KHz
0.98KHZ
9-bit
15.6KHz
7.8KHz
1.95KHz
8-bit
31.2KHz
15.6KHz
3.90KHz
7-bit
62.5KHz
31.2KHz
7.81KHz
Table 16-2 PWM Frequency vs. Resolution at 8MHz
1
2
8
PWM0HR
ADDRESS : D5H
RESET VALUE : ----0000
-
-
-
-
PWM0HR3PWM0HR2PWM0HR1PWM0HR0
-
-
-
-
X
X
X
X
MUX
1
T1CN
T1CK[1:0]
T1 ( 8-bit )
T1ST
0 : Stop
1 : Start
CLEAR
COMPARATOR
COMPARATOR
T1PDR(8-bit)
PWM0HR[1:0]
T1PPR(8-bit)
PWM0HR[3:2]
T1PDR(8-bit)
S
Q
R
POL
PWM0O
RB4/
PWM0
T0 clock source
fxin
TM1
ADDRESS : D2H
RESET VALUE : 00000000
POL
16BIT
PWME
CAP1
T1CK1
T1CK0
T1CN
T1ST
X
0
1
0
X
X
X
X
[RBFUNC.4]
Period High
Duty High
Slave
Master
Bit Manipulation Not Available
X : The value IS "0" or "1" corresponding your operation.
GMS81C1102 / GMS81C1202
52
Jan. 2002 ver 2.0
Figure 16-11 Example of PWM at 8MHz
Figure 16-12 Example of Changing the Period in Absolute Duty Cycle (@8MHz)
fxin
T1
PWM
~~
~~
~~
01
02
03
04
05
7F
80
81
3FF
02
03
~~
~~
~~
~~
~~
~~
~~
POL=1
PWM
POL=0
Duty Cycle [ 80H x 125nS = 16uS ]
Period Cycle [ 3FFH x 125nS = 127.875uS, 7.8KHz ]
PWM0HR = 0CH
T1PPR = FFH
T1PDR = 80H
T1CK[1:0] = 00 ( fxin )
PWM0HR3PWM0HR2
PWM0HR1PWM0HR0
T1PPR (8-bit)
T1PDR (8-bit)
Period
Duty
1
1
FFH
0
0
80H
00
01
00
Source
T1
PWM
POL=1
Duty Cycle
Period Cycle [ 0EH x 1uS = 14uS, 71KHz ]
P W M H R = 0 0 H
T 1 P P R = 0 E H
T 1 P D R = 0 5H
T 1 C K [1:0 ] = 10 ( 1 u S )
01 02
03
04
05
06
08
09
0B 0C 0D 0E
01 02
03
04
05
06 07
08
09
0A
01 02
03 04
07
0A
05
[ 05H x 1uS = 5uS ]
Duty Cycle
[ 05H x 1uS = 5uS ]
Period Cycle [ 0AH x 1uS = 10uS, 100KHz ]
Duty Cycle
[ 05H x 1uS = 5uS ]
Write T1PPR to 0AH
Period changed
clock
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
53
17. Buzzer Output Function
The buzzer driver consists of 6-bit binary counter, the
buzzer register BUR and the clock selector. It generates
square-wave which is very wide range frequency (480
Hz~250 KHz at fxin = 4 MHz) by user programmable
counter.
Pin RB1 is assigned for output port of Buzzer driver by set-
ting the bit BUZO of RBFUNC to "1".
The 6-bit buzzer counter is cleared and start the counting
by writing signal to the register BUR. It is increased from
00H until it matches 6-bit register BUR.
Also, it is cleared by counter overflow and count up to out-
put the square wave pulse of duty 50%.
The bit 0 to 5 of BUR determines output frequency for
buzzer driving. Frequency calculation is following as
shown below.
The bits BUCK1, BUCK0 of BUR selects the source clock
from prescaler output.
Figure 17-1 Buzzer Driver
(
)
Oscillator Frequency
2
Prescaler Ratio
BUR
1
+
(
)
------------------------------------------------------------------------------
=
BUR
ADDRESS : DEH
RESET VALUE : 11111111
BUCK1
BUCK0
BUR5
BUR4
BUR3
BUR2
BUR1
BUR0
64
16
32
fxin
MUX
COUNTER ( 6-bit )
BUR ( 6-bit )
F/F
COMPARATOR
BUCK[1:0]
RB1/BUZ PIN
8
Input clock selection
00 : fxin
8
01 : fxin
16
10 : fxin
32
11 : fxin
64
Buzzer Period Data
BUZO
[RBFUNC.1]
Bit Manipulation Not Available
GMS81C1102 / GMS81C1202
54
Jan. 2002 ver 2.0
18. ANALOG TO DIGITAL CONVERTER
The analog-to-digital converter (A/D) allows conversion
of an analog input signal to a corresponding 8-bit digital
value. The A/D module has eight analog inputs, which are
multiplexed into one sample and hold. The output of the
sample and hold is the input into the converter, which gen-
erates the result via successive approximation.
The analog reference voltage is selected to V
DD
or AVref
by setting of the bit AVREFS in RBFUNC register. If ex-
ternal analog reference AVref is selected, the bit ANSEL0
should not be set to "1", because this pin is used to an ana-
log reference of A/D converter.
The A/D module has two registers which are the control
register ADCM and A/D result register ADCR. The
ADCM register, shown in Figure 18-2 , controls the oper-
ation of the A/D converter module. The port pins can be
configured as analog inputs or digital I/O.
To use analog inputs, each port is assigned analog input
port by setting the bit ANSEL[7:0] in RAFUNC register.
And selected the corresponding channel to be converted by
setting ADS[2:0].
The processing of conversion is start when the start bit
ADST is set to "1". After one cycle, it is cleared by hard-
ware. The register ADCR contains the results of the A/D
conversion. When the conversion is completed, the result
is loaded into the ADCR, the A/D conversion status bit
ADSF is set to "1", and the A/D interrupt flag ADIF is set.
The block diagram of the A/D module is shown in Figure
18-1. The A/D status bit ADSF is set automatically when
A/D conversion is completed, cleared when A/D conver-
sion is in process. The conversion time takes maximum 10
uS (at fxin=8 MHz).
Figure 18-1 A/D Converter Block Diagram
RB0/AN0/AVref
ANSEL0 ( RAFUNC.0 )
RA1/AN1
ANSEL1
RA2/AN2
ANSEL2
RA3/AN3
ANSEL3
RA4/AN4
ANSEL4
RA5/AN5
ANSEL5
RA6/AN6
ANSEL6
RA7/AN7
ANSEL7
000
001
010
011
100
101
110
111
V
DD
Pin
1
0
AVREFS ( RBFUNC.0 )
ADEN
S/H
Successive
Approximation
Circuit
A D IF
Resistor
Ladder
Circuit
ADS[2:0]
ADCR(8-bit)
Sample & Hold
A/D Interrupt
ADDRESS : EBH
RESET VALUE : Undefined
A/D Result Register
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
55
Figure 18-2 A/D Converter Registers
Figure 18-3 A/D Converter Operation Flow
A/D Converter Cautions
(1) Input range of AN0 to AN7
The input voltages of AN0 to AN7 should be within the
specification range. In particular, if a voltage above
VDD
(or AVref)
or below V
SS
is input (even if within the absolute max-
imum rating range), the conversion value for that channel can not
be indeterminate. The conversion values of the other channels
may also be affected.
(2) Noise countermeasures
In order to maintain 8-bit resolution, attention must be paid to
noise on pins AVref(or VDD)and AN0 to AN7. Since
the effect
increases in proportion to the output impedance of the an-
alog input source, it is recommended that
a capacitor be con-
nected externally as shown in Figure 18-4 in order to reduce
noise
.
Figure 18-4 Analog Input Pin Connecting Capacitor
ADCM
ADDRESS : EAH
RESET VALUE : --000001
-
-
ADEN
ADS2
ADS1
ADS0
ADST
ADSF
Reserved
Analog Channel Select
A/D Status bit
0 : A/D Conversion is in process
1 : A/D Conversion is completed
A/D Start bit
1 : A/D Conversion is started
After 1 cycle, cleared to "0"
0 : Bit force to zero
000 : Channel 0 ( RB0/AN0 )
001 : Channel 1 ( RA1/AN1 )
010 : Channel 2 ( RA2/AN2 )
011 : Channel 3 ( RA3/AN3)
100 : Channel 4 ( RA4/AN4 )
101 : Channel 5 ( RA5/AN5 )
110 : Channel 6 ( RA6/AN6 )
111 : Channel 7 ( RA7/AN7 )
A/D Enable bit
1 : A/D Conversion is enable
0 : A/D Converter module shut off
and consumes no operation current
A/D Control Register
ADCR
ADDRESS : EBH
RESET VALUE : Undefined
ADCR7
ADCR6
ADCR5
ADCR4
ADCR3
ADCR2
ADCR1
ADCR0
A/D Result Data Register
ENABLE A/D CONVERTER
A/D START ( ADST = 1 )
NOP
ADSF = 1
A/D INPUT CHANNEL SELECT
ANALOG REFERENCE SELECT
READ ADCR
YES
NO
AN0~AN7
100~1000pF
Analog
Input
GMS81C1102 / GMS81C1202
56
Jan. 2002 ver 2.0
(3) Pins AN0/RB0 and AN1/RA1 to AN7/RA7
The analog input pins AN0 to AN7 also function as input/
output port (PORT RA and RB0) pins. When A/D conver-
sion is performed with any of pins AN0 to AN7 selected,
be sure not to execute a PORT input instruction while con-
version is in progress, as this may reduce the conversion
resolution.
Also, if digital pulses are applied to a pin adjacent to the
pin in the process of A/D conversion, the expected A/D
conversion value may not be obtainable due to coupling
noise. Therefore, avoid applying pulses to pins adjacent to
the pin undergoing A/D conversion.
(4) AV
REF
pin input impedance
A series resistor string of approximately 10K
is connected be-
tween the AV
REF
pin and the V
SS
pin.
Therefore, if the output impedance of the reference voltage
source is high, this will result in parallel connection
to the
series resistor string between the AV
REF
pin and the V
SS
pin, and
there will be a large reference voltage error.
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
57
19. INTERRUPTS
The GMS81C1202 interrupt circuits consist of Interrupt
enable register (IENH, IENL), Interrupt request flags of
IRQH, IRQL, Interrupt Edge Selection Register (IEDS),
priority circuit and Master enable flag("I" flag of PSW).
The configuration of interrupt circuit is shown in Figure
19-1 and Interrupt priority is shown in Table 19-1 .
The External Interrupts INT0 and INT1 can each be transi-
tion-activated (1-to-0, 0-to-1 and both transiton).
The flags that actually generate these interrupts are bit
INT0IFand INT1IF in Register IRQH. 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 transition-activated.
The Timer 0 and Timer 1 Interrupts are generated by T0IF,
T1IF, which are set by a match in their respective timer/
counter register. The AD converter Interrupt is generated
by ADIF which is set by finishing the analog to digital con-
version. The Watch dog timer Interrupt is generated by
WDTIF which set by a match in Watch dog timer register
( when the bit WDTON is set to "0"). The Basic Interval
Timer Interrupt is generated by BITIF which is set by a
overflowing of the Basic Interval Timer Register(BITR).
.
Figure 19-1 Block Diagram of Interrupt Function
The interrupts are controlled by the interrupt master enable
flag I-flag (bit 2 of PSW), the interrupt enable register
(IENH, IENL) and the interrupt request flags (in IRQH,
IRQL) except Power-on reset and software BRK interrupt.
Interrupt enable registers are shown in Figure 19-2 . These
registers are composed of interrupt enable flags of each in-
terrupt source, these flags determines whether an interrupt
will be accepted or not. When enable flag is "0", a corre-
sponding interrupt source is prohibited. Note that PSW
contains also a master enable bit, I-flag, which disables all
interrupts at once.
BIT
BITIF
WDTIF
WDT
A/D Converter
Timer 1
Timer 0
External Int. 1
External Int. 0
IENH
Interrupt Enable
Interrupt Enable
IRQH
IRQL
Interrupt
Vector
Address
Generator
Internal bus line
Register (Lower byte)
Internal bus line
Register (Higher byte)
Release STOP
To CPU
Interrupt Master
Enable Flag
I Flag
IENL
Pr
i
o
r
i
ty Control
I-flag is in PSW, it is cleared by "DI", set by
"EI" instruction.When it goes interrupt service,
I-flag is cleared by hardware, thus any other
interrupt are inhibited. When interrupt service is
completed by "RETI" instruction, I-flag is set to
"1" by hardware.
INT0IF
INT1IF
T0IF
T1IF
ADIF
7
6
5
4
7
6
5
IEDS
Reset/Interrupt
Symbol
Priority
Vector Addr.
Hardware Reset
External Interrupt 0
External Interrupt 1
Timer 0
Timer 1
A/D Converter
Watch Dog Timer
Basic Interval Timer
RESET
INT0
INT1
Timer 0
Timer 1
A/D C
WDT
BIT
-
1
2
3
4
5
6
7
FFFE
H
FFFA
H
FFF8
H
FFF6
H
FFF4
H
FFEA
H
FFE8
H
FFE6
H
Table 19-1 Interrupt Priority
GMS81C1102 / GMS81C1202
58
Jan. 2002 ver 2.0
Figure 19-2 Interrupt Enable Registers and Interrupt Request Registers
When an interrupt is occured, the I-flag is cleared and dis-
able any further interrupt, the return address and PSW are
pushed into the stack and the PC is vectored to. Once in the
interrupt service routine the source(s) of the interrupt can
be determined by polling the interrupt request flag bits.
The interrupt request flag bit(s) must be cleared by soft-
ware before re-enabling interrupts to avoid recursive inter-
rupts. The Interrupt Request flags are able to be read and
written.
19.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 in-
struction. Interrupt acceptance sequence requires 8 f
OSC
(2
s at f
XIN
=4MHz) after the completion of the current in-
struction execution. The interrupt service task is terminat-
ed 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.
2. Interrupt request flag for the interrupt source accepted 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 decreases 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 inter-
rupt service program is executed.
IENH
ADDRESS : E2H
RESET VALUE : 0000----
INT0E
INT1E
T0E
T1E
-
-
-
-
Interrupt Enable Register High
IENL
ADDRESS : E3H
RESET VALUE : 000-----
ADE
WDTE
BITE
-
-
-
-
-
Interrupt Enable Register Low
IRQH
ADDRESS : E4H
RESET VALUE : 0000----
INT0IF
INT1IF
T0IF
T1IF
-
-
-
-
Interrupt Request Register High
IRQL
ADDRESS : E5H
RESET VALUE : 000-----
ADIF
WDTIF
BITIF
-
-
-
-
-
Interrupt Request Register Low
0 : Disable
1 : Enable
Enables or disables the interrupt individually
If flag is cleared, the interrupt is disabled.
0 : Not occurred
1 : Interrupt request is occurred
Shows the interrupt occurrence
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
59
Figure 19-3 Timing chart of Interrupt Acceptance and Interrupt Return Instruction
A interrupt request is not accepted until the I-flag is set to
"1" even if a requested interrupt has higher priority than
that of the current interrupt being serviced.
When nested interrupt service is required, the I-flag should
be set to "1" by "EI" instruction in the interrupt service
program. In this case, acceptable interrupt sources are se-
lectively 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 accumulator and other registers are
not saved itself. These registers are saved by the software
if necessary. Also, when multiple interrupt services are
nested, it is necessary to avoid using the same data memory
area for saving registers.
The following method is used to save/restore the general-
purpose registers.
Example: Register save using push and pop instructions
General-purpose register save/restore using push and pop
instructions;
V.L.
System clock
Address Bus
PC
SP
SP-1
SP-2
V.H.
New PC
V.L.
Data Bus
Not used
PCH
PCL
PSW
ADL
OP code
ADH
Instruction Fetch
Internal Read
Internal Write
Interrupt Processing Step
Interrupt Service Task
V.L. and V.H. are vector addresses.
ADL and ADH are start addresses of interrupt service routine as vector contents.
Basic Interval Timer
012
H
0E3
H
0FFE6
H
0FFE7
H
0E
H
2E
H
0E312
H
0E313
H
Entry Address
Correspondence between vector table address for BIT interrupt
and the entry address of the interrupt service program.
Vector Table Address
INTxx:
PUSH
A
PUSH
X
PUSH
Y
;SAVE ACC.
;SAVE X REG.
;SAVE Y REG.
interrupt processing
POP
Y
POP
X
POP
A
RETI
;RESTORE Y REG.
;RESTORE X REG.
;RESTORE ACC.
;RETURN
main task
interrupt
service task
saving
registers
restoring
registers
acceptance of
interrupt
interrupt return
GMS81C1102 / GMS81C1202
60
Jan. 2002 ver 2.0
19.2 BRK Interrupt
Software interrupt can be invoked by BRK instruction,
which has 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 distin-
guish BRK from TCALL 0.
Each processing step is determined by B-flag as shown in
Figure 19-4.
Figure 19-4 Execution of BRK/TCALL0
19.3 Multi Interrupt
If two requests of different priority levels are received si-
multaneously, the request of higher priority level is ser-
viced. If requests of the interrupt are received at the same
time simultaneously, an internal polling sequence deter-
mines by hardware which request is serviced.
However, multiple processing through software for special
features is possible. Generally when an interrupt is accept-
ed, the I-flag is cleared to disable any further interrupt. But
as user sets I-flag in interrupt routine, some further inter-
rupt can be serviced even if certain interrupt is in progress.
Example: Even though Timer1 interrupt is in progress,
INT0 interrupt serviced without any suspend.
TIMER1:
PUSH
A
PUSH
X
PUSH
Y
LDM
IENH,#80H
;
Enable INT0 only
LDM
IENL,#0
;
Disable other
EI
;
Enable Interrupt
:
:
:
:
:
:
LDM
IENH,#0FFH
;
Enable all interrupts
LDM
IENL,#0F0H
POP
Y
POP
X
POP
A
RETI
Figure 19-5 Execution of Multi Interrupt
B-FLAG
BRK
INTERRUPT
ROUTINE
RETI
TCALL0
ROUTINE
RET
BRK or
TCALL0
=0
=1
enable INT0
TIMER 1
service
INT0
service
Main Program
service
Occur
TIMER1 interrupt
Occur
INT0
EI
disable other
enable INT0
enable other
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.
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
61
19.4 External Interrupt
The external interrupt on INT0 and INT1 pins are edge
triggered depending on the edge selection register IEDS
(address 0E6
H
) as shown in Figure 19-6 .
The edge detection of external interrupt has three transition
activated mode: rising edge, falling edge, and both edge
.
Figure 19-6 External Interrupt Block Diagram
Example: To use as an INT0 and INT1
:
:
;
**** Set port as an input port RB2,RB3
LDM
RBIO,#1111_0011B
;
;
;
**** Set port as an interrupt port
LDM
RBFUNC,#0C0H
;
;
;
**** Set Falling-edge Detection
LDM
IEDS,#0000_0101B
:
:
Response Time
The INT0 and INT1 edge are latched into INT0IF and
INT1IF at every machine cycle. The values are not actually
polled by the circuitry until the next machine cycle. If a re-
quest is active and conditions are right for it to be acknowl-
edged, a hardware subroutine call to the requested service
routine will be the next instruction to be executed. The
DIV itself takes twelve 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.
Below shows interrupt response timings.
Figure 19-7 Interrupt Response Timing Diagram
INT0IF
INT0 pin
INT0 INTERRUPT
INT1IF
INT1 pin
INT1 INTERRUPT
IEDS
[0E6
H
]
e
dge
sele
ction
INT0 edge select
Ext. Interrupt Edge Selection
IEDS
ADDRESS : 0E6
H
RESET VALUE : 00000000
00: Int. disable
W
W
W
W
W
W
01: falling
10: rising
11: both
INT1 edge select
00: Int. disable
01: falling
10: rising
11: both
Register
W
W
Interrupt
goes
active
Interrupt
latched
Interrupt
processing
Interrupt
routine
8 f
OSC
max. 12 f
OSC
GMS81C1102 / GMS81C1202
62
Jan. 2002 ver 2.0
20. WATCHDOG TIMER
The purpose of the watchdog timer is to detect the mal-
function (runaway) of program due to external noise or
other causes and return the operation to the normal condi-
tion.
The watchdog timer has two types of clock source.
The first type is an on-chip RC oscillator which does not
require any external components. This RC oscillator is sep-
arate from the external oscillator of the Xin pin. It means
that the watchdog timer will run, even if the clock on the
Xin pin of the device has been stopped, for example, by en-
tering the STOP mode.
The other type is a prescaled system clock.
The watchdog timer consists of 7-bit binary counter and
the watchdog timer data register. The source clock of
WDT is overflow of Basic Interval Timer. When the value
of 7-bit binary counter is equal to the lower 7 bits of
WDTR, the interrupt request flag is generated. This can be
used as WDT interrupt or CPU reset signal in accordance
with the bit WDTON .
Note: Because the watchdog timer counter is enabled af-
ter clearing Basic Interval Timer, after the bit WD-
TON set to "1", maximum error of timer is depend on
prescaler ratio of Basic Interval Timer.
The 7-bit binary counter is cleared by setting WDTCL(bit7
of WDTR) and the WDTCL is cleared automatically after
1 machine cycle.
The RC oscillated watchdog timer is activated by setting
the bit RCWDT of CKCTLR and executing the STOP in-
struction as shown below.
The RC oscillation period is variable according to the tem-
perature, V
DD
and process variations from part to part (ap-
proximately, 120~180uS). The following equation shows
the RC oscillated watchdog timer time-out.
T
R C W D T
= C L K
R C
2
8
[
W D T R .6 ~ 0 ]+ (C L K
R C
2
8
)/2
w h ere, C L K
R C
= 1 2 0 ~ 1 8 0 u S
In addition, this watchdog timer can be used as a simple 7-
bit timer by interrupt WDTIF. The interval of watchdog
timer interrupt is decided by Basic Interval Timer. Interval
equation is as below.
T
WDT
= [WDTR.6~0]



Interval of BIT
Figure 20-1 Block Diagram of Watchdog Timer
:
LDM
CKCTLR,#3FH
; enable the RC-osc WDT
LDM
WDTR,#0FFH
; set the WDT period
STOP
; enter the STOP mode
NOP
NOP
; RC-osc WDT running
:
8
16
128
256
512
1024
32
64
0
1
MUX
8
3
fxin
BITR ( 8-bit )
BTS[2:0]
Internal RC OSC
Basic Interval Timer
Interrupt
BTCL
Clear
Watchdog Timer
BITIF
7-bit Counter
WDTR (8-bit)
OFD
WDTCL
WDTON
Interrupt Request
CPU RESET
1
0
Clock Control Register
CKCTLR
ADDRESS : ECH
RESET VALUE : -0010111
-
WAKEUP RCWDT
WDTON
BTCL
BTS2
BTS1
BTS0
-
0
X
1
X
X
X
X
Watchdog Timer Register
WDTR
ADDRESS : EDH
RESET VALUE : 01111111
WDTCL
7-bit Watchdog Counter Register
Overflow Detection
Bit Manipulation Not Available
Bit Manipulation Not Available
STOP
WAKEUP
RCWDT
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
63
21. Power Saving Mode
For applications where power consumption is a critical
factor, device provides three kinds of power saving func-
tions, STOP mode, Wake-up Timer mode and internal RC-
oscillated watchdog timer mode.
The power saving function is activated by execution of
STOP instruction after setting the corresponding bit
(WAKEUP, RCWDT) of CKCTLR.
Table 21-1 shows the status of each Power Saving Mode
Note: Before executing STOP instruction, clear all in-
terrupt request flag. Because if the interrupt re-
quest flag is set before STOP instruction, the MCU
runs as if it doesn't perform STOP instruction, even
though the STOP instruction is completed. So insert
two lines to clear all interrupt request flags (IRQH,
IRQL) before STOP instruction as shown each ex-
ample.
21.1 Stop Mode
In the Stop mode, the on-chip oscillator is stopped. With
the clock frozen, all functions are stopped, but the on-chip
RAM and Control registers are held. The port pins out the
values held by their respective port data register, port di-
rection registers. Oscillator stops and the systems internal
operations are all held up.
The states of the RAM, registers, and latches valid
immediately before the system is put in the STOP
state are all held.
The program counter stop the address of the
instruction to be executed after the instruction
"STOP" which starts the STOP operating mode.
The Stop mode is activated by execution of STOP in-
struction after setting the bit WAKEUP and RCWDT
of CKCTLR to "00". (This register should be written
by byte operation. If this register is set by bit manipu-
lation instruction, for example "set1" or "clr1" instruc-
tion, it may be undesired operation)
In the Stop mode of operation, V
DD
can be reduced to min-
imize power consumption. Care must be taken, however,
to ensure that V
DD
is not reduced before the Stop mode is
invoked, and that V
DD
is restored to its normal operating
level, before the Stop mode is terminated.
The reset should not be activated before V
DD
is restored to
its normal operating level, and must be held active long
enough to allow the oscillator to restart and stabilize.
Note: After STOP instruction, at least two or more NOP
instruction should be written
Ex) LDM CKCTLR,#0000_1110B
LDM IRQH,#0
LDM IRQL,#0
STOP
NOP
NOP
In the STOP operation, the dissipation of the power asso-
ciated with the oscillator and the internal hardware is low-
ered; however, the power dissipation associated with the
pin interface (depending on the external circuitry and pro-
gram) is not directly determined by the hardware operation
of the STOP feature. This point should be little current
flows when the input level is stable at the power voltage
Peripheral
STOP
Wake-up Timer
Internal RC-WDT
RAM
Retain
Retain
Retain
Control Registers
Retain
Retain
Retain
I/O Ports
Retain
Retain
Retain
CPU
Stop
Stop
Stop
Timer0
Stop
Operation
Stop
Oscillation
Stop
Oscillation
Stop
Prescaler
Stop
2048 only
Stop
Internal RC oscillator
Stop
Stop
Oscillation
Entering Condition
CKCTLR[6,5]
00
1X
01
Power Saving Release
Source
RESET, INT0, INT1
RESET, INT0, INT1,
Timer0
RESET, INT0, INT1,
RC-WDT
Table 21-1 Power Saving Mode
GMS81C1102 / GMS81C1202
64
Jan. 2002 ver 2.0
level (V
DD
/V
SS
), however, when the input level gets high-
er than the power voltage level (by approximately 0.3 to
0.5V), a current begins to flow. Therefore, if cutting off the
output transistor at an I/O port puts the pin signal into the
high-impedance state, a current flow across the ports input
transistor, requiring to fix the level by pull-up or other
means.
Release the STOP mode
The exit from STOP mode is hardware reset or external in-
terrupt. Reset re-defines all the Control registers but does
not change the on-chip RAM. External interrupts allow
both on-chip RAM and Control registers to retain their val-
ues.
After releasing STOP mode, instruction execution is divid-
ed into two ways by I-flag(bit2 of PSW).
If I-flag = 1, the normal interrupt response takes place. If I-
flag = 0, the chip will resume execution starting with the
instruction following the STOP instruction. It will not vec-
tor to interrupt service routine. (refer to Figure 21-1)
When exit from Stop mode by external interrupt, enough
oscillation stabilization time is required to normal opera-
tion. Figure 21-2 shows the timing diagram. When release
the Stop mode, the Basic interval timer is activated on
wake-up. It is increased from 00
H
until FF
H
. The count
overflow is set to start normal operation. Therefore, before
STOP instruction, user must be set its relevant prescaler di-
vide ratio to have long enough time (more than 20msec).
This guarantees that oscillator has started and stabilized.
By reset, exit from Stop mode is shown in Figure 21-3.
Minimizing Current Consumption in Stop Mode
The Stop mode is designed to reduce power consumption.
To minimize the current consumption during Stop mode,
the user should turn-off output drivers that are sourcing or
sinking current, if it is practical. Weak pull-ups on port
pins should be turned off, if possible. All inputs should be
either as V
SS
or at V
DD
(or as close to rail as possible).
An intermediate voltage on an input pin causes the input
buffer to draw a significant amount of current.
Figure 21-1 STOP Releasing Flow by Interrupts
Figure 21-2 Timing of STOP Mode Release by External Interrupt
IEXX
=0
=1
STOP
INSTRUCTION
STOP Mode
Interrupt Request
STOP Mode Release
I-FLAG
=1
Interrupt Service Routine
Next
INSTRUCTION
=0
Master Interrupt
Enable Bit PSW[2]
Corresponding Interrupt
Enable Bit (IENH, IENL)
~~
STOP Mode
Normal Operation
Oscillator
(X
IN
pin)
~~
~~
N+1
N
N+2
00
01
FE
FF
00
01
N-1
N-2
~~
~~
~~
~~
~~
Clear Basic Interval Timer
STOP Instruction Execution
Normal Operation
Stabilization Time
t
ST
> 20mS
Internal
Clock
External
Interrupt
BIT
Counter
~~
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
65
Figure 21-3 Timing of STOP Mode Release by RESET
21.2 Wake-up Timer Mode
In the Wake-up Timer mode, the on-chip oscillator is not
stopped. Except the Prescaler (only 2048 divided ratio) and
Timer0, all functions are stopped, but the on-chip RAM
and Control registers are held. The port pins out the values
held by their respective port data register, port direction
registers.
The Wake-up Timer mode is activated by execution of
STOP instruction after setting the bit WAKEUP of
CKCTLR to "1". (This register should be written by
byte operation. If this register is set by bit manipulation
instruction, for example "set1" or "clr1" instruction, it
may be undesired operation)
Note: After STOP instruction, at least two or more NOP in-
struction should be written
Ex) LDM TDR0,#0FFH
LDM TM0,#0001_1011B
LDM CKCTLR,#0100_1110B
LDM IRQH,#0
LDM IRQL,#0
STOP
NOP
NOP
In addition, the clock source of timer0 should be select-
ed to 2048 divided ratio. Otherwise, the wake-up func-
tion can not work. And the timer0 can be operated as
16-bit timer with timer1 (refer to timer function). The
period of wake-up function is varied by setting the tim-
er data register 0, TDR0.
Release the Wake-up Timer mode
The exit from Wake-up Timer mode is hardware reset,
Timer0 overflow or external interrupt. Reset re-defines all
the Control registers but does not change the on-chip
RAM. External interrupts and Timer0 overflow allow both
on-chip RAM and Control registers to retain their values.
If I-flag = 1, the normal interrupt response takes place. If I-
flag = 0, the chip will resume execution starting with the
instruction following the STOP instruction. It will not vec-
tor to interrupt service routine (refer to Figure 21-1).
When exit from Wake-up Timer mode by external inter-
rupt or timer0 overflow, the oscillation stabilization time is
not required to normal operation. Because this mode do not
stop the on-chip oscillator shown as Figure 21-4.
Figure 21-4 Wake-up Timer Mode Releasing by External Interrupt or Timer0 Interrupt
~~
STOP Mode
Oscillator
(X
IN
pin)
~~
~~
~~
STOP Instruction Execution
Stabilization Time
t
ST
= 64mS @4MHz
Internal
Clock
Internal
~~
~~
~~
~~
~~
RESET
RESET
Time can not be controlled by software
Wake-up Timer Mode
Oscillator
(X
IN
pin)
~~
STOP Instruction
Normal Operation
Normal Operation
CPU
Clock
Request
Interrupt
~~
~~
Execution
Do not need Stabilization Time
(stop the CPU clock)
~~
GMS81C1102 / GMS81C1202
66
Jan. 2002 ver 2.0
21.3 Internal RC-Oscillated Watchdog Timer Mode
In the Internal RC-Oscillated Watchdog Timer mode, the
on-chip oscillator is stopped. But internal RC oscillation
circuit is oscillated in this mode. The on-chip RAM and
Control registers are held. The port pins out the values held
by their respective port data register, port direction regis-
ters.
The Internal RC-Oscillated Watchdog Timer mode is
activated by execution of STOP instruction after set-
ting the bit WAKEUP and RCWDT of CKCTLR to
"01". (This register should be written by byte opera-
tion. If this register is set by bit manipulation instruc-
tion, for example "set1" or "clr1" instruction, it may be
undesired operation)
Note: After STOP instruction, at least two or more NOP in-
struction should be written
Ex) LDM WDTR,#1111_1111B
LDM CKCTLR,#0010_1110B
LDM IRQH,#0
LDM IRQL,#0
STOP
NOP
NOP
Release the Internal RC-Oscillated Watchdog Timer mode
The exit from Internal RC-Oscillated Watchdog Timer
mode is hardware reset or external interrupt. Reset re-de-
fines all the Control registers but does not change the on-
chip RAM. External interrupts allow both on-chip RAM
and Control registers to retain their values.
If I-flag = 1, the normal interrupt response takes place. In
this case, if the bit WDTON of CKCTLR is set to "0" and
the bit WDTE of IENH is set to "1", the device will exe-
cute the watchdog timer interrupt service routine.(Figure
21-5) However, if the bit WDTON of CKCTLR is set to
"1", the device will generate the internal RESET signal
and execute the reset processing. (Figure 21-6)
If I-flag = 0, the chip will resume execution starting with
the instruction following the STOP instruction. It will not
vector to interrupt service routine (refer to Figure 21-1).
When exit from Internal RC-Oscillated Watchdog Timer
mode by external interrupt, the oscillation stabilization
time is required for normal operation. Figure 21-5 shows
the timing diagram. When release the Internal RC-Oscil-
lated Watchdog Timer mode, the basic interval timer is ac-
tivated on wake-up. It is increased from 00
H
until FF
H
. The
count overflow is set to start normal operation. Therefore,
before STOP instruction, user must be set its relevant pres-
caler divide ratio to have long enough time (more than
20msec). This guarantees that oscillator has started and
stabilized.
By reset, exit from internal RC-Oscillated Watchdog Tim-
er mode is shown in Figure 21-6.
Figure 21-5 Internal RCWDT Mode Releasing by External Interrupt or WDT Interrupt
~~
RCWDT Mode
Normal Operation
Oscillator
(X
IN
pin)
~~
~~
N+1
N
N+2
00
01
FE
FF
00
00
N-1
N-2
~~
~~
~~
~~
~~
Clear Basic Interval Timer
STOP Instruction Execution
Normal Operation
Stabilization Time
t
ST
> 20mS
Internal
Clock
External
Interrupt
BIT
Counter
~~
Internal
RC Clock
(or WDT Interrupt)
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
67
Figure 21-6 Internal RCWDT Mode Releasing by RESET.
Figure 21-7 Application Example of Unused Input Port
Figure 21-8 Application Example of Unused output Port
~~
Oscillator
(X
IN
pin)
~~
~~
~~
~~
Internal
Clock
Internal
RC Clock
~~
STOP Instruction Execution
Stabilization Time
t
ST
= 64mS @4MHz
Internal
~~
~~
~~
RESET by WDT
RESET
RESET
RCWDT Mode
Time can not be controlled by software
INPUT PIN
V
DD
GND
i
V
DD
X
Weak pull-up current flows
V
DD
internal
pull-up
INPUT PIN
i
V
DD
X
Very weak current flows
V
DD
O
O
OPEN
OPEN
i=0
O
i=0
O
GND
When port is configured as an input, input level should
be closed to 0V or 5V to avoid power consumption.
OUTPUT PIN
GND
i
In the left case, much current flows from port to GND.
X
ON
OFF
OUTPUT PIN
GND
i
In the left case, Tr. base current flows from port to GND.
i=0
X
OFF
ON
V
DD
L
ON
OFF
OPEN
GND
V
DD
L
ON
OFF
To avoid power consumption, there should be low output
ON
OFF
O
O
V
DD
O
to the port .
GMS81C1102 / GMS81C1202
68
Jan. 2002 ver 2.0
22. RESET
The reset input is the RESET pin, which is the input to a
Schmitt Trigger. A reset in accomplished by holding the
RESET pin low for at least 8 oscillator periods, while the
oscillator running. After reset, 64ms (at 4 MHz) add with
7 oscillator periods are required to start execution as shown
in Figure 22-1 .
Internal RAM is not affected by reset. When V
DD
is turned
on, the RAM content is indeterminate. Therefore, this
RAM should be initialized before reading or testing it.
Initial state of each register is shown as Table 12-3 .
Figure 22-1 Timing Diagram after RESET
MAIN PROGRAM
Oscillator
(X
IN
pin)
?
?
FFFE FFFF
Stabilization Time
t
ST
= 64mS at 4MHz
RESET
ADDRESS
DATA
1
2
3
4
5
6
7
?
?
Start
?
?
?
FE
?
ADL
ADH
OP
BUS
BUS
RESET Process Step
~~
~~
~~
~~
~~
~~
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
69
23. POWER FAIL PROCESSOR
The GMS81C1202 has an on-chip power fail detection cir-
cuitry to immunize against power noise. A configuration
register, PFDR, can enable (if clear/programmed) or disa-
ble (if set) the Power-fail Detect circuitry. If V
DD
falls be-
low 3.0~4.0V range for longer than 50 nS, the Power fail
situation may reset MCU according to PFDM bit of PFDR.
As below PFDR register is not implemented on the in-cir-
cuit emulator, user can not experiment with it. Therefore,
after final development of user program, this function may
be experimented.
Note: Power fail processor function is not available on 3V
operation, because this function will detect power
fail all the time.
Figure 23-1 Power Fail Detector Register
Figure 23-2 Example S/W of RESET by Power fail
PFDR
ADDRESS : EFH
RESET VALUE : -----100
-
-
-
-
-
PFDIS
PFDM
PFS
Reserved
Power Fail Status
0 : Normal Operate
1 : This bit force to "1" when
Operation Mode
0 : System clock freezing during power fail
1 : MCU will be reset during power fail
Disable Flag
0 : Power fail detection enable
1 : Power fail detection disable
Power Fail Detector Register
Power fail was detected
FUNTION
EXECUTION
INITIALIZE RAM DATA
PFS =1
NO
RESET VECTOR
INITIALIZE ALL PORTS
INITIALIZE REGISTERS
RAM CLEAR
YES
Skip the
initial routine
GMS81C1102 / GMS81C1202
70
Jan. 2002 ver 2.0
Figure 23-3 Power Fail Processor Situations
Internal
RESET
Internal
RESET
Internal
RESET
V
DD
V
DD
V
DD
PFV
DD
MAX
PFV
DD
MIN
PFV
DD
MAX
PFV
DD
MIN
PFV
DD
MAX
PFV
DD
MIN
64mS
64mS
t < 64mS
64mS
When PFDM = 1
V
DD
V
DD
PFV
DD
MAX
PFV
DD
MIN
PFV
DD
MAX
PFV
DD
MIN
When PFDM = 0
System
Clock
System
Clock
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
71
24. OTP PROGRAMMING
The GMS87C1102/1202 is one-time PROM(OTP) microcontroller with 2K bytes electrically programmable read only mem-
ory for the GMS81C1102/1202 system evaluation, first production and fast mass production.
To programming the OTP device, user must use the universal programmer which is support Hynix Semiconductor.
24.1 Program Memory MAP
Program Memory consists of configuration area and user program memory area. The configuration memory area has two
parts (User ID & System Configuration Bits), the areas are shown below in Figure 24-1.
The Device Configuration Area can be programmed or left unprogrammed to select device configuration such as security bit.
Ten memory locations (0F50
H
~ 0FE0
H
) are designated as Customer ID recording locations where the user can store check-
sum or other customer identification numbers.
This area is not accessible during normal execution but is readable and writable during program / verify.
Figure 24-1 Device Configuration Area
The Security Definition Method is explained below.
1) After writing "H" to code protect bit in Write & Verify Mode and getting out of Write & Verify Mode, user cannot read
out the program code. But if not getting out of Write & Verify Mode (maintaining Programming Power VPP = 12.75V), user
can verify Program code.
2) Regardless of Code protect, user can read out configuration Memory (User ID and Configuration Bits)
3) If user knows Security (Lock) state, user can read code protect bit in the System Configuration Bits.
DEVICE
0F50
H
0F50
H
0FF0
H
0FF0
H
ID
CONFIG
CONFIGURATION
AREA
0F60
H
ID
0F70
H
ID
0F80
H
ID
0F90
H
ID
0FA0
H
ID
0FB0
H
ID
0FC0
H
ID
0FD0
H
ID
0FE0
H
ID
RC
Configuration Register
CONFIG
ADDRESS : 0FF0H
-
LOCK
-
-
-
-
-
0 : Allow Code Read Out
1 : Prohibit Code Read Out
SECURITY BIT
0 : Normal Oscillator
1 : External RC Oscillator
RC Option
GMS81C1102 / GMS81C1202
72
Jan. 2002 ver 2.0
Figure 24-2 Pin Assignment
Table 24-1 Pin Description in EPROM Mode
Pin No.
User Mode
EPROM MODE
Pin Name
Pin Name
Description
1
RA4 (AN4)
A_D4
Address Input
Data Input/Output
A12
A4
D4
2
RA5 (AN5)
A_D5
A13
A5
D5
3
RA6 (AN6)
A_D6
A14
A6
D6
4
RA7 (AN7)
A_D7
A15
A7
D7
5
V
DD
V
DD
Connect to V
DD
(6.0V)
6
RB0 (AVref/AN0)
CTL0
Read/Write Control
Address/Data Control
7
RB2 (INT0)
CTL1
8
RB4 (PWM/COMP)
CTL2
9
X
IN
EPROM Enable
High Active, Latch Address in falling edge
10
X
OUT
NC
No connection
11
RESET
V
PP
Programming Power (0V, 12.75V)
12
V
SS
V
SS
Connect to V
SS
(0V)
13
RA0 (EC0)
A_D0
Address Input
Data Input/Output
A8
A0
D0
14
RA1 (AN1)
A_D1
A9
A1
D1
15
RA2 (AN2)
A_D2
A10
A2
D2
16
RA3 (AN3)
A_D3
A11
A3
D3
1
2
3
4
5
6
7
8
16
15
14
13
12
11
10
9
V
PP
A_D0
A_D1
A_D2
A_D3
EPROM Enable
A_D7
A_D6
A_D5
A_D4
CTL2
CTL1
CTL0
NC
V
SS
V
DD
G
M
S
87C1
102
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
73
Figure 24-3 Pin Assignment
Table 24-2 Pin Description in EPROM Mode
V
DD
1
2
3
4
5
6
7
8
9
10
20
19
18
17
16
15
14
13
12
11
V
PP
A_D0
A_D1
A_D2
A_D3
EPROM Enable
A_D7
A_D6
A_D5
A_D4
CTL2
CTL1
CTL0
V
SS
NC
G
M
S87
C
12
02
Pin No.
User Mode
EPROM MODE
Pin Name
Pin Name
Description
1
RA4 (AN4)
A_D4
Address Input
Data Input/Output
A12
A4
D4
2
RA5 (AN5)
A_D5
A13
A5
D5
3
RA6 (AN6)
A_D6
A14
A6
D6
4
RA7 (AN7)
A_D7
A15
A7
D7
5
V
DD
V
DD
Connect to V
DD
(6.0V)
6
RB0 (AVref/AN0)
CTL0
Read/Write Control
Address/Data Control
7
RB1 (BUZ)
CTL1
8
RB2 (INT0)
CTL2
9
RB3 (INT1)
V
DD
Connect to V
DD
(6.0V)
10
RB4 (PWM/COMP)
V
DD
Connect to V
DD
(6.0V)
11
X
IN
EPROM Enable
High Active, Latch Address in falling edge
12
X
OUT
NC
No connection
13
RESET
V
PP
Programming Power (0V, 12.75V)
14
V
SS
V
SS
Connect to V
SS
(0V)
15,16
RC0, 1
V
DD
Connect to V
DD
(6.0V)
17
RA0 (EC0)
A_D0
Address Input
Data Input/Output
A8
A0
D0
18
RA1 (AN1)
A_D1
A9
A1
D1
19
RA2 (AN2)
A_D2
A10
A2
D2
20
RA3 (AN3)
A_D3
A11
A3
D3
GMS81C1102 / GMS81C1202
74
Jan. 2002 ver 2.0
Figure 24-4 Timing Diagram in Program (Write & Verify) Mode
Figure 24-5 Timing Diagram in READ Mode
V
PP
CTL0
~~
High 8bit
HA
LA
DATA IN
DATA
~~
~~
~~
~~
OUT
LA
DATA IN
DATA
OUT
EPROM
Enable
CTL1
CTL2
A_D7~
V
DD
V
DD1H
0V
0V
0V
Address
Input
Low 8bit
Address
Input
Write Mode
Verify
Low 8bit
Address
Input
Write Mode
Verify
A_D0
T
VDDS
T
VPPR
T
VPPS
~~
V
DD1H
V
DD1H
V
IHP
~~
~~
~~
~~
~~
~~
~~
~~
T
HLD1
T
HLD2
T
SET1
T
DLY1
T
DLY2
T
CD1
T
CD1
T
CD1
T
CD1
V
PP
CTL0
High 8bit
HA
LA
DATA
LA
DATA
DATA
EPROM
Enable
CTL1
CTL2
A_D7~
V
DD
V
DD2H
0V
0V
0V
Address
Input
Low 8bit
Address
Input
DATA
A_D0
T
VDDS
T
VPPR
T
VPPS
V
DD2H
V
DD2H
V
IHP
T
HLD1
T
HLD2
T
SET1
T
DLY1
T
DLY2
T
CD1
T
CD2
T
CD2
T
CD1
HA
LA
Output
Low 8bit
Address
Input
High 8bit
Address
Input
Low 8bit
Address
Input
DATA
Output
DATA
Output
After input a high address,
output data following low address input
Anothe high address step
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
75
Table 24-3 AC/DC Requirements for Program/Read Mode
Parameter
Symbol
MIN
TYP
MAX
Unit
Programming Supply Current
I
VPP
-
-
50
mA
Supply Current in EPROM Mode
I
VDDP
-
-
20
mA
V
PP
Level during Programming
V
IHP
12.0
12.5
13.0
V
V
DD
Level in Program Mode
V
DD1H
5
6
6.5
V
V
DD
Level in Read Mode
V
DD2H
-
2.7
-
V
CTL2~0 High Level in EPROM Mode
V
IHC
0.8V
DD
-
-
V
CTL2~0 Low Level in EPROM Mode
V
ILC
-
-
0.2V
DD
V
A_D7~A_D0 High Level in EPROM Mode
V
IHAD
0.9V
DD
-
-
V
A_D7~A_D0 Low Level in EPROM Mode
V
ILAD
-
-
0.1V
DD
V
V
DD
Saturation Time
T
VDDS
1
-
-
mS
V
PP
Setup Time
T
VPPR
-
-
1
mS
V
PP
Saturation Time
T
VPPS
1
-
-
mS
EPROM Enable Setup Time after Data Input
T
SET1
200
nS
EPROM Enable Hold Time after T
SET1
T
HLD1
500
nS
EPROM Enable Delay Time after T
HLD1
T
DLY1
200
nS
EPROM Enable Hold Time in Write Mode
T
HLD2
100
nS
EPROM Enable Delay Time after T
HLD2
T
DLY2
200
nS
CTL2,1 Setup Time after Low Address input and Data input
T
CD1
100
nS
CTL1 Setup Time before Data output in Read and Verify Mode
T
CD2
100
nS
GMS81C1102 / GMS81C1202
76
Jan. 2002 ver 2.0
Figure 24-6 Programming Flow Chart
START
Set V
DD
=V
DD1H
Set V
PP
=V
IHP
Verify blank
First Address Location
EPROM Write
N=1
Verify pass
Last address
Apply 3N program cycle
100uS program time
Next address location
N > 25
Report
Programming failure
Report
Programming failure
Verify fof all address
Verify OK
Report
Verify failure
Report
Programming OK
V
DD
=V
pp
=0v
END
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
GMS81C1102 / GMS81C1202
Jan. 2002 ver 2.0
77
Figure 24-7 Reading Flow Chart
START
Set V
DD
=V
DD2H
Set V
PP
=V
IHP
Last address
First Address Location
V
DD
=0V
Report Read OK
V
PP
=0V
Next address location
Verify fof all address
END
NO
YES
GMS81C1102 / GMS81C1202
78
Jan. 2002 ver 2.0
APPENDIX
GMS81C1102/GMS81C1202
Jan. 2002 Ver 2.0
i
APPENDIX
A. INSTRUCTION MAP
LOW
HIGH
00000
00
00001
01
00010
02
00011
03
00100
04
00101
05
00110
06
00111
07
01000
08
01001
09
01010
0A
01011
0B
01100
0C
01101
0D
01110
0E
01111
0F
000
-
SET1
dp.bit
BBS
A.bit,rel
BBS
dp.bit,rel
ADC
#imm
ADC
dp
ADC
dp+X
ADC
!abs
ASL
A
ASL
dp
TCALL
0
SETA1
.bit
BIT
dp
POP
A
PUSH
A
BRK
001
CLRC
SBC
#imm
SBC
dp
SBC
dp+X
SBC
!abs
ROL
A
ROL
dp
TCALL
2
CLRA1
.bit
COM
dp
POP
X
PUSH
X
BRA
rel
010
CLRG
CMP
#imm
CMP
dp
CMP
dp+X
CMP
!abs
LSR
A
LSR
dp
TCALL
4
NOT1
M.bit
TST
dp
POP
Y
PUSH
Y
PCALL
Upage
011
DI
OR
#imm
OR
dp
OR
dp+X
OR
!abs
ROR
A
ROR
dp
TCALL
6
OR1
OR1B
CMPX
dp
POP
PSW
PUSH
PSW
RET
100
CLRV
AND
#imm
AND
dp
AND
dp+X
AND
!abs
INC
A
INC
dp
TCALL
8
AND1
AND1B
CMPY
dp
CBNE
dp+X
TXSP
INC
X
101
SETC
EOR
#imm
EOR
dp
EOR
dp+X
EOR
!abs
DEC
A
DEC
dp
TCALL
10
EOR1
EOR1B
DBNE
dp
XMA
dp+X
TSPX
DEC
X
110
SETG
LDA
#imm
LDA
dp
LDA
dp+X
LDA
!abs
TXA
LDY
dp
TCALL
12
LDC
LDCB
LDX
dp
LDX
dp+Y
XCN
DAS
111
EI
LDM
dp,#imm
STA
dp
STA
dp+X
STA
!abs
TAX
STY
dp
TCALL
14
STC
M.bit
STX
dp
STX
dp+Y
XAX
STOP
LOW
HIGH
10000
10
10001
11
10010
12
10011
13
10100
14
10101
15
10110
16
10111
17
11000
18
11001
19
11010
1A
11011
1B
11100
1C
11101
1D
11110
1E
11111
1F
000
BPL
rel
CLR1
dp.bit
BBC
A.bit,rel
BBC
dp.bit,rel
ADC
{X}
ADC
!abs+Y
ADC
[dp+X]
ADC
[dp]+Y
ASL
!abs
ASL
dp+X
TCALL
1
JMP
!abs
BIT
!abs
ADDW
dp
LDX
#imm
JMP
[!abs]
001
BVC
rel
SBC
{X}
SBC
!abs+Y
SBC
[dp+X]
SBC
[dp]+Y
ROL
!abs
ROL
dp+X
TCALL
3
CALL
!abs
TEST
!abs
SUBW
dp
LDY
#imm
JMP
[dp]
010
BCC
rel
CMP
{X}
CMP
!abs+Y
CMP
[dp+X]
CMP
[dp]+Y
LSR
!abs
LSR
dp+X
TCALL
5
MUL
TCLR1
!abs
CMPW
dp
CMPX
#imm
CALL
[dp]
011
BNE
rel
OR
{X}
OR
!abs+Y
OR
[dp+X]
OR
[dp]+Y
ROR
!abs
ROR
dp+X
TCALL
7
DBNE
Y
CMPX
!abs
LDYA
dp
CMPY
#imm
RETI
100
BMI
rel
AND
{X}
AND
!abs+Y
AND
[dp+X]
AND
[dp]+Y
INC
!abs
INC
dp+X
TCALL
9
DIV
CMPY
!abs
INCW
dp
INC
Y
TAY
101
BVS
rel
EOR
{X}
EOR
!abs+Y
EOR
[dp+X]
EOR
[dp]+Y
DEC
!abs
DEC
dp+X
TCALL
11
XMA
{X}
XMA
dp
DECW
dp
DEC
Y
TYA
110
BCS
rel
LDA
{X}
LDA
!abs+Y
LDA
[dp+X]
LDA
[dp]+Y
LDY
!abs
LDY
dp+X
TCALL
13
LDA
{X}+
LDX
!abs
STYA
dp
XAY
DAA
111
BEQ
rel
STA
{X}
STA
!abs+Y
STA
[dp+X]
STA
[dp]+Y
STY
!abs
STY
dp+X
TCALL
15
STA
{X}+
STX
!abs
CBNE
dp
XYX
NOP
GMS81C1102/GMS81C1202
ii
Jan. 2002 Ver 2.0
B. INSTRUCTION SET
1. ARITHMETIC/ LOGIC OPERATION
NO.
MNEMONIC
OP
CODE
BYTE
NO
CYCLE
NO
OPERATION
FLAG
NVGBHIZC
1
ADC #imm
04
2
2
Add with carry.
2
ADC dp
05
2
3
A
( A ) + ( M ) + C
3
ADC dp + X
06
2
4
4
ADC !abs
07
3
4
NV--H-ZC
5
ADC !abs + Y
15
3
5
6
ADC [ dp + X ]
16
2
6
7
ADC [ dp ] + Y
17
2
6
8
ADC { X }
14
1
3
9
AND #imm
84
2
2
Logical AND
10
AND dp
85
2
3
A
( A )
( M )
11
AND dp + X
86
2
4
12
AND !abs
87
3
4
N-----Z-
13
AND !abs + Y
95
3
5
14
AND [ dp + X ]
96
2
6
15
AND [ dp ] + Y
97
2
6
16
AND { X }
94
1
3
17
ASL A
08
1
2
Arithmetic shift left
18
ASL dp
09
2
4
N-----ZC
19
ASL dp + X
19
2
5
20
ASL !abs
18
3
5
21
CMP #imm
44
2
2
Compare accumulator contents with memory contents
22
CMP dp
45
2
3
( A ) - ( M )
23
CMP dp + X
46
2
4
24
CMP !abs
47
3
4
N-----ZC
25
CMP !abs + Y
55
3
5
26
CMP [ dp + X ]
56
2
6
27
CMP [ dp ] + Y
57
2
6
28
CMP { X }
54
1
3
29
CMPX #imm
5E
2
2
Compare X contents with memory contents
30
CMPX dp
6C
2
3
( X ) - ( M )
N-----ZC
31
CMPX !abs
7C
3
4
32
CMPY #imm
7E
2
2
Compare Y contents with memory contents
33
CMPY dp
8C
2
3
( Y ) - ( M )
N-----ZC
34
CMPY !abs
9C
3
4
35
COM dp
2C
2
4
1'S Complement : ( dp )
~( dp )
N-----Z-
36
DAA
DF
1
3
Decimal adjust for addition
N-----ZC
37
DAS
CF
1
3
Decimal adjust for subtraction
N-----ZC
38
DEC A
A8
1
2
Decrement
N-----Z-
39
DEC dp
A9
2
4
M
( M ) - 1
40
DEC dp + X
B9
2
5
N-----Z-
41
DEC !abs
B8
3
5
42
DEC X
AF
1
2
43
DEC Y
BE
1
2
44
DIV
9B
1
12
Divide : YA / X Q: A, R: Y
NV--H-Z-
0
"0"
C
7
6
5
4
3
2
1
GMS81C1102/GMS81C1202
Jan. 2002 Ver 2.0
iii
NO.
MNEMONIC
OP
CODE
BYTE
NO
CYCLE
NO
OPERATION
FLAG
NVGBHIZC
45
EOR #imm
A4
2
2
Exclusive OR
46
EOR dp
A5
2
3
A
( A )
( M )
47
EOR dp + X
A6
2
4
48
EOR !abs
A7
3
4
N-----Z-
49
EOR !abs + Y
B5
3
5
50
EOR [ dp + X ]
B6
2
6
51
EOR [ dp ] + Y
B7
2
6
52
EOR { X }
B4
1
3
53
INC A
88
1
2
Increment
N-----Z-
54
INC dp
89
2
4
M
( M ) + 1
55
INC dp + X
99
2
5
N-----Z-
56
INC !abs
98
3
5
57
INC X
8F
1
2
58
INC Y
9E
1
2
59
LSR A
48
1
2
Logical shift right
60
LSR dp
49
2
4
N-----ZC
61
LSR dp + X
59
2
5
62
LSR !abs
58
3
5
63
MUL
5B
1
9
Multiply : YA
Y
A
N-----Z-
64
OR #imm
64
2
2
Logical OR
65
OR dp
65
2
3
A
( A )
( M )
66
OR dp + X
66
2
4
67
OR !abs
67
3
4
N-----Z-
68
OR !abs + Y
75
3
5
69
OR [ dp + X ]
76
2
6
70
OR [ dp ] + Y
77
2
6
71
OR { X }
74
1
3
72
ROL A
28
1
2
Rotate left through carry
73
ROL dp
29
2
4
N-----ZC
74
ROL dp + X
39
2
5
75
ROL !abs
38
3
5
76
ROR A
68
1
2
Rotate right through carry
77
ROR dp
69
2
4
N-----ZC
78
ROR dp + X
79
2
5
79
ROR !abs
78
3
5
80
SBC #imm
24
2
2
Subtract with carry
81
SBC dp
25
2
3
A
( A ) - ( M ) - ~( C )
82
SBC dp + X
26
2
4
83
SBC !abs
27
3
4
NV--HZC
84
SBC !abs + Y
35
3
5
85
SBC [ dp + X ]
36
2
6
86
SBC [ dp ] + Y
37
2
6
87
SBC { X }
34
1
3
88
TST dp
4C
2
3
Test memory contents for negative or zero
( dp ) - 00
H
N-----Z-
89
XCN
CE
1
5
Exchange nibbles within the accumulator
A
7
~A
4
A
3
~A
0
N-----Z-
0
"0"
C
7
6
5
4
3
2
1
0
C
7
6
5
4
3
2
1
0
C
7
6
5
4
3
2
1
GMS81C1102/GMS81C1202
iv
Jan. 2002 Ver 2.0
2. REGISTER / MEMORY OPERATION
NO.
MNEMONIC
OP
CODE
BYTE
NO
CYCLE
NO
OPERATION
FLAG
NVGBHIZC
1
LDA #imm
C4
2
2
Load accumulator
2
LDA dp
C5
2
3
A
( M )
3
LDA dp + X
C6
2
4
4
LDA !abs
C7
3
4
5
LDA !abs + Y
D5
3
5
N-----Z-
6
LDA [ dp + X ]
D6
2
6
7
LDA [ dp ] + Y
D7
2
6
8
LDA { X }
D4
1
3
9
LDA { X }+
DB
1
4
X- register auto-increment : A
( M ) , X
X + 1
10
LDM dp,#imm
E4
3
5
Load memory with immediate data : ( M )
imm
--------
11
LDX #imm
1E
2
2
Load X-register
12
LDX dp
CC
2
3
X
( M )
N-----Z-
13
LDX dp + Y
CD
2
4
14
LDX !abs
DC
3
4
15
LDY #imm
3E
2
2
Load Y-register
16
LDY dp
C9
2
3
Y
( M )
N-----Z-
17
LDY dp + X
D9
2
4
18
LDY !abs
D8
3
4
19
STA dp
E5
2
4
Store accumulator contents in memory
20
STA dp + X
E6
2
5
( M )
A
21
STA !abs
E7
3
5
22
STA !abs + Y
F5
3
6
--------
23
STA [ dp + X ]
F6
2
7
24
STA [ dp ] + Y
F7
2
7
25
STA { X }
F4
1
4
26
STA { X }+
FB
1
4
X- register auto-increment : ( M )
A, X
X + 1
27
STX dp
EC
2
4
Store X-register contents in memory
28
STX dp + Y
ED
2
5
( M )
X
--------
29
STX !abs
FC
3
5
30
STY dp
E9
2
4
Store Y-register contents in memory
31
STY dp + X
F9
2
5
( M )
Y
--------
32
STY !abs
F8
3
5
33
TAX
E8
1
2
Transfer accumulator contents to X-register : X
A
N-----Z-
34
TAY
9F
1
2
Transfer accumulator contents to Y-register : Y
A
N-----Z-
35
TSPX
AE
1
2
Transfer stack-pointer contents to X-register : X
sp
N-----Z-
36
TXA
C8
1
2
Transfer X-register contents to accumulator: A
X
N-----Z-
37
TXSP
8E
1
2
Transfer X-register contents to stack-pointer: sp
X
N-----Z-
38
TYA
BF
1
2
Transfer Y-register contents to accumulator: A
Y
N-----Z-
39
XAX
EE
1
4
Exchange X-register contents with accumulator :X
A
--------
40
XAY
DE
1
4
Exchange Y-register contents with accumulator :Y
A
--------
41
XMA dp
BC
2
5
Exchange memory contents with accumulator
42
XMA dp+X
AD
2
6
( M )
A
N-----Z-
43
XMA {X}
BB
1
5
44
XYX
FE
1
4
Exchange X-register contents with Y-register : X
Y
--------
GMS81C1102/GMS81C1202
Jan. 2002 Ver 2.0
v
3. 16-BIT OPERATION
4. BIT MANIPULATION
NO.
MNEMONIC
OP
CODE
BYTE
NO
CYCLE
NO
OPERATION
FLAG
NVGBHIZC
1
ADDW dp
1D
2
5
16-Bits add without carry
YA
( YA ) + ( dp +1 ) ( dp )
NV--H-ZC
2
CMPW dp
5D
2
4
Compare YA contents with memory pair contents :
(YA)
-
(dp+1)(dp)
N-----ZC
3
DECW dp
BD
2
6
Decrement memory pair
( dp+1)( dp)
( dp+1) ( dp) - 1
N-----Z-
4
INCW dp
9D
2
6
Increment memory pair
( dp+1) ( dp)
( dp+1) ( dp ) + 1
N-----Z-
5
LDYA dp
7D
2
5
Load YA
YA
( dp +1 ) ( dp )
N-----Z-
6
STYA dp
DD
2
5
Store YA
( dp +1 ) ( dp )
YA
--------
7
SUBW dp
3D
2
5
16-Bits substact without carry
YA
( YA ) - ( dp +1) ( dp)
NV--H-ZC
NO.
MNEMONIC
OP
CODE
BYTE
NO
CYCLE
NO
OPERATION
FLAG
NVGBHIZC
1
AND1 M.bit
8B
3
4
Bit AND C-flag : C
( C )
( M .bit )
-------C
2
AND1B M.bit
8B
3
4
Bit AND C-flag and NOT : C
( C )
~( M .bit )
-------C
3
BIT dp
0C
2
4
Bit test A with memory :
MM----Z-
4
BIT !abs
1C
3
5
Z
( A )
( M ) , N
( M
7
) , V
( M
6
)
5
CLR1 dp.bit
y1
2
4
Clear bit : ( M.bit )
"0"
--------
6
CLRA1 A.bit
2B
2
2
Clear A bit : ( A.bit )
"0"
--------
7
CLRC
20
1
2
Clear C-flag : C
"0"
-------0
8
CLRG
40
1
2
Clear G-flag : G
"0"
--0-----
9
CLRV
80
1
2
Clear V-flag : V
"0"
-0--0---
10
EOR1 M.bit
AB
3
5
Bit exclusive-OR C-flag : C
( C )
( M .bit )
-------C
11
EOR1B M.bit
AB
3
5
Bit exclusive-OR C-flag and NOT : C
( C )
~(M .bit)
-------C
12
LDC M.bit
CB
3
4
Load C-flag : C
( M .bit )
-------C
13
LDCB M.bit
CB
3
4
Load C-flag with NOT : C
~( M .bit )
-------C
14
NOT1 M.bit
4B
3
5
Bit complement : ( M .bit )
~( M .bit )
--------
15
OR1 M.bit
6B
3
5
Bit OR C-flag : C
( C )
( M .bit )
-------C
16
OR1B M.bit
6B
3
5
Bit OR C-flag and NOT : C
( C )
~( M .bit )
-------C
17
SET1 dp.bit
x1
2
4
Set bit : ( M.bit )
"1"
--------
18
SETA1 A.bit
0B
2
2
Set A bit : ( A.bit )
"1"
--------
19
SETC
A0
1
2
Set C-flag : C
"1"
-------1
20
SETG
C0
1
2
Set G-flag : G
"1"
--1-----
21
STC M.bit
EB
3
6
Store C-flag : ( M .bit )
C
--------
22
TCLR1 !abs
5C
3
6
Test and clear bits with A :
A - ( M ) , ( M )
( M )
~( A )
N-----Z-
23
TSET1 !abs
3C
3
6
Test and set bits with A :
A - ( M ) , ( M )
( M )
( A )
N-----Z-
GMS81C1102/GMS81C1202
vi
Jan. 2002 Ver 2.0
5. BRANCH / JUMP OPERATION
NO.
MNEMONIC
OP
CODE
BYTE
NO
CYCLE
NO
OPERATION
FLAG
NVGBHIZC
1
BBC A.bit,rel
y2
2
4/6
Branch if bit clear :
--------
2
BBC dp.bit,rel
y3
3
5/7
if ( bit ) = 0 , then pc
( pc ) + rel
3
BBS A.bit,rel
x2
2
4/6
Branch if bit set :
--------
4
BBS dp.bit,rel
x3
3
5/7
if ( bit ) = 1 , then pc
( pc ) + rel
5
BCC rel
50
2
2/4
Branch if carry bit clear
if ( C ) = 0 , then pc
( pc ) + rel
--------
6
BCS rel
D0
2
2/4
Branch if carry bit set
if ( C ) = 1 , then pc
( pc ) + rel
--------
7
BEQ rel
F0
2
2/4
Branch if equal
if ( Z ) = 1 , then pc
( pc ) + rel
--------
8
BMI rel
90
2
2/4
Branch if minus
if ( N ) = 1 , then pc
( pc ) + rel
--------
9
BNE rel
70
2
2/4
Branch if not equal
if ( Z ) = 0 , then pc
( pc ) + rel
--------
10
BPL rel
10
2
2/4
Branch if minus
if ( N ) = 0 , then pc
( pc ) + rel
--------
11
BRA rel
2F
2
4
Branch always
pc
( pc ) + rel
--------
12
BVC rel
30
2
2/4
Branch if overflow bit clear
if (V) = 0 , then pc
( pc) + rel
--------
13
BVS rel
B0
2
2/4
Branch if overflow bit set
if (V) = 1 , then pc
( pc ) + rel
--------
14
CALL !abs
3B
3
8
Subroutine call
15
CALL [dp]
5F
2
8
M( sp)
( pc
H
), sp
sp - 1, M(sp)
(pc
L
), sp
sp - 1,
if !abs, pc
abs ; if [dp], pc
L
( dp ), pc
H
( dp+1 ) .
--------
16
CBNE dp,rel
FD
3
5/7
Compare and branch if not equal :
--------
17
CBNE dp+X,rel
8D
3
6/8
if ( A )
( M ) , then pc
( pc ) + rel.
18
DBNE dp,rel
AC
3
5/7
Decrement and branch if not equal :
--------
19
DBNE Y,rel
7B
2
4/6
if ( M )
0 , then pc
( pc ) + rel.
20
JMP !abs
1B
3
3
Unconditional jump
21
JMP [!abs]
1F
3
5
pc
jump address
--------
22
JMP [dp]
3F
2
4
23
PCALL upage
4F
2
6
U-page call
M(sp)
( pc
H
), sp
sp - 1, M(sp)
( pc
L
),
sp
sp - 1, pc
L
( upage ), pc
H
"0FF
H
" .
--------
24
TCALL n
nA
1
8
Table call : (sp)
( pc
H
), sp
sp - 1,
M(sp)
( pc
L
),sp
sp - 1,
pc
L
(Table vector L), pc
H
(Table vector H)
--------
GMS81C1102/GMS81C1202
Jan. 2002 Ver 2.0
vii
6. CONTROL OPERATION & etc.
NO.
MNEMONIC
OP
CODE
BYTE
NO
CYCLE
NO
OPERATION
FLAG
NVGBHIZC
1
BRK
0F
1
8
Software interrupt : B
"1", M(sp)
(pc
H
), sp
sp-1,
M(s)
(pc
L
), sp
sp - 1, M(sp)
(PSW), sp
sp -1,
pc
L
( 0FFDE
H
) , pc
H
( 0FFDF
H
) .
---1-0--
2
DI
60
1
3
Disable interrupts : I
"0"
-----0--
3
EI
E0
1
3
Enable interrupts : I
"1"
-----1--
4
NOP
FF
1
2
No operation
--------
5
POP A
0D
1
4
sp
sp + 1, A
M( sp )
6
POP X
2D
1
4
sp
sp + 1, X
M( sp )
--------
7
POP Y
4D
1
4
sp
sp + 1, Y
M( sp )
8
POP PSW
6D
1
4
sp
sp + 1, PSW
M( sp )
restored
9
PUSH A
0E
1
4
M( sp )
A , sp
sp - 1
10
PUSH X
2E
1
4
M( sp )
X , sp
sp - 1
--------
11
PUSH Y
4E
1
4
M( sp )
Y , sp
sp - 1
12
PUSH PSW
6E
1
4
M( sp )
PSW , sp
sp - 1
13
RET
6F
1
5
Return from subroutine
sp
sp +1, pc
L
M( sp ), sp
sp +1, pc
H
M( sp )
--------
14
RETI
7F
1
6
Return from interrupt
sp
sp +1, PSW
M( sp ), sp
sp + 1,
pc
L
M( sp ), sp
sp + 1, pc
H
M( sp )
restored
15
STOP
EF
1
3
Stop mode ( halt CPU, stop oscillator )
--------