欢迎访问ic37.com |
会员登录 免费注册
发布采购

GMS81C2112Q 参数 Datasheet PDF下载

GMS81C2112Q图片预览
型号: GMS81C2112Q
PDF下载: 下载PDF文件 查看货源
内容描述: 海力士半导体的8位单芯片微控制器产品 [HYNIX SEMICONDUCTOR 8-BIT SINGLE-CHIP MICROCONTROLLERS]
分类和应用: 半导体微控制器
文件页数/大小: 107 页 / 1484 K
品牌: HYNIX [ HYNIX SEMICONDUCTOR ]
 浏览型号GMS81C2112Q的Datasheet PDF文件第1页浏览型号GMS81C2112Q的Datasheet PDF文件第2页浏览型号GMS81C2112Q的Datasheet PDF文件第3页浏览型号GMS81C2112Q的Datasheet PDF文件第5页浏览型号GMS81C2112Q的Datasheet PDF文件第6页浏览型号GMS81C2112Q的Datasheet PDF文件第7页浏览型号GMS81C2112Q的Datasheet PDF文件第8页浏览型号GMS81C2112Q的Datasheet PDF文件第9页  
Table of Contents  
8-bit Capture Mode ......................................... 49  
16-bit Capture Mode ....................................... 52  
PWM Mode ..................................................... 53  
1. OVERVIEW............................................1  
Description .........................................................1  
Features .............................................................1  
Development Tools ............................................2  
Ordering Informationꢀꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢁꢂ  
13. ANALOG DIGITAL CONVERTER .....56  
14. SERIAL PERIPHERAL INTERFACE.59  
Transmission/Receiving Timing ...................... 61  
The method of Serial I/O ................................. 62  
The Method to Test Correct Transmission ...... 62  
2. BLOCK DIAGRAM .................................3  
3. PIN ASSIGNMENT ................................4  
4. PACKAGE DIAGRAM............................6  
5. PIN FUNCTION......................................8  
6. PORT STRUCTURES..........................10  
15. BUZZER FUNCTION.........................63  
16. INTERRUPTS....................................65  
Interrupt Sequence .......................................... 67  
Multi Interrupt .................................................. 69  
External Interrupt ............................................. 70  
7. ELECTRICAL CHARACTERISTICS....13  
Absolute Maximum Ratings .............................13  
Recommended Operating Conditions ..............13  
A/D Converter Characteristics .........................13  
17. Power Saving Mode...........................72  
Operating Mode .............................................. 73  
Stop Mode ....................................................... 74  
Wake-up Timer Mode ...................................... 75  
Internal RC-Oscillated Watchdog Timer Mode 76  
Minimizing Current Consumption .................... 77  
DCElectricalCharacteristicsforStandardPins(5V)  
14  
DCElectricalCharacteristicsforHigh-VoltagePins  
15  
AC Characteristics ...........................................16  
AC Characteristics ...........................................17  
Typical Characteristics .....................................18  
18. OSCILLATOR CIRCUIT.....................79  
19. RESET...............................................80  
External Reset Input ........................................ 80  
Watchdog Timer Reset ................................... 80  
8. MEMORY ORGANIZATION.................20  
Registers ..........................................................20  
Program Memory .............................................23  
Data Memory ...................................................26  
Addressing Mode .............................................30  
20. POWER FAIL PROCESSOR.............81  
21. OTP PROGRAMMING.......................83  
DEVICE CONFIGURATION AREA ................. 83  
9. I/O PORTS...........................................34  
10. BASIC INTERVAL TIMER..................37  
11. WATCHDOG TIMER..........................39  
A. CONTROL REGISTER LIST..................i  
B. INSTRUCTION..................................... iii  
Terminology List ................................................iii  
Instruction Map ..................................................iv  
Instruction Set ....................................................v  
12. TIMER/EVENT COUNTER ................42  
8-bit Timer / Counter Mode ..............................44  
16-bit Timer / Counter Mode ............................48  
8-bit Compare Output (16-bit) ..........................49  
C. MASK ORDER SHEET ........................ xi  
GMS81C2112/GMS81C2120  
GMS81C2112/GMS81C2120  
CMOS Single-Chip 8-Bit Microcontroller  
with A/D Converter & VFD Driver  
1. OVERVIEW  
1.1 Description  
The GMS81C2112 and GMS81C2120 are advanced CMOS 8-bit microcontroller with 12K/20K bytes of ROM. These are a  
powerful microcontroller which provides a highly flexible and cost effective solution to many VFD applications. These pro-  
vide the following standard features: 12K/20K bytes of ROM, 448 bytes of RAM, 8-bit timer/counter, 8-bit A/D converter,  
10-bit High Speed PWM Output, Programmable Buzzer Driving Port, 8-bit Basic Interval Timer, 7-bit Watch dog Timer,  
Serial Peripheral Interface, on-chip oscillator and clock circuitry. They also come with high voltage I/O pins that can directly  
drive a VFD (Vacuum Fluorescent Display). In addition, the GMS81C2112 and GMS81C2120 support power saving modes  
to reduce power consumption.  
Device name  
GMS81C2112  
GMS81C2120  
ROM Size  
12K bytes  
20K bytes  
RAM Size  
OTP  
Package  
-
42SDIP,44MQFP,  
40PDIP  
448 bytes  
GMS87C2120  
1.2 Features  
• 20K/12K bytes ROM(EPROM)  
• 8-Channel 8-bit On-Chip Analog to Digital Con-  
verter  
• 448 Bytes of On-Chip Data RAM  
(Including STACK Area)  
• Oscillator:  
- Crystal  
- Ceramic Resonator  
- External R Oscillator  
• Minimum Instruction Execution time:  
- 1uS at 4MHz (2cycle NOP Instruction)  
• One 8-bit Basic Interval Timer  
• One 7-bit Watch Dog Timer  
• Low Power Dissipation Modes  
- STOP mode  
- Wake-up Timer Mode  
- Standby Mode  
• Two 8-bit Timer/Counters  
• 10-bit High Speed PWM Output  
• One 8-bit Serial Peripheral Interface  
• Two External Interrupt Ports  
• Operating Voltage: 2.7V ~ 5.5V (at 4.5MHz)  
• Operating Frequency: 1MHz ~ 4.5MHz  
• Enhanced EMS Improvement  
Power Fail Processor  
• One Programmable 6-bit Buzzer Driving Port  
• 38 I/O Lines  
(Noise Immunity Circuit)Enhanced EMS  
Improvement  
Power Fail Processor  
- 34 Programmable I/O pins  
(Included 21 high-voltage pins Max. 40V)  
- Three Input Only pins: 1 high-voltage pin  
- One Output Only pin  
(Noise Immunity Circuit)  
• Eight Interrupt Sources  
- Two External Sources (INT0, INT1)  
- Two Timer/Counter Sources (Timer0, Timer1)  
- Four Functional Sources (SPI,ADC,WDT,BIT)  
JUNE. 2001 Ver 1.00  
1
GMS81C2112/GMS81C2120  
1.3 Development Tools  
The GMS81C21xx are supported by a full-featured macro  
assembler, an in-circuit emulator CHOICE-Dr.TM and  
OTP programmers. There are third different type program-  
mers such as emulator add-on board type, single type, gang  
type. For mode detail, Refer to “21. OTP PROGRAM-  
MING” on page 83. Macro assembler operates under the  
MS-Windows 95/98TM  
.
Please contact sales part of HynixSemiconductor.  
In Circuit  
CHOICE-Dr.  
Emulators  
Socket Adapter  
for OTP  
OA87C21XX-42SD (42SDIP)  
OA87C21XX-44QF (44MQFP)  
CHPOD81C21D-42SD (42SDIP)  
CHPOD81C21D-40PD (40PDIP)  
POD  
Assembler  
HYNIX Macro Assembler  
1.4 Ordering Information  
Device name  
GMS81C2112 K  
GMS81C2112 Q  
GMS81C2112  
GMS81C2120 K  
GMS81C2120 Q  
GMS81C2120  
ROM Size  
12K bytes  
12K bytes  
12K bytes  
20K bytes  
20K bytes  
20K bytes  
RAM size  
Package  
42SDIP  
44MQFP  
40PDIP  
42SDIP  
44MQFP  
40PDIP  
448 bytes  
448 bytes  
448 bytes  
448 bytes  
448 bytes  
448 bytes  
Mask version  
OTP version  
GMS87C2120 K  
GMS87C2120 Q  
GMS87C2120  
20K bytes OTP  
20K bytes OTP  
20K bytes OTP  
448 bytes  
448 bytes  
448 bytes  
42SDIP  
44MQFP  
40PDIP  
2
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
2. BLOCK DIAGRAM  
R07  
R06  
R05  
R04  
R03/BUZO  
R02/EC0  
R01/INT1  
R00/INT0  
ADC Power  
Supply  
Vdisp/RA  
R20~R27  
R30~R34  
Driver  
Buzzer  
R0  
R2  
R3  
RA  
PSW  
A
PC  
X
Y
Stack Pointer  
ALU  
Data Memory  
(448 bytes)  
Program  
Memory  
Interrupt Controller  
Data Table  
8-bit Basic  
Interval  
Timer  
System controller  
System  
Clock Controller  
8-bit  
PC  
8-bit serial  
Interface  
10-bit  
PWM  
8-bit  
ADC  
Timer/  
Timing generator  
Watchdog  
Timer  
Counter  
Clock  
Generator  
R5  
R6  
R60 / AN0  
R61 / AN1  
R62 / AN2  
R63 / AN3  
R64 / AN4  
R65 / AN5  
R66 / AN6  
R67 / AN7  
R53 / SCLK  
R54 / SIN  
R55 / SOUT  
R56 / PWM1O/T1O  
R57  
Power  
Supply  
High Voltage Port  
JUNE. 2001 Ver 1.00  
3
GMS81C2112/GMS81C2120  
3. PIN ASSIGNMENT  
42SDIP  
Vdisp  
RA  
R53  
R54  
R55  
R56  
R57  
1
2
3
4
5
6
7
8
9
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
42  
41  
40  
39  
38  
37  
36  
35  
34  
33  
32  
31  
30  
29  
28  
27  
26  
25  
24  
23  
22  
R34  
R33  
R32  
R31  
R30  
R27  
R26  
R25  
R24  
R23  
R22  
R21  
R20  
R07  
R06  
R05  
R04  
R03  
R02  
R01  
R00  
SCLK  
SIN  
SOUT  
PWM1O/T1O  
RESET  
XI  
XO  
VSS  
AVSS  
R60  
R61  
R62  
R63  
R64  
R65  
R66  
R67  
AVDD  
VDD  
AN0  
AN1  
AN2  
AN3  
AN4  
AN5  
AN6  
AN7  
BUZO  
EC0  
INT1  
INT0  
44MQFP  
R27  
R26  
R25  
R24  
R23  
R22  
R21  
R20  
R07  
R06  
R57  
RESET  
XI  
XO  
VSS  
AVSS  
1
2
3
4
5
6
7
8
9
33  
32  
31  
30  
29  
28  
27  
26  
25  
24  
23  
GMS81C2112/20  
AN0  
AN1  
AN2  
AN3  
AN4  
R60  
R61  
R62  
R63  
R64  
10  
11  
R05  
High Voltage Port  
4
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
40PDIP  
Vdisp  
RA  
R53  
R54  
R55  
R56  
R57  
1
2
3
4
5
6
7
8
9
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
40  
39  
38  
37  
36  
35  
34  
33  
32  
31  
30  
29  
28  
27  
26  
25  
24  
23  
22  
21  
R34  
R33  
R32  
R31  
R30  
R27  
R26  
R25  
R24  
R23  
R22  
R21  
R20  
R07  
R06  
R05  
R04  
R03  
R02  
R01  
SCLK  
SIN  
SOUT  
PWM1O/T1O  
RESET  
XI  
XO  
VSS  
R60  
R61  
R62  
R63  
R64  
R65  
R66  
R67  
VDD  
R00  
AN0  
AN1  
AN2  
AN3  
AN4  
AN5  
AN6  
AN7  
BUZO  
EC0  
INT1  
INT0  
High Voltage Port  
JUNE. 2001 Ver 1.00  
5
GMS81C2112/GMS81C2120  
4. PACKAGE DIAGRAM  
42SDIP  
UNIT: INCH  
1.470  
1.450  
0.600 BSC  
0.550  
0.530  
0.070 BSC  
0.045  
0.035  
0.020  
0.016  
0-15°  
44MQFP  
13.45  
12.95  
10.10  
9.90  
UNIT: MM  
0-7°  
SEE DETAIL “A”  
1.03  
0.73  
2.35 max.  
1.60  
BSC  
0.80 BSC  
0.45  
0.30  
DETAIL “A”  
6
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
40PDIP  
UNIT: INCH  
2.075  
2.045  
0.600 BSC  
0.550  
0.530  
0.100BSC  
0.022  
0.015  
0.065  
0.045  
0-15°  
JUNE. 2001 Ver 1.00  
7
GMS81C2112/GMS81C2120  
5. PIN FUNCTION  
VDD: Supply voltage.  
VSS: Circuit ground.  
R20~R27: R2 is an 8-bit high-voltage CMOS bidirectional  
I/O port. R2 pins 1 or 0 written to the Port Direction Reg-  
ister can be used as outputs or inputs.  
AVDD: Supply voltage to the ladder resistor of ADC cir-  
cuit. To enhance the resolution of analog to digital convert-  
er, use independent power source as well as possible, other  
than digital power source.  
R30~R34: R3 is a 5-bit high-voltage CMOS bidirectional  
I/O port. R3 pins 1 or 0 written to the Port Direction Reg-  
ister can be used as outputs or inputs.  
R53~R57: R5 is an 5-bit CMOS bidirectional I/O port. R5  
pins 1 or 0 written to the Port Direction Register can be  
used as outputs or inputs. In addition, R5 serves the func-  
tions of the various following special features.  
AVSS: ADC circuit ground.  
RESET: Reset the MCU.  
XIN: Input to the inverting oscillator amplifier and input to  
the internal clock operating circuit.  
Port pin  
Alternate function  
SCLK (Serial clock)  
XOUT: Output from the inverting oscillator amplifier.  
R53  
R54  
R55  
R56  
RA(Vdisp): RA is one-bit high-voltage input only port pin.  
In addition, RA serves the functions of the Vdisp special  
features. Vdisp is used as a high-voltage input power supply  
pin when selected by the mask option.  
SIN (Serial data input)  
SOUT (Serial data output)  
PWM1O (PWM1 Output)  
T1O (Timer/Counter 1 output)  
R60~R67: R6 is an 8-bit CMOS bidirectional I/O port. R6  
pins 1 or 0 written to the Port Direction Register can be  
used as outputs or inputs. In addition, R6 is shared with the  
ADC input.  
Port pin  
Alternate function  
V
disp (High-voltage input power supply)  
RA  
R00~R07: R0 is an 8-bit high-voltage CMOS bidirectional  
I/O port. R0 pins 1 or 0 written to the Port Direction Reg-  
ister can be used as outputs or inputs. In addition, R0  
serves the functions of the various following special fea-  
tures.  
Port pin  
Alternate function  
AN0 (Analog Input 0)  
R60  
R61  
R62  
R63  
R64  
R66  
R66  
R67  
AN1 (Analog Input 1)  
AN2 (Analog Input 2)  
AN3 (Analog Input 3)  
AN4 (Analog Input 4)  
AN5 (Analog Input 5)  
AN6 (Analog Input 6)  
AN7 (Analog Input 7)  
Port pin  
Alternate function  
R00  
R01  
R02  
R03  
INT0 (External interrupt 0)  
INT1 (External interrupt 1)  
EC0 (Event counter input)  
BUZO (Buzzer driver output)  
8
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
Function  
PIN NAME  
In/Out  
Basic  
Alternate  
VDD  
VSS  
-
-
Supply voltage  
Circuit ground  
RA (Vdisp  
)
I(I)  
1-bit high-voltage Input only port  
Reset signal input  
High-voltage input power supply pin  
RESET  
XIN  
I
I
Oscillation input  
XOUT  
O
Oscillation output  
R00 (INT0)  
R01 (INT1)  
R02 (EC0)  
R03 (BUZO)  
R04~R07  
I/O (I)  
I/O (I)  
I/O (I)  
I/O (O)  
I/O  
External interrupt 0 input  
External interrupt 1 input  
Timer/Counter 0 external input  
Buzzer driving output  
8-bit high-voltage I/O ports  
R20~R27  
I/O  
8-bit high-voltage I/O ports  
5-bit high-voltage I/O ports  
R30~R34  
I/O  
R53 (SCLK)  
R54 (SIN)  
R55 (SOUT)  
I/O (I/O)  
I/O (I)  
I/O (O)  
Serial clock source  
Serial data input  
Serial data output  
5-bit high-voltage I/O ports  
PWM 1 pulse output /Timer/Counter 1 out-  
put  
R56 (PWM1O/T1O)  
I/O (O)  
R57  
I/O  
R60~R67 (AN0~AN7)  
I/O (I)  
8-bit general I/O ports  
Supply voltage input pin for ADC  
Ground level input pin for ADC  
Supply voltage  
Analog voltage input  
AVDD  
AVSS  
VDD  
-
-
-
-
VSS  
Circuit ground  
Table 5-1 GMS81C2120 Port Function Description  
JUNE. 2001 Ver 1.00  
9
GMS81C2112/GMS81C2120  
6. PORT STRUCTURES  
R57  
R53/SCLK  
VDD  
Pull-up  
Selection  
N-MOS  
Open Drain Select  
Tr.  
VDD  
Pull-up  
Mask  
Option  
VDD  
SCLK Output  
Tr.  
M UX  
Data Reg.  
Mask  
Option  
VDD  
Data Reg.  
Pin  
Dir.  
Reg.  
Direction  
Reg.  
Pin  
VSS  
VSS  
M UX  
Rd  
Rd  
R00/INT0, R01/INT1, R02/EC0  
SCLK Input  
Selection  
VDD  
Data Reg.  
R54/SIN  
Mask  
Option  
Pin  
Dir.  
Reg.  
Selection  
VDD  
Pull-up  
Tr.  
N-MOS  
Open Drain Select  
Rd  
Mask  
Option  
Vdisp  
VDD  
Data Reg.  
EX) INT0  
Alternate Function  
Direction  
Reg.  
Pin  
VSS  
Rd  
SIN Input  
10  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
R55/SOUT  
RESET  
Selection  
N-MOS  
Open Drain Select  
VDD  
Pull-up  
VDD  
Tr.  
SOUT output  
OTP :disconnected  
Main :connected  
Mask  
Option  
RESET  
M UX  
VDD  
Data Reg.  
VSS  
Direction  
Reg.  
Pin  
IOSWB  
Rd  
VSS  
XIN, XOUT  
IOSWIN Input  
XOUT  
VDD  
RA/Vdisp  
Stop  
Mainclk Off  
VDD  
XIN  
Data bus  
Mask  
Option  
Rd  
VSS  
Vdisp  
R03/BUZO  
R04~R07, R20~R27, R30~R34  
Selection  
Secondary  
Function  
VDD  
VDD  
M U X  
Data Reg.  
Data Reg.  
Mask  
Option  
Mask  
Option  
Pin  
Dir.  
Reg.  
Pin  
Dir.  
Reg.  
Vdisp  
Vdisp  
M UX  
MUX  
Rd  
Rd  
JUNE. 2001 Ver 1.00  
11  
GMS81C2112/GMS81C2120  
R56/PWM1O/T1O  
Selection  
N-MOS  
Open Drain Select  
VDD  
Pull-up  
SOUT output  
Data Reg.  
Tr.  
M UX  
Mask  
Option  
VDD  
Direction  
Reg.  
Pin  
VSS  
Rd  
R60~R67/AN0~AN7  
VDD  
Pull-up  
Tr.  
Mask  
Option  
VDD  
Data Reg.  
Direction  
Reg.  
Pin  
VSS  
Rd  
A/D  
Converter  
Analog  
Input Mode  
A/D Ch.  
Selection  
12  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
7. ELECTRICAL CHARACTERISTICS  
7.1 Absolute Maximum Ratings  
Supply voltage............................................. -0.3 to +7.0 V  
Storage Temperature ....................................-40 to +85 °C  
Maximum output current sourced by (IOH per I/O Pin)  
................................................................................... 8 mA  
Maximum current (ΣIOL)...................................... 100 mA  
Maximum current (ΣIOH)........................................ 50 mA  
Voltage on Normal voltage pin  
with respect to Ground (VSS)  
..............................................................-0.3 to VDD+0.3 V  
Note: Stresses above those listed under “Absolute Maxi-  
mum Ratings” may cause permanent damage to the de-  
vice. This is a stress rating only and functional operation 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 ex-  
tended periods may affect device reliability.  
Voltage on High voltage pin  
with respect to Ground (VSS)  
............................................................-45V to VDD+0.3 V  
Maximum current out of VSS pin..........................150 mA  
Maximum current into VDD pin ..............................80 mA  
Maximum current sunk by (IOL per I/O Pin) ..........20 mA  
7.2 Recommended Operating Conditions  
Specifications  
Unit  
Parameter  
Symbol  
Condition  
Min.  
2.7  
1
Max.  
5.5  
4.5  
85  
VDD  
fXIN  
fXI = 4.5 MHz  
VDD = VDD  
Supply Voltage  
V
Operating Frequency  
Operating Temperature  
MHz  
°C  
TOPR  
-40  
7.3 A/D Converter Characteristics  
(TA=25°C, VDD=5V, VSS=0V, AVDD=5.12V, AVSS=0V @fXIN =4MHz)  
Specifications  
Parameter  
Symbol  
Condition  
Unit  
Typ.1  
Min.  
AVSS  
Max.  
AVDD  
AVDD  
VAN  
Analog Power Supply Input Voltage Range  
Analog Input Voltage Range  
-
V
V
AVSS-0.3  
AVDD+0.3  
Current Following  
Between AVDD and AVSS  
IAVDD  
-
-
200  
uA  
CAIN  
NNLE  
NDNLE  
NZOE  
NFSE  
NNLE  
TCONV  
Overall Accuracy  
Non-Linearity Error  
Differential Non-Linearity Error  
Zero Offset Error  
Full Scale Error  
-
-
-
-
-
-
-
-
-
-
-
-
-
-
±2  
±2  
±2  
±2  
±2  
±2  
20  
LSB  
LSB  
LSB  
LSB  
LSB  
LSB  
us  
Gain Error  
fXIN=4MHz  
Conversion Time  
1. Data in “Typ” column is at 25°C unless otherwise stated. These parameters are for design guidance only and are not tested.  
JUNE. 2001 Ver 1.00  
13  
GMS81C2112/GMS81C2120  
7.4 DC Electrical Characteristics for Standard Pins(5V)  
(VDD = 5.0V ± 10%, VSS = 0V, TA = -40 ~ 85°C, fXIN = 4 MHz, Vdisp = VDD-40V to VDD),  
Specification  
Typ.1  
Parameter  
Pin  
Symbol Test Condition  
Unit  
Min  
Max  
VIH1  
VIH2  
0.9VDD  
VDD+0.3  
XIN  
External Clock  
External Clock  
RESET,SIN,R55,SCLK,  
INT0&1,EC0  
0.8VDD  
VDD+0.3  
Input High Voltage  
V
VIH3  
VIL1  
0.7VDD  
-0.3  
VDD+0.3  
0.1VDD  
R53~R57,R6  
XIN  
RESET,SIN,,R55,SCLK,  
INT0&1,EC0  
VIL2  
VIL3  
VOH  
0.2VDD  
0.3VDD  
Input Low Voltage  
-0.3  
-0.3  
V
R53~R57,R6  
Output High  
Voltage  
R53~R57,R6,BUZO,  
PWM1O/T1O,SCLK,SOUT  
IOH = -0.5mA  
VDD-0.5  
V
V
VOL1  
VOL2  
IOL = 1.6mA  
IOL = 10mA  
Output Low  
Voltage  
R53~R57,R6,BUZO,  
PWM1O/T1O,SCLK,SOUT  
0.4  
2
Input High  
Leakage Current  
IIH1  
IIL1  
R53~R57,R6  
R53~R57,R6  
R53~R57,R6  
VDD  
1
uA  
uA  
Input Low  
Leakage Current  
-1  
Input Pull-up  
Current(*Option)  
IPU  
50  
100  
2.7  
180  
uA  
Power Fail  
Detect Voltage  
VPFD  
IDD  
ISTBY  
ISTOP  
V
Current dissipation  
in active mode  
VDD  
fXIN=4.5MHz  
fXIN=4.5MHz  
8
3
mA  
mA  
uA  
Current dissipation  
in standby mode  
VDD  
Current dissipation  
in stop mode  
fXIN=Off  
fSXIN=32.7KHz  
VDD  
10  
RESET,SIN,R55,SCLK,  
INT0,INT1,EC0  
V
T+~VT-  
TRCWDT  
fRCOSC  
Hysteresis  
0.4  
8
V
Internal RC WDT  
Frequency  
XOUT  
XOUT  
30  
KHz  
MHz  
RC Oscillation  
Frequency  
R= 120KΩ  
1.5  
2
2.5  
1. Data in “Typ.” column is at 4.5V, 25°C unless otherwise stated. These parameters are for design guidance only and are not tested.  
14  
JUNE. 2001 Ver 1.00  
 
GMS81C2112/GMS81C2120  
7.5 DC Electrical Characteristics for High-Voltage Pins  
(VDD = 5.0V ± 10%, VSS = 0V, TA = -40 ~ 85°C, fXIN = 4 MHz, Vdisp = VDD-40V to VDD  
)
Specification  
Unit  
Parameter  
Pin  
Symbol Test Condition  
Typ.1  
Min  
Max  
VIH  
0.7VDD  
VDD-40  
VDD-3.0  
VDD+0.3  
0.3VDD  
Input High Voltage R0,R2,R30~R34,RA  
Input Low Voltage R0,R2,R30~R34,RA  
V
V
VIL  
IOH = -15mA  
Output High  
R0,R2,R30~R34  
Voltage  
VOH  
I
OH = -10mA  
OH = - 4mA  
VDD-2.0  
DD-1.0  
V
I
V
Vdisp = VDD-40  
V
DD-37  
Output Low  
R0,R2,R30~R34  
Voltage  
VOL  
150KatVDD  
-
V
VDD-37  
40  
VIN=VDD-40V  
to VDD  
Input High  
IIH  
R0,R2,R30~R34,RA  
Leakage Current  
20  
uA  
Vdisp=VDD-35V  
VIN=VDD  
Input Pull-down  
R0,R2,R30~R34  
Current(*Option)  
IPD  
VIH  
200  
600  
1000  
uA  
V
0.7VDD  
VDD+0.3  
Input High Voltage R0,R2,R30~R34,RA  
1. Data in “Typ.” column is at 4.5V, 25°C unless otherwise stated. These parameters are for design guidance only and are not tested.  
JUNE. 2001 Ver 1.00  
15  
GMS81C2112/GMS81C2120  
7.6 AC Characteristics  
(TA=-40~ 85°C, VDD=5V±10%, VSS=0V)  
Specifications  
Parameter  
Symbol  
Pins  
Unit  
Min.  
Typ.  
Max.  
fCP  
Operating Frequency  
XIN  
XIN  
1
80  
-
-
-
-
-
-
8
-
MHz  
nS  
tCPW  
External Clock Pulse Width  
External Clock Transition Time  
Oscillation Stabilizing Time  
External Input Pulse Width  
tRCP, FCP  
t
XIN  
20  
20  
-
nS  
tST  
XIN, XOUT  
INT0, INT1, EC0  
-
mS  
tSYS  
tEPW  
2
External Input Pulse Transi-  
tion Time  
tREP, FEP  
t
INT0, INT1, EC0  
RESET  
-
-
-
20  
-
nS  
tRST  
tSYS  
RESET Input Width  
8
tCPW  
tCPW  
1/fCP  
VDD-0.5V  
XI  
0.5V  
tRCP  
tFCP  
tSYS  
tRST  
RESETB  
0.2VDD  
tEPW  
tEPW  
INT0, INT1  
EC0  
0.8VDD  
0.2VDD  
tREP  
tFEP  
Figure 7-1 Timing Chart  
16  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
7.7 AC Characteristics  
(TA=-40~+85°C, VDD=5V±10%, VSS=0V, fXIN=4MHz)  
Specifications  
Unit  
Parameter  
Symbol  
Pins  
Min.  
Typ.  
Max.  
tSCYC  
tSCKW  
tFSCK  
tRSCK  
tFSIN  
tRSIN  
tSUS  
tSUS  
2tSYS+200  
tSYS+70  
Serial Input Clock Pulse  
SCLK  
SCLK  
-
-
8
8
ns  
ns  
Serial Input Clock Pulse Width  
Serial Input Clock Pulse Transition  
Time  
SCLK  
SIN  
-
-
-
-
30  
ns  
ns  
SIN Input Pulse Transition Time  
30  
-
SIN Input Setup Time (External SCLK)  
SIN Input Setup Time (Internal SCLK)  
SIN Input Hold Time  
SIN  
SIN  
100  
200  
-
-
-
-
ns  
ns  
ns  
ns  
ns  
tHS  
tSYS+70  
4tSYS  
SIN  
tSCYC  
tSCKW  
tFSCK  
tRSCK  
16tSYS  
Serial Output Clock Cycle Time  
Serial Output Clock Pulse Width  
SCLK  
SCLK  
tSYS-30  
Serial Output Clock Pulse Transition  
Time  
SCLK  
SOUT  
30  
ns  
ns  
sOUT  
Serial Output Delay Time  
100  
tSCYC  
tRSCK  
tFSCK  
tSCKW  
tSCKW  
0.8VDD  
SCLK  
0.2VDD  
tSUS  
tHS  
0.8VDD  
0.2VDD  
SIN  
tFSIN  
tRSIN  
tDS  
SOUT  
0.8VDD  
0.2VDD  
Figure 7-2 Serial I/O Timing Chart  
JUNE. 2001 Ver 1.00  
17  
GMS81C2112/GMS81C2120  
7.8 Typical Characteristics  
This graphs and tables provided in this section are for de-  
sign guidance only and are not tested or guaranteed.  
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  
In some graphs or tables the data presented are out-  
side specified operating range (e.g. outside specified  
VDD range). This is for information only and devices  
are guaranteed to operate properly only within the  
specified range.  
R40~R43, R6, R53~R57  
BUZO, PWM1O/T1O  
SCLK, SOUT pins  
I
OHVOH  
I
OHVOH  
I
OHVOH  
IOH  
IOH  
IOH  
VDD=5.0V  
Ta=25°C  
VDD=4.0V  
VDD=3.0V  
Ta=25 C  
°
(mA)  
(mA)  
(mA)  
Ta=25 C  
°
-1.6  
-1.6  
-1.6  
-1.2  
-0.8  
-1.2  
-0.8  
-1.2  
-0.8  
-0.4  
0
-0.4  
0
-0.4  
0
VOH  
(V)  
VOH  
(V)  
VOH  
(V)  
4.6 4.7  
5.0  
3.6 3.7  
4.0  
2.6 2.7  
3.0  
4.8 4.9  
3.8 3.9  
2.8 2.9  
R40~R43, R6, R53~R57  
BUZO, PWM1O/T1O  
SCLK, SOUT pins  
I
OLVOL  
I
OLVOL  
I
OLVOL  
IOL  
IOL  
IOL  
VDD=5.0V  
Ta=25°C  
VDD=4.0V  
VDD=3.0V  
Ta=25 C  
°
(mA)  
(mA)  
(mA)  
Ta=25 C  
°
16  
16  
16  
12  
8
12  
8
12  
8
4
0
4
0
4
0
VOL  
VOL  
(V)  
VOL  
(V)  
(V)  
0.6 0.8  
1.4  
0.6 0.8  
1.4  
0.6 0.8  
1.4  
1.0 1.2  
1.0 1.2  
1.0 1.2  
R0, R2,RA  
R30~R34 pins  
I
OHVOH  
I
OHVOH  
I
OHVOH  
IOH  
IOH  
IOH  
VDD=5.0V  
Ta=25°C  
VDD=4.0V  
VDD=3.0V  
Ta=25 C  
°
(mA)  
(mA)  
(mA)  
Ta=25 C  
°
-16  
-16  
-16  
-12  
-8  
-12  
-8  
-12  
-8  
-4  
0
-4  
0
-4  
0
VOH  
(V)  
VOH  
(V)  
VOH  
(V)  
1.0 2.0  
5.0  
1.0 2.0  
5.0  
1.0 2.0  
5.0  
3.0 4.0  
3.0 4.0  
3.0 4.0  
18  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
RESET, R55, SIN, SCLK  
INT0, INT1, EC0 pins  
V
DDVIH1  
V
DDVIH2  
V
DDVIH3  
R53~R57, R6 pins  
XIN pins  
VIH1  
(V)  
VIH2  
(V)  
VIH3  
(V)  
fXIN=4.5MHz  
Ta=25°C  
fXIN=4.5MHz  
Ta=25°C  
fXIN=4.5MHz  
Ta=25°C  
4
4
4
3
2
3
2
3
2
1
1
0
1
0
0
VDD  
(V)  
VDD  
(V)  
6
VDD  
(V)  
1
1
2
3
6
2
3
4
5
4
5
2
3
6
4
5
RESET, R55, SIN, SCLK  
INT0, INT1, EC0 pins  
V
DDVIL1  
V
DDVIL2  
V
DDVIL3  
R53~R57, R6 pins  
XIN pins  
VIL1  
(V)  
VIL2  
(V)  
VIL3  
(V)  
fXIN=4.5MHz  
Ta=25°C  
fXIN=4.5MHz  
Ta=25°C  
fXIN=4.5MHz  
Ta=25°C  
4
4
4
3
2
3
2
3
2
1
1
0
1
0
0
VDD  
(V)  
VDD  
(V)  
VDD  
1
1
2
3
6
2
3
6
(V)  
6
4
5
4
5
2
3
4
5
I
DDVDD  
I
SBYVDD  
I
STOPVDD  
Stop Mode  
Normal Operation  
Stand-by Mode  
IDD  
IDD  
IDD  
Ta=25°C  
Ta=25°C  
(mA)  
(mA)  
(µA)  
4.0  
4.0  
2.0  
3.0  
2.0  
3.0  
2.0  
1.5  
1.0  
fXIN = 4.5MHz  
85°C  
25°C  
fXIN = 4.5MHz  
-20°C  
2.5MHz  
5
1.0  
0
1.0  
0
0.5  
0
2.5MHz  
5
VDD  
(V)  
VDD  
6 (V)  
VDD  
6 (V)  
2
3
6
2
3
2
3
4
4
4
5
JUNE. 2001 Ver 1.00  
19  
GMS81C2112/GMS81C2120  
8. MEMORY ORGANIZATION  
The GMS81C2112 and GMS81C2120 have separate ad-  
dress spaces for Program memory and Data Memory. Pro-  
gram memory can only be read, not written to. It can be up  
to 12K/20K bytes of Program memory. Data memory can  
be read and written to up to 448 bytes including the stack  
area.  
8.1 Registers  
This device has six registers that are the Program Counter  
(PC), a Accumulator (A), two index registers (X, Y), the  
Stack Pointer (SP), and the Program Status Word (PSW).  
The Program Counter consists of 16-bit register.  
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.  
A
ACCUMULATOR  
The stack can be located at any position within 100H to  
1FFH of the internal data memory. The SP is not initialized  
by hardware, requiring to write the initial value (the loca-  
tion with which the use of the stack starts) by using the ini-  
tialization routine. Normally, the initial value of “FFH” is  
used.  
X REGISTER  
X
Y REGISTER  
Y
STACK POINTER  
SP  
PROGRAM COUNTER  
PCH  
PCL  
PROGRAM STATUS  
WORD  
PSW  
Stack Address ( 100H ~ 1FEH  
)
Bit 15  
8 7  
Bit 0  
01H  
SP  
00H~FFH  
Figure 8-1 Configuration of Registers  
Hardware fixed  
Accumulator: The Accumulator is the 8-bit general pur-  
pose register, used for data operation such as transfer, tem-  
porary saving, and conditional judgement, etc.  
Note: The Stack Pointer must be initialized by software be-  
cause its value is undefined after RESET.  
Example: To initialize the SP  
The Accumulator can be used as a 16-bit register with Y  
Register as shown below.  
LDX  
#0FFH  
TXSP  
; SP FFH  
Y
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 rou-  
tine address (PCH:0FFH, PCL:0FEH).  
Y
A
A
Two 8-bit Registers can be used as a "YA" 16-bit Register  
Program Status Word: The Program Status Word (PSW)  
contains several bits that reflect the current state of the  
CPU. The PSW is described in Figure 8-3. It contains the  
Negative flag, the Overflow flag, the Break flag the Half  
Carry (for BCD operation), the Interrupt enable flag, the  
Zero flag, and the Carry flag.  
Figure 8-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 spec-  
ified address, which becomes the actual address. These  
modes are extremely effective for referencing subroutine  
tables and memory tables. The index registers also have in-  
crement, decrement, comparison and data transfer func-  
tions, and they can be used as simple accumulators.  
[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.  
Stack Pointer: The Stack Pointer is an 8-bit register used  
for occurrence interrupts and calling out subroutines. Stack  
Pointer identifies the location in the stack to be access  
(save or restore).  
[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.  
20  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
MSB  
N
LSB  
C
V
G
B
H
I
Z
RESET VALUE : 00H  
PSW  
NEGATIVE FLAG  
CARRY FLAG RECEIVES  
CARRY OUT  
OVERFLOW FLAG  
ZERO FLAG  
SELECT DIRECT PAGE  
when G=1, page is selected to “page 1”  
INTERRUPT ENABLE FLAG  
HALF CARRY FLAG RECEIVES  
CARRY OUT FROM BIT 1 OF  
BRK FLAG  
ADDITION OPERLANDS  
Figure 8-3 PSW (Program Status Word) Register  
This flag assigns RAM page for direct addressing mode. In  
[Interrupt disable flag I]  
the direct addressing mode, addressing area is from zero  
page 00H to 0FFH when this flag is "0". If it is set to "1",  
addressing area is assigned 100H to 1FFH. It is set by  
SETG instruction and cleared by CLRG.  
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.  
[Overflow flag V]  
[Half carry flag H]  
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(7FH) or -128(80H). 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.  
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.  
[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.  
[Direct page flag G]  
JUNE. 2001 Ver 1.00  
21  
 
GMS81C2112/GMS81C2120  
At execution of  
a CALL/TCALL/PCALL  
At acceptance  
of interrupt  
At execution  
of RET instruction  
At execution  
of RET instruction  
Push  
down  
01FE  
01FD  
01FC  
01FB  
PCH  
PCL  
01FE  
01FD  
01FC  
PCH  
PCL  
PSW  
01FE  
01FD  
01FC  
PCH  
01FE  
01FD  
01FC  
PCH  
Pop  
up  
Push  
down  
Pop  
up  
PCL  
PCL  
PSW  
01FB  
01FB  
01FB  
SP before  
execution  
01FE  
01FC  
01FE  
01FB  
01FC  
01FE  
01FB  
01FE  
SP after  
execution  
At execution  
At execution  
of PUSH instruction  
PUSH A (X,Y,PSW)  
of POP instruction  
POP A (X,Y,PSW)  
Push  
down  
Pop  
up  
01FE  
01FD  
01FE  
01FD  
A
A
0100H  
Stack  
depth  
01FC  
01FB  
01FC  
01FB  
01FEH  
SP before  
01FE  
01FD  
01FD  
01FE  
execution  
SP after  
execution  
Figure 8-4 Stack Operation  
22  
JUNE. 2001 Ver 1.00  
 
GMS81C2112/GMS81C2120  
8.2 Program Memory  
A 16-bit program counter is capable of addressing up to  
64K bytes, but this device has 20K bytes program memory  
space only physically implemented. Accessing a location  
above FFFFH will cause a wrap-around to 0000H.  
Example: Usage of TCALL  
LDA  
#5  
TCALL 0FH  
;
;
;
1BYTE INSTRUCTION  
INSTEAD OF 3 BYTES  
NORM AL CALL  
:
:
Figure 8-5, shows a map of Program Memory. After reset,  
the CPU begins execution from reset vector which is stored  
in address FFFEH and FFFFH as shown in Figure 8-6.  
;
;TABLE CALL ROUTINE  
;
FUNC_A: LDA  
LRG0  
RET  
As shown in Figure 8-5, each area is assigned a fixed loca-  
tion in Program Memory. Program Memory area contains  
the user program.  
;
FUNC_B: LDA  
LRG1  
2
1
RET  
;
;TABLE CALL ADD. AREA  
;
ORG  
DW  
0FFC0H  
FUNC_A  
FUNC_B  
;
TCALL ADDRESS AREA  
DW  
B000H  
D000H  
The interrupt causes the CPU to jump to specific location,  
where it commences the execution of the service routine.  
The External interrupt 0, for example, is assigned to loca-  
tion 0FFFAH. The interrupt service locations spaces 2-byte  
interval: 0FFF8H and 0FFF9H for External Interrupt 1,  
0FFFAH and 0FFFBH for External Interrupt 0, etc.  
FEFFH  
FF00H  
Any area from 0FF00H to 0FFFFH, if it is not going to be  
used, its service location is available as general purpose  
Program Memory.  
FFC0H  
TCALL area  
FFDFH  
FFE0H  
FFFFH  
Interrupt  
Vector Area  
Address  
Vector Area Memory  
0FFE0H  
E2  
-
-
E4  
Serial Communication Interface  
Basic Interval Timer  
Watchdog Timer Interrupt  
Figure 8-5 Program Memory Map  
E6  
E8  
EA  
A/D Co-nverter  
Page Call (PCALL) area contains subroutine program to  
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.  
EC  
-
-
-
EE  
F0  
F2  
F4  
F6  
F8  
FA  
FC  
FE  
-
Timer/Counter 1 Interrupt  
Timer/Counter 0 Interrupt  
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: 0FFC0H for TCALL15, 0FFC2H for  
TCALL14, etc., as shown in Figure 8-7.  
External Interrupt 1  
External Interrupt 0  
-
RESET Vector Area  
NOTE:  
"-" means reserved area.  
Figure 8-6 Interrupt Vector Area  
JUNE. 2001 Ver 1.00  
23  
 
 
GMS81C2112/GMS81C2120  
Address  
Program Memory  
TCALL 15  
TCALL 14  
TCALL 13  
TCALL 12  
TCALL 11  
TCALL 10  
TCALL 9  
PCALL Area Memory  
Address  
0FF00H  
0FFC0H  
C1  
C2  
C3  
C4  
C5  
C6  
C7  
C8  
C9  
CA  
CB  
CC  
CD  
CE  
CF  
TCALL 8  
PCALL Area  
(256 Bytes)  
D0  
D1  
D2  
D3  
D4  
D5  
D6  
D7  
D8  
D9  
DA  
DB  
DC  
DD  
DE  
DF  
TCALL 7  
TCALL 6  
TCALL 5  
TCALL 4  
TCALL 3  
TCALL 2  
TCALL 1  
TCALL 0 / BRK *  
0FFFFH  
NOTE:  
* means that the BRK software interrupt is using  
same address with TCALL0.  
Figure 8-7 PCALL and TCALL Memory Area  
PCALLrel  
TCALLn  
4F35  
PCALL 35H  
4A  
TCALL 4  
4A  
01001010  
4F  
35  
Reverse  
~
~
~
~
~
~
~
~
PC: 11111111 11010110  
FH FH DH 6H  
NEXT  
0D125H  
0FF00H  
0FF35H  
0FF00H  
NEXT  
0FFD6H  
0FFD7H  
25  
D1  
0FFFFH  
0FFFFH  
24  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
Example: The usage software example of Vector address for GMS81C2120.  
ORG  
0FFE0H  
DW  
DW  
DW  
DW  
DW  
DW  
DW  
DW  
DW  
DW  
DW  
DW  
DW  
DW  
DW  
DW  
NOT_USED  
NOT_USED  
SIO  
BIT_TIMER  
WD_TIMER  
ADC  
NOT_USED  
NOT_USED  
NOT_USED  
NOT_USED  
TIMER1  
TIMER0  
INT1  
; Serial Interface  
; Basic Interval Timer  
; Watchdog Timer  
; ADC  
; Timer-1  
; Timer-0  
; Int.1  
; Int.0  
; -  
INT0  
NOT_USED  
RESET  
; Reset  
ORG  
ORG  
0B000H  
0D000H  
; GMS81C2120(20K)ROM Start address  
; GMS81C2112(12K)ROM Start address  
;
;*******************************************  
;
MAIN  
PROGRAM  
*
;*******************************************  
;
RESET: DI  
CLRG  
LDX  
RAM_CLR:LDA  
STA  
;Disable All Interrupts  
#0  
#0  
;RAM Clear(!0000H->!00BFH)  
{X}+  
CMPX #0C0H  
BNE  
RAM_CLR  
;
;
LDX  
#0FFH  
;Stack Pointer Initialize  
TXSP  
LDM  
LDM  
:
:
:
LDM  
LDM  
LDM  
LDM  
LDM  
LDM  
LDM  
LDM  
R0, #0  
R0IO,#82H  
;Normal Port 0  
;Normal Port Direction  
TDR0,#125  
TM0,#0FH  
IRQH,#0  
;8us x 125 = 1mS  
;Start Timer0, 8us at 4MHz  
IRQL,#0  
IENH,#0E0H ;Enable Timer0, INT0, INT1  
IENL,#0  
IEDS,#05H  
;Select falling edge detect on INT pin  
R0FUNC,#03H;Set external interrupt pin(INT0, INT1)  
EI  
:
;Enable master interrupt  
:
:
:
:
NOT_USED:NOP  
RETI  
JUNE. 2001 Ver 1.00  
25  
GMS81C2112/GMS81C2120  
8.3 Data Memory  
Figure 8-8 shows the internal Data Memory space availa-  
ble. Data Memory is divided into two groups, a user RAM  
(including Stack) and control registers.  
digital converters and I/O ports. The control registers are in  
address range of 0C0H to 0FFH.  
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.  
0000H  
More detailed informations of each register are explained  
in each peripheral section.  
User Memory  
PAGE0  
When “G-flag=0”,  
this page is selected  
Note: Write only registers can not be accessed by bit ma-  
nipulation instruction. Do not use read-modify-write instruc-  
tion. Use byte manipulation instruction, for example “LDM”.  
00BFH  
00C0H  
Control  
Registers  
00FFH  
0100H  
Example; To write at CKCTLR  
LDM  
CLCTLR,#09H;Divide ratio(÷16)  
User Memory  
or Stack Area  
PAGE1 When “G-flag=1”  
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.  
01FFH  
Figure 8-8 Data Memory Map  
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.  
User Memory  
The GMS81C21xx have 448 × 8 bits for the user memory  
(RAM).  
The save/restore locations in the stack are determined by  
the stack pointed (SP). The SP is automatically decreased  
after the saving, and increased before the restoring. This  
means the value of the SP indicates the stack location  
number for the next save. Refer to Figure 8-4 on page 22.  
Control Registers  
The control registers are used by the CPU and Peripheral  
function blocks for controlling the desired operation of the  
device. Therefore these registers contain control and status  
bits for the interrupt system, the timer/ counters, analog to  
26  
JUNE. 2001 Ver 1.00  
 
GMS81C2112/GMS81C2120  
RESET  
Value  
Addressing  
mode  
Symbol  
R/W  
Note: Several names are given at same address. Refer to  
below table.  
Address  
0C0H  
0C1H  
0C4H  
0C5H  
0C6H  
0C7H  
0CAH  
0CBH  
0CCH  
0CDH  
R0  
R0IO  
R2  
R2IO  
R3  
R3IO  
R5  
R5IO  
R6  
R6IO  
R/W Undefined byte, bit1  
byte2  
byte, bit  
byte  
byte, bit  
byte  
byte, bit  
byte  
byte, bit  
byte  
W
0000_0000  
R/W Undefined  
0000_0000  
R/W Undefined  
---0_0000  
R/W Undefined  
0000_0---  
R/W Undefined  
0000_0000  
When read  
When write  
W
Addr.  
Timer  
Mode  
Capture  
Mode  
PWM  
Mode  
Timer  
PWM  
Mode  
W
Mode  
TDR0  
TDR1  
-
W
D1H  
D3H  
D4H  
ECH  
T0  
CDR0  
-
-
-
T1PPR  
T1PDR  
W
T1  
CDR1 T1PDR  
BITR  
0D0H  
0D1H  
0D1H  
0D1H  
0D2H  
0D3H  
0D3H  
0D4H  
0D4H  
0D4H  
0D5H  
0DEH  
TM0  
T0  
TDR0  
CDR0  
TM1  
TDR1  
T1PPR  
T1  
CDR1  
T1PDR  
PWM1HR  
BUR  
R/W --00_0000  
byte, bit  
byte  
byte  
byte  
R
W
R
0000_0000  
1111_1111  
0000_0000  
CKCTLR  
Table 8-2 Various Register Name in Same Address  
R/W 0000_0000  
byte, bit  
byte  
W
W
R
1111_1111  
1111_1111  
0000_0000  
0000_0000  
byte  
byte  
R
byte  
R/W 0000_0000  
byte, bit  
byte  
W
W
----_0000  
1111_1111  
byte  
0E0H  
0E1H  
0E2H  
0E3H  
0E4H  
0E5H  
0E6H  
0EAH  
0EBH  
0ECH  
0ECH  
SIOM  
SIOR  
R/W 0000_0001  
R/W Undefined  
R/W 0000_----  
R/W 0000_----  
R/W 0000_----  
R/W 0000_----  
R/W ----_0000  
R/W -000_0001  
byte, bit  
byte, bit  
byte, bit  
byte, bit  
byte, bit  
byte, bit  
byte, bit  
byte, bit  
byte  
IENH  
IENL  
IRQH  
IRQL  
IEDS  
ADCM  
ADCR  
BITR  
R
R
Undefined  
0000_0000  
-001_0111  
0000_0000  
0111_1111  
byte  
CKCTLR  
WDTR  
WDTR  
PFDR  
W
R
W
byte  
0EDH  
0EDH  
0EFH  
byte  
byte  
R/W ----_-100  
byte, bit  
byte  
byte  
byte  
byte  
byte  
0F4H  
0F6H  
0F7H  
0F9H  
0FAH  
0FBH  
R0FUNC  
R5FUNC  
R6FUNC  
R5NODR  
SCMR  
W
W
W
W
----_0000  
-0--_----  
0000_0000  
0000_0---  
R/W ---0_0000  
Undefined  
3
RA  
R
-
Table 8-1 Control Registers  
1. "byte, bit" means that register can be addressed by not only bit  
but byte manipulation instruction.  
2. "byte" means that register can be addressed by only byte  
manipulation instruction. On the other hand, do not use any  
read-modify-write instruction such as bit manipulation for  
clearing bit.  
3. RA is one-bit high-voltage input only port pin. In addition, RA  
serves the functions of the Vdisp special features. Vdisp is  
used as a high-voltage input power supply pin when selected  
by the mask option.  
JUNE. 2001 Ver 1.00  
27  
 
GMS81C2112/GMS81C2120  
Bit 7  
Address  
C0H  
Name  
R0  
Bit 6  
Bit 5  
Bit 4  
Bit 3  
Bit 2  
Bit 1  
Bit 0  
R0 Port Data Register (Bit[7:0])  
R0 Port Direction Register (Bit[7:0])  
R2 Port Data Register (Bit[7:0])  
R2 Port Direction Register (Bit[7:0])  
R3 Port Data Register (Bit[4:0])  
R3 Port Direction Register (Bit[4:0])  
R5 Port Data Register (Bit[7:3])  
R5 Port Direction Register (Bit[7:3])  
R6 Port Data Register (Bit[7:0])  
R6 Port Direction Register (Bit[7:0])  
C1H  
R0IO  
R2  
C4H  
C5H  
R2IO  
R3  
C6H  
C7H  
R3IO  
R5  
CAH  
CBH  
CCH  
CDH  
D0H  
R5IO  
R6  
R6IO  
TM0  
-
-
CAP0  
T0CK2  
T0CK1  
T0CK0  
T0CN  
T1CN  
T0ST  
T1ST  
T0/TDR0/  
CDR0  
D1H  
D2H  
D3H  
Timer0 Register / Timer0 Data Register / Capture0 Data Register  
TM1  
POL  
Timer1 Data Register / PWM1 Period Register  
Timer1 Register / Capture1 Data Register / PWM1 Duty Register  
16BIT  
PWM1E  
CAP1  
T1CK1  
T1CK0  
TDR1/  
T1PPR  
T1/CDR1/  
T1PDR  
D4H  
D5H  
DEH  
E0H  
E1H  
E2H  
E3H  
E4H  
E5H  
E6H  
EAH  
EBH  
ECH  
ECH  
EDH  
EFH  
F4H  
PWM1HR PWM1 High Register(Bit[3:0])  
BUR  
BUCK1  
POL  
BUCK0  
IOSW  
BUR5  
SM1  
BUR4  
SM0  
BUR3  
SCK1  
BUR2  
SCK0  
BUR1  
BUR0  
SIOM  
SIOR  
IENH  
IENL  
SIOST  
SIOSF  
SPI DATA REGISTER  
INT0E  
ADE  
INT1E  
WDTE  
INT1IF  
WDTIF  
T0E  
BITE  
T0IF  
BITIF  
T1E  
SPIE  
T1IF  
SPIIF  
-
-
-
-
IRQH  
IRQL  
IEDS  
ADCM  
ADCR  
INT0IF  
ADIF  
-
-
-
-
IED1H  
ADS1  
IED1L  
ADS0  
IED0H  
ADST  
IED0L  
ADSF  
-
ADEN  
ADS3  
ADS2  
ADC Result Data Register  
Basic Interval Timer Data Register  
WAKEUP RCWDT  
BITR1  
CKCTLR1  
WDTR  
-
WDTON  
BTCL  
BTS2  
BTS1  
BTS0  
WDTCL 7-bit Watchdog Counter Register  
PFDR2  
-
-
-
-
-
-
-
-
-
PFDIS  
EC0  
PFDM  
INT1  
PFDS  
INT0  
R0FUNC  
BUZO  
Table 8-3 Control Registers of GMS81C2120  
These registers of shaded area can not be access by bit manipulation instruction as " SET1, CLR1 ", but should be access by reg-  
ister operation instruction as " LDM dp,#imm ".  
28  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
Bit 7  
Address  
Name  
Bit 6  
Bit 5  
Bit 4  
Bit 3  
Bit 2  
Bit 1  
Bit 0  
PWM1O/  
T1O  
F6H  
R5FUNC  
-
-
-
-
-
-
-
F7H  
F9H  
FAH  
FBH  
R6FUNC  
R5NODR  
SCMR  
RA  
AN7  
AN6  
AN5  
AN4  
NODR4  
CS1  
-
AN3  
NODR3  
CS0  
-
AN2  
AN1  
AN0  
-
NODR7  
NODR6  
NODR5  
-
-
-
-
-
-
-
-
-
-
-
-
MAINOFF  
RA0  
Table 8-3 Control Registers of GMS81C2120  
These registers of shaded area can not be access by bit manipulation instruction as " SET1, CLR1 ", but should be access by reg-  
ister 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.  
JUNE. 2001 Ver 1.00  
29  
GMS81C2112/GMS81C2120  
8.4 Addressing Mode  
The GMS800 series MCU uses six addressing modes;  
• Register addressing  
(3) Direct Page Addressing dp  
In this mode, a address is specified within direct page.  
Example; G=0  
• Immediate addressing  
C535  
LDA  
35H  
;A RAM[35H]  
• Direct page addressing  
• Absolute addressing  
• Indexed addressing  
35H  
data  
• Register-indirect addressing  
~
~
~
data A  
~
0E550H  
0E551H  
C5  
35  
(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.  
(4) Absolute Addressing !abs  
Example:  
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.  
0435  
ADC  
#35H  
MEMORY  
With 3 bytes command, it is possible to access to whole  
memory area.  
04  
35  
A+35H+C A  
ADC, AND, CMP, CMPX, CMPY, EOR, LDA, LDX,  
LDY, OR, SBC, STA, STX, STY  
Example;  
0735F0 ADC  
!0F035H  
;A ROM[0F035H]  
When G-flag is 1, then RAM address is defined by 16-bit  
address which is composed of 8-bit RAM paging register  
(RPR) and 8-bit immediate data.  
0F035H  
data  
Example: G=1  
~
~
~
~
A+data+C A  
E45535 LDM  
35H,#55H  
0F100H  
0F101H  
0F102H  
07  
35  
F0  
address: 0F035  
0135H  
data  
data ¨ 55H  
~
~
~
~
The operation within data memory (RAM)  
ASL, BIT, DEC, INC, LSR, ROL, ROR  
0F100H  
E4  
55  
35  
Example; Addressing accesses the address 0135H regard-  
less of G-flag.  
0F101H  
0F102H  
30  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
983501 INC  
!0135H  
;A ROM[135H]  
35H  
data  
DB  
135H  
data  
data Æ A  
~
~
~
~
36H Æ X  
~
~
~
~
data+1 data  
0F100H  
0F101H  
0F102H  
98  
35  
01  
address: 0135  
X indexed direct page (8 bit offset) dp+X  
(5) Indexed Addressing  
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.  
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=15H, G=1  
ADC, AND, CMP, EOR, LDA, LDY, OR, SBC, STA  
STY, XMA, ASL, DEC, INC, LSR, ROL, ROR  
Example; G=0, X=0F5H  
C645  
LDA  
45H+X  
D4  
LDA  
{X}  
;ACCRAM[X].  
115H  
3AH  
data  
data  
data A  
~
~
~
~
~
~
data A  
~
~
0E550H  
0E551H  
C6  
45  
D4  
0E550H  
45H+0F5H=13AH  
X indexed direct page, auto increment{X}+  
Y indexed direct page (8 bit offset) dp+Y  
In this mode, a address is specified within direct page by  
the X register and the content of X is increased by 1.  
This address value is the second byte (Operand) of com-  
mand plus the data of Y-register, which assigns Memory in  
Direct page.  
LDA, STA  
Example; G=0, X=35H  
This is same with above (2). Use Y register instead of X.  
DB  
LDA  
{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 memo-  
ry in whole area.  
Example; Y=55H  
JUNE. 2001 Ver 1.00  
31  
GMS81C2112/GMS81C2120  
D500FA LDA  
!0FA00H+Y  
1625  
ADC  
[25H+X]  
35H  
05  
0F100H  
D5  
00  
36H  
E0  
0F101H  
0F102H  
0E005H  
~
~
~
FA  
0FA00H+55H=0FA55H  
~
25 + X(10) = 35H  
0E005H  
data  
~
~
~
~
~
~
~
~
0FA55H  
data  
data A  
0FA00H  
16  
25  
A + data + C A  
(6) Indirect Addressing  
Direct page indirect [dp]  
Y indexed indirect [dp]+Y  
Processes memory data as Data, assigned by the data  
[dp+1][dp] of 16-bit pair memory paired by Operand in Di-  
rect pageplus Y-register data.  
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.  
ADC, AND, CMP, EOR, LDA, OR, SBC, STA  
Example; G=0, Y=10H  
JMP, CALL  
Example; G=0  
1725  
ADC  
[25H]+Y  
3F35  
JMP  
[35H]  
35H  
36H  
0A  
E3  
25H  
26H  
05  
E0  
~
~
~
~
~
~
~
~
0E30AH  
0FA00H  
NEXT  
0E005H + Y(10)  
= 0E015H  
0E015H  
0FA00H  
data  
jump to  
address 0E30AH  
~
~
~
~
~
~
~
~
3F  
35  
17  
25  
A + data + C A  
X indexed indirect [dp+X]  
Absolute indirect [!abs]  
Processes memory data as Data, assigned by 16-bit pair  
memory which is determined by pair data  
[dp+X+1][dp+X] Operand plusX-register data in Direct  
page.  
The program jumps to address specified by 16-bit absolute  
address.  
JMP  
ADC, AND, CMP, EOR, LDA, OR, SBC, STA  
Example; G=0, X=10H  
Example; G=0  
32  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
1F25E0 JMP  
[!0C025H]  
PROGRAM MEMORY  
0E025H  
0E026H  
25  
E7  
~
~
~
~
jump to  
address 0E30AH  
0E725H  
0FA00H  
NEXT  
~
~
~
~
1F  
25  
E0  
JUNE. 2001 Ver 1.00  
33  
GMS81C2112/GMS81C2120  
9. I/O PORTS  
The GMS81C21xx has five ports (R0, R2, R3, R5, and  
R6).These ports pins may be multiplexed with an alternate  
function for the peripheral features on the device.  
R0 and R0IO register: R0 is an 8-bit high-voltage CMOS  
bidirectional I/O port (address 0C0H). Each port can be set  
individually as input and output through the R0IO register  
(address 0C1H). Each port can directly drive a vacuum flu-  
orescent display. R03 port is multiplexed with Buzzer Out-  
put Port(BUZO), R02 port is multiplexed with Event  
Counter Input Port (EC0), and R01~R00 are multiplexed  
with External Interrupt Input Port(INT1, INT0)  
All pins have data direction registers which can define  
these ports as output or input. A “1” in the port direction  
register configure the corresponding port pin as output.  
Conversely, write “0” to the corresponding bit to specify it  
as input pin. For example, to use the even numbered bit of  
R0 as output ports and the odd numbered bits as input  
ports, write “55H” to address 0C1H (R0 port direction reg-  
ister) during initial setting as shown in Figure 9-1.  
Alternate Function  
Port Pin  
R00  
R01  
R02  
R03  
INT0 (External interrupt 0 Input Port)  
INT1 (External interrupt 1 Input Port)  
EC0 (Event Counter Input Port)  
BUZO (Buzzer Output Port)  
All the port direction registers in the GMS81C2120 have 0  
written to them by reset function. On the other hand, its in-  
itial status is input.  
.The control register R0FUNC (address F4H) 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 Buzzer Output, External Event Counter Input  
and External Interrupt Input, write "1" to the correspond-  
ing bit of R0FUNC. Regardless of the direction register  
R0IO, R0FUNC is selected to use as alternate functions,  
port pin can be used as a corresponding alternate features  
(BUZO, EC0, INT1, INT0)  
WRITE "55H" TO PORT R0 DIRECTION REGISTER  
0C0H  
BIT  
R0 data  
R0 direction  
R1 data  
0 1 0 1 0 1 0 1  
7
6 5 4 3 2 1 0  
0C1H  
0C2H  
0C3H R1 direction  
I
O
I O I O I O PORT  
7 6 5 4 3 2 1 0  
I : INPUT PORT  
O : OUTPUT PORT  
ADDRESS: 0C0H  
RESET VALUE: Undefined  
R0 Data Register  
R07 R06 R05 R04 R03 R02 R01 R00  
R0  
Figure 9-1 Example of Port I/O Assignment  
Input / Output data  
RA(Vdisp) register: RA is one-bit high-voltage input  
only port pin. In addition, RA serves the functions of the  
Vdisp special features. Vdisp is used as a high-voltage input  
power supply pin when selected by the mask option.  
ADDRESS : 0C1H  
RESET VALUE : 00H  
R0 Direction Register  
R0IO  
ADDRESS: 0FBH  
RESET VALUE: Undefined  
RA Data Register  
Port Direction  
0: Input  
RA0  
RA  
1: Output  
Input data  
ADDRESS : 0F4H  
RESET VALUE : ----0000B  
R0 Function Selection Register  
-
-
-
-
3
2
1
0
R0FUNC  
Port pin  
Alternate function  
0: R02  
1: BUZO  
0: R00  
1: INT0  
V
disp (High-voltage input power supply)  
RA  
0: R03  
1: EC0  
0: R01  
1: INT1  
34  
JUNE. 2001 Ver 1.00  
 
GMS81C2112/GMS81C2120  
R2 and R2IO register: R2 is an 8-bit high-voltage CMOS  
bidirectional I/O port (address 0C4H). Each port can be set  
individually as input and output through the R2IO register  
(address 0C5H). Each port can directly drive a vacuum flu-  
orescent display.  
R5FUNC.  
The control register R5NODR (address 0F9H) controls to  
select N-MOS open drain port. To select N-MOS open  
drain port, write "1" to the corresponding bit of R5FUNC.  
ADDRESS: 0CAH  
RESET VALUE: Undefined  
R5 Data Register  
ADDRESS: 0C4H  
RESET VALUE: Undefined  
R2 Data Register  
R57 R56 R55 R54 R53  
-
-
-
R5  
R27 R26 R25 R24 R23 R22 R21 R20  
R2  
Input / Output data  
Input / Output data  
ADDRESS : 0CBH  
RESET VALUE : 00000---B  
R5 Direction Register  
R5IO  
ADDRESS : 0C5H  
RESET VALUE : 00H  
R2 Direction Register  
R2IO  
Port Direction  
0: Input  
1: Output  
Port Direction  
0: Input  
1: Output  
ADDRESS : 0F6H  
RESET VALUE : -0------B  
R5 Function Selection Register  
R3 and R3IO register: R3 is a 5-bit high-voltage CMOS  
bidirectional I/O port (address 0C6H). Each port can be set  
individually as input and output through the R3IO register  
(address 0C7H).  
-
6
-
-
-
-
-
-
R5FUNC  
0: R56  
1: PWM1O/T1O  
ADDRESS: 0C6H  
RESET VALUE: Undefined  
R5 N-MOS Open Drain  
Selection Register  
ADDRESS: 0F9H  
RESET VALUE: 00000---B  
R3 Data Register  
-
-
-
R34 R33 R32 R31 R30  
R3  
R5NODR  
Input / Output data  
N-MOS Open Drain Selection  
0: Disable  
1: Enable  
ADDRESS : 0C7H  
RESET VALUE : ---00000B  
R3 Direction Register  
-
-
-
R3IO  
R6 and R6IO register: R6 is an 8-bit bidirectional I/O  
port (address 0CCH). Each port can be set individually as  
input and output through the R6IO register (address  
0CDH). R67~R60 ports are multiplexed with Analog Input  
Port.  
Port Direction  
0: Input  
1: Output  
R5 and R5IO register: R5 is an 5-bit bidirectional I/O  
port (address 0CAH). Each pin can be set individually as  
input and output through the R5IO register (address  
0CBH).In addition, Port R5 is multiplexed with Pulse  
Width Modulator (PWM).  
Alternate Function  
AN0 (ADC input 0)  
Port Pin  
R60  
R61  
R62  
R63  
R64  
R65  
R66  
R67  
AN1 (ADC input 1)  
AN2 (ADC input 2)  
AN3 (ADC input 3)  
AN4 (ADC input 4)  
AN5 (ADC input 5)  
AN6 (ADC input 6)  
AN7 (ADC input 7)  
Alternate Function  
PWM1 Data Output  
Port Pin  
R56  
Timer 1 Data Output  
The control register R5FUNC (address 0F6H) controls to  
select PWM function.After reset, the R5IO register value  
is "0", port may be used as general I/O ports. To select  
PWM function, write "1" to the corresponding bit of  
The control register R6FUNC (address 0F7H) controls to  
select alternate function. After reset, this value is "0", port  
may be used as general I/O ports. To select alternate func-  
JUNE. 2001 Ver 1.00  
35  
GMS81C2112/GMS81C2120  
tion such as Analog Input, write "1" to the corresponding  
bit of R6FUNC. Regardless of the direction register R6IO,  
R6FUNC is selected to use as alternate functions, port pin  
can be used as a corresponding alternate features  
(AN7~AN0)  
ADDRESS: 0CCH  
RESET VALUE: Undefined  
R6 Data Register  
R67 R66 R65 R64 R63 R62 R61 R60  
R6  
Input / Output data  
ADDRESS : 0CDH  
RESET VALUE : 00H  
R6 Direction Register  
R6IO  
Port Direction  
0: Input  
1: Output  
ADDRESS : 0F7H  
RESET VALUE : 00H  
R6 Function Selection Register  
7
6
5
4
3
2
1
0
R6FUNC  
0: R67  
1: AN7  
0: R60  
1: AN0  
0: R66  
1: AN6  
0: R61  
1: AN1  
0: R62  
1: AN2  
0: R65  
1: AN5  
0: R64  
1: AN4  
0: R63  
1: AN3  
36  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
10. BASIC INTERVAL TIMER  
The GMS81C21xx has one 8-bit Basic Interval Timer that  
is free-run, can not stop. Block diagram is shown in Figure  
10-1. In addition, the Basic Interval Timer generates the  
time base for watchdog timer counting. It also provides a  
Basic interval timer interrupt (BITIF).  
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.  
The 8-bit Basic interval timer register (BITR) is increased  
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 FFH to 00H, this overflow causes to  
generate the Basic interval timer interrupt. The BITIF is in-  
terrupt request flag of Basic interval timer. The Basic In-  
terval Timer is controlled by the clock control register  
(CKCTLR) shown in Figure 10-2.  
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.  
Source clock can be selected by lower 3 bits of CKCTLR.  
BITR and CKCTLR are located at same address, and ad-  
dress 0ECH is read as a BITR, and written to CKCTLR.  
When write "1" to bit BTCL of CKCTLR, BITR register is  
cleared to "0" and restart to count-up. The bit BTCL be-  
Internal RC OSC  
WAKEUP  
STOP  
÷8  
÷16  
÷32  
8-bit up-counter  
Basic Interval  
source  
clock  
1
÷64  
Timer Interrupt  
overflow  
X
IN PIN  
MUX  
BITIF  
÷128  
÷256  
÷512  
÷1024  
BITR  
0
[0ECH]  
To Watchdog timer (WDTCK)  
clear  
3
Select Input clock  
[0ECH]  
BTS[2:0]  
RCWDT  
BTCL  
CKCTLR  
Basic Interval Timer  
clock control register  
Read  
Internal bus line  
Figure 10-1 Block Diagram of Basic Interval Timer  
JUNE. 2001 Ver 1.00  
37  
 
GMS81C2112/GMS81C2120  
Interrupt (overflow) Period (ms)  
@ fXIN = 4MHz  
CKCTLR  
[2:0]  
Source clock  
XIN÷8  
f
f
f
f
f
f
f
f
000  
001  
010  
011  
100  
101  
110  
111  
0.512  
1.024  
2.048  
4.096  
8.192  
16.384  
32.768  
65.536  
XIN÷16  
XIN÷32  
XIN÷64  
XIN÷128  
XIN÷256  
XIN÷512  
XIN÷1024  
Table 10-1 Basic Interval Timer Interrupt Time  
7
-
6
5
4
3
2
1
0
ADDRESS: 0ECH  
INITIAL VALUE: -001 0111B  
WDTON
WAKEUP RCWDT  
BTCL BTS2 BTS1 BTS0  
CKCTLR  
Basic Interval Timer source clock select  
000: fXIN ÷ 8  
001: fXIN ÷ 16  
010: fXIN ÷ 32  
011: fXIN ÷ 64  
100: fXIN ÷ 128  
101: fXIN ÷ 256  
110: fXIN ÷ 512  
111: fXIN ÷ 1024  
Clear bit  
0: Normal operation (free-run)  
Caution:  
Both register are in same address,  
when write, to be a CKCTLR,  
when read, to be a BITR.  
1: Clear 8-bit counter (BITR) to “0”. This bit becomes 0 automatically  
after one machine cycle, and starts counting.  
0: Operate as a 7-bit general timer  
1: Enable Watchdog Timer operation  
See the section “Watchdog Timer”.  
0: Disable Internal RC Watchdog Timer  
1: Enable Internal RC Watchdog Timer  
0: Disable Wake-up Timer  
1: Enable Wake-up Timer  
7
6
5
4
3
2
1
0
ADDRESS: 0ECH  
INITIAL VALUE: Undefined  
BITR  
8-BIT FREE-RUN BINARY COUNTER  
Figure 10-2 BITR: Basic Interval Timer Mode Register  
Example 1:  
Example 2:  
Basic Interval Timer Interrupt request flag is generated  
every 4.096ms at 4MHz.  
Basic Interval Timer Interrupt request flag is generated  
every 1.024ms at 4MHz.  
:
:
LDM  
CKCTLR,#03H  
LDM  
CKCTLR,#01H  
SET1 BITE  
EI  
:
SET1 BITE  
EI  
:
38  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
11. WATCHDOG TIMER  
The watchdog timer rapidly detects the CPU malfunction  
such as endless looping caused by noise or the like, and re-  
sumes the CPU to the normal state.  
The watchdog timer signal for detecting malfunction can  
be selected either a reset CPU or a interrupt request.  
Note: Because the watchdog timer counter is enabled af-  
ter clearing Basic Interval Timer, after the bit WDTON 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.  
When the watchdog timer is not being used for malfunc-  
tion detection, it can be used as a timer to generate an in-  
terrupt at fixed intervals. The purpose of the watchdog  
timer is to detect the malfunction (runaway) of program  
due to external noise or other causes and return the opera-  
tion to the normal condition.  
The RC oscillated watchdog timer is activated by setting  
the bit RCWDT as shown below.  
LDM  
LDM  
STOP  
NOP  
NOP  
:
CKCTLR,#3FH; enable the RC-osc WDT  
WDTR,#0FFH; set the WDT period  
; enter the STOP mode  
The watchdog timer has two types of clock source.  
; RC-osc WDT running  
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 RCWDT oscillation period is vary with temperature,  
VDD and process variations from part to part (approxi-  
mately, 40~120uS). The following equation shows the  
RCWDT oscillated watchdog timer time-out.  
T
= C LK RC W D T×28×[W D TR.6~0]+ (C LK RC W D T×28)/2  
RCW D T  
The other type is a prescaled system clock.  
where, C LK  
= 40~120uS  
RCW D T  
The watchdog timer consists of 7-bit binary counter and  
the watchdog timer data register. 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 reset the CPU in accordance with the bit  
WDTON.  
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  
clear  
Watchdog  
Counter (7-bit)  
clear  
BASIC INTERVAL TIMER  
OVERFLOW  
Count  
source  
“0”  
to reset CPU  
“1”  
comparator  
enable  
WDTON in CKCTLR [0ECH]  
WDTCL  
7-bit compare data  
WDTIF  
7
Watchdog Timer interrupt  
Watchdog Timer  
Register  
WDTR  
[0EDH]  
Internal bus line  
Figure 11-1 Block Diagram of Watchdog Timer  
JUNE. 2001 Ver 1.00  
39  
 
GMS81C2112/GMS81C2120  
Watchdog Timer Control  
Figure 11-2 shows the watchdog timer control register.  
The watchdog timer is automatically disabled after reset.  
the binary counters unless the binary counter is cleared. At  
this time, when WDTON=1, a reset is generated, which  
drives the RESET pin to low to reset the internal hardware.  
When WDTON=0, a watchdog timer interrupt (WDTIF) is  
generated.  
The CPU malfunction is detected during setting of the de-  
tection time, selecting of output, and clearing of the binary  
counter. Clearing the binary counter is repeated within the  
detection time.  
The watchdog timer temporarily stops counting in the  
STOP mode, and when the STOP mode is released, it au-  
tomatically restarts (continues counting).  
If the malfunction occurs for any cause, the watchdog tim-  
er output will become active at the rising overflow from  
W
7
W
6
W
5
W
4
W
3
W
2
W
1
W
0
ADDRESS: 0EDH  
INITIAL VALUE: 0111_1111B  
WDTCL  
WDTR  
7-bit compare data  
Clear count flag  
0: Free-run count  
1: When the WDTCL is set to "1", binary counter  
is cleared to “0”. And the WDTCL becomes “0” automatically  
after one machine cycle. Counter count up again.  
NOTE:  
The WDTON bit is in register CKCTLR.  
Figure 11-2 WDTR: Watchdog Timer Data Register  
Example: Sets the watchdog timer detection time to 0.5 sec at 4.19MHz  
LDM  
LDM  
CKCTLR,#3FH  
WDTR,#04FH  
;Select 1/2048 clock source, WDTON 1, Clear Counter  
;Clear counter  
LDM  
:
WDTR,#04FH  
WDTR,#04FH  
WDTR,#04FH  
:
Within WDT  
detection time  
:
:
LDM  
:
;Clear counter  
;Clear counter  
:
Within WDT  
detection time  
:
:
LDM  
40  
JUNE. 2001 Ver 1.00  
 
GMS81C2112/GMS81C2120  
Enable and Disable Watchdog  
Watchdog Timer Interrupt  
Watchdog timer is enabled by setting WDTON (bit 4 in  
CKCTLR) to “1”. WDTON is initialized to “0” during re-  
set and it should be set to “1” to operate after reset is re-  
leased.  
The watchdog timer can be also used as a simple 7-bit tim-  
er by clearing bit5 of CKCTLR to “0”. The interval of  
watchdog timer interrupt is decided by Basic Interval Tim-  
er. Interval equation is shown as below.  
Example: Enables watchdog timer for Reset  
T = WDTR × Interval of BIT  
:
LDM  
:
CKCTLR,#xx1x_xxxxB;WDTON 1  
The stack pointer (SP) should be initialized before using  
the watchdog timer output as an interrupt source.  
:
Example: 7-bit timer interrupt set up.  
The watchdog timer is disabled by clearing bit 5 (WD-  
TON) of CKCTLR. The watchdog timer is halted in STOP  
mode and restarts automatically after STOP mode is re-  
leased.  
LDM  
LDM  
CKCTLR,#xx0xxxxxB;WDTON 0  
WDTR,#7FH  
;WDTCL 1  
:
Source clock  
BIT overflow  
3
3
0
2
0
1
2
1
Binary-counter  
Counter  
Clear  
n
3
WDTR  
Match  
Detect  
WDTIF interrupt  
WDTR "0100_0011 "  
B
WDT reset  
reset  
Figure 11-3 Watchdog timer Timing  
If the watchdog timer output becomes active, a reset is gen-  
erated, which drives the RESET pin low to reset the inter-  
nal hardware.  
The main clock oscillator also turns on when a watchdog  
timer reset is generated in sub clock mode.  
JUNE. 2001 Ver 1.00  
41  
GMS81C2112/GMS81C2120  
12. TIMER/EVENT COUNTER  
The GMS81C21xx has two Timer/Counter registers. Each  
module can generate an interrupt to indicate that an event  
has occurred (i.e. timer match).  
sponse to a 1-to-0 (falling edge) or 0-to-1(rising edge) tran-  
sition at its corresponding external input pin, EC0.  
In addition the “capture” function, the register is increased  
in response external or internal clock sources same with  
timer or counter function. When external clock edge input,  
the count register is captured into capture data register  
CDRx.  
Timer 0 and Timer 1 are can be used either two 8-bit Tim-  
er/Counter or one 16-bit Timer/Counter with combine  
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).  
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 12-1 and Table 12-1.  
In the “counter” function, the register is increased in re-  
T0CK T1CK  
16BIT CAP0 CAP1 PWM1E  
PWM1O  
TIMER 0  
TIMER 1  
[2:0]  
XXX  
111  
[1:0]  
XX  
XX  
XX  
XX  
11  
0
0
0
0
1
1
1
1
0
0
1
X
0
0
1
0
0
1
0
0
0
0
X
0
0
0
0
1
0
0
0
0
0
0
1
1
0
0
0
1
8-bit Timer  
8-bit Event counter  
8-bit Capture (internal clock) 8-bit Compare Output  
8-bit Timer  
8-bit Capture  
XXX  
XXX  
XXX  
111  
8-bit Timer/Counter  
16-bit Timer  
10-bit PWM  
11  
16-bit Event counter  
16-bit Capture (internal clock)  
16-bit Compare Output  
XXX  
XXX  
11  
11  
Table 12-1 Operating Modes of Timer0 and Timer1  
42  
JUNE. 2001 Ver 1.00  
 
GMS81C2112/GMS81C2120  
R/W R/W R/W R/W R/W R/W  
5
4
3
2
1
0
ADDRESS: 0D0H  
INITIAL VALUE: --000000B  
TM0  
-
-
CAP0 T0Ck2 T0CK1 T0Ck0 T0CN T0ST  
Bit Name  
Bit Position  
Description  
CAP0  
TM0.5  
0: Timer/Counter mode  
1: Capture mode selection flag  
T0CK2  
T0CK1  
T0CK0  
TM0.4  
TM0.3  
TM0.2  
000: 8-bit Timer, Clock source is fXIN ÷ 2  
001: 8-bit Timer, Clock source is fXIN ÷ 4  
010: 8-bit Timer, Clock source is fXIN ÷ 8  
011: 8-bit Timer, Clock source is fXIN ÷ 32  
100: 8-bit Timer, Clock source is fXIN ÷ 128  
101: 8-bit Timer, Clock source is fXIN ÷ 512  
110: 8-bit Timer, Clock source is fXIN ÷ 2048  
111: EC0 (External clock)  
T0CN  
T0ST  
TM0.1  
TM0.0  
0: Stop the timer  
1: A logic 1 starts the timer.  
0: When cleared, stop the counting.  
1: When set, Timer 0 Count Register is cleared and start again.  
R/W R/W R/W R/W R/W R/W R/W R/W  
7
6
5
4
3
2
1
0
ADDRESS: 0D2H  
INITIAL VALUE: 00H  
TM1  
POL 16BIT PWM1E CAP1 T1CK1 T1CK0 T1CN T1ST  
Bit Name  
Bit Position  
Description  
POL  
TM1.7  
0: PWM Duty Active Low  
1: PWM Duty Active High  
16BIT  
PWMIE  
CAP1  
TM1.6  
TM1.5  
TM1.4  
0: 8-bit Mode  
1: 16-bit Mode  
0: Disable PWM  
1: Enable PWM  
0: Timer/Counter mode  
1: Capture mode selection flag  
T1CK1  
T1CK0  
TM1.3  
TM1.2  
00: 8-bit Timer, Clock source is fXIN  
01: 8-bit Timer, Clock source is fXIN ÷ 2  
10: 8-bit Timer, Clock source is fXIN ÷ 8  
11: 8-bit Timer, Clock source is Using the the Timer 0 Clock  
T0CN  
T0ST  
TM1.1  
TM1.0  
0: Stop the timer  
1: A logic 1 starts the timer.  
0: When cleared, stop the counting.  
1: When set, Timer 0 Count Register is cleared and start again.  
R/W R/W R/W R/W R/W R/W R/W R/W  
7
6
5
4
3
2
1
0
ADDRESS: 0D1H  
TDR0  
TDR1  
INITIAL VALUE: Undefined  
R/W R/W R/W R/W R/W R/W R/W R/W  
7
6
5
4
3
2
1
0
ADDRESS: 0D3H  
INITIAL VALUE: Undefined  
Read: Count value read  
Write: Compare data write  
Figure 12-1 TM0, TM1 Registers  
JUNE. 2001 Ver 1.00  
43  
 
GMS81C2112/GMS81C2120  
12.1 8-bit Timer / Counter Mode  
The GMS81C21xx has two 8-bit Timer/Counters, Timer 0,  
Timer 1 as shown in Figure 12-2.  
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 12-1).  
The "timer" or "counter" function is selected by mode reg-  
isters TMx as shown in Figure 12-1 and Table 12-1. To use  
7
-
6
-
5
4
3
2
1
0
ADDRESS: 0D0H  
INITIAL VALUE: --000000B  
TM0  
TM1  
CAP0 T0CK2 T0CK1T0CK0 T0CN T0ST  
0
X
-
-
X
X
X
X
X means don’t care  
7
6
5
4
3
2
1
0
ADDRESS: 0D2H  
INITIAL VALUE: 00H  
POL 16BIT PWM1E CAP1 T1CK1T1CK0 T1CN T1ST  
0
0
X
0
X
X
X
X
X means don’t care  
T0CK[2:0]  
EDGE  
DETECTOR  
EC0 PIN  
XIN PIN  
111  
000  
T0ST  
0: Stop  
1: Clear and start  
÷2  
÷4  
001  
010  
011  
÷8  
T0 (8-bit)  
÷ꢀꢁꢂ  
÷ꢀꢃꢂꢄ  
÷512  
clear  
100  
101  
TIMER 0  
INTERRUPT  
T0CN  
T0IF  
F/F  
Comparator  
÷2048  
110  
TIMER 0  
TDR0 (8-bit)  
MUX  
T0O PIN  
T1CK[1:0]  
11  
T1ST  
0: Stop  
1: Clear and start  
÷1  
÷2  
÷8  
00  
01  
10  
T1 (8-bit)  
clear  
TIMER 1  
INTERRUPT  
T1CN  
T1IF  
F/F  
MUX  
Comparator  
TIMER 1  
TDR1 (8-bit)  
T1O PIN  
Figure 12-2 8-bit Timer/Counter 0, 1  
44  
JUNE. 2001 Ver 1.00  
 
GMS81C2112/GMS81C2120  
Example 1:  
Note: The contents of Timer data register TDRx should be  
initialized 1H~FFH, not 0H, because it is undefined after re-  
set.  
Timer0 = 2ms 8-bit timer mode at 4MHz  
Timer1 = 0.5ms 8-bit timer mode at 4MHz  
LDM  
LDM  
LDM  
LDM  
SET1 T0E  
SET1 T1E  
EI  
TDR0,#250  
TDR1,#250  
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 T0CK[2:0] of register (TM0) and 1, 2, 8 selected  
by control bits T1CK[1:0] of register (TM1). In the Timer  
0, timer register T0 increases from 00H until it matches  
TDR0 and then reset to 00H. The match output of Timer 0  
generates Timer 0 interrupt (latched in T0IF bit). As TDRx  
and Tx register are in same address, when reading it as a  
Tx, written to TDRx.  
TM0,#0000_1111B  
TM1,#0000_1011B  
Example 2:  
Timer0 = 8-bit event counter mode  
Timer1 = 0.5ms 8-bit timer mode at 4MHz  
LDM  
LDM  
LDM  
LDM  
SET1 T0E  
SET1 T1E  
EI  
TDR0,#250  
TDR1,#250  
TM0,#0001_1111B  
TM1,#0000_1011B  
In counter function, the counter is increased every 0-to-  
1(1-to-0) (rising & falling edge) transition of EC0 pin. In  
order to use counter function, the bit EC0 of the R0 Func-  
tion Selection Register (R0FUNC.2) is set to "1". The Timer  
0 can be used as a counter by pin EC0 input, but Timer 1  
can not.  
JUNE. 2001 Ver 1.00  
45  
GMS81C2112/GMS81C2120  
8-bit Timer Mode  
In the timer mode, the internal clock is used for counting  
up. Thus, you can think of it as counting internal clock in-  
put. The contents of TDRn are compared with the contents  
of up-counter, Tn. If match is found, a timer 1 interrupt  
(T1IF) is generated and the up-counter is cleared to 0.  
Counting up is resumed after the up-counter is cleared.  
As the value of TDRn is changeable by software, time in-  
terval is set as you want  
Start count  
Source clock  
2
3
n-2  
n-1  
n
1
4
2
3
0
1
0
Up-counter  
n
TDR1  
Match  
Detect  
Counter  
Clear  
T1IF interrupt  
Figure 12-3 Timer Mode Timing Chart  
Example: Make 2msinterrupt using by Timer0 at 4MHz  
LDM  
LDM  
TM0,#0FH  
; divide by 32  
TDR0,#125  
; 8us x 125= 1ms  
SET1 T0E  
EI  
; Enable Timer 0 Interrupt  
; Enable Master Interrupt  
When  
TM0 = 0000 1111B (8-bit Timer mode, Prescaler divide ratio = 32)  
TDR0 = 125D = 7DH  
fXIN = 4 MHz  
1
INTERRUPT PERIOD =  
× 32 × 125 = 1 ms  
4 × 106 Hz  
TDR1  
7D  
MATCH  
(TDR0 = T0)  
Count Pulse  
Period  
7D  
7C  
7B  
7A  
8 µs  
6
5
4
3
2
1
0
0
TIME  
Interrupt period  
= 8 µs x 125  
Timer 1 (T1IF)  
Interrupt  
Occur interrupt  
Occur interrupt  
Occur interrupt  
Figure 12-4 Timer Count Example  
46  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
8-bit Event Counter Mode  
In this mode, counting up is started by an external trigger.  
This trigger means falling edge or rising edge of the EC0  
pin input. Source clock is used as an internal clock selected  
with timer mode register TM0. The contents of timer data  
register TDR0 is compared with the contents of the up-  
counter T0. If a match is found, an timer interrupt request  
flag T0IF is generated, and the counter is cleared to “0”.  
The counter is restart and count up continuously by every  
falling edge or rising edge of the EC0 pin input.  
In order to use event counter function, the bit 2 of the R5  
function register (R5FUNC.2) is required to be set to “1”.  
After reset, the value of timer data register TDR0 is unde-  
fined, it should be initialized to between 1H~FFHꢄꢀnot to  
"0"The interval period of Timer is calculated as below  
equation.  
1
----------  
Period (sec) =  
× 2 × Divide Ratio × TDR0  
f
XIN  
The maximum frequency applied to the EC0 pin is fXIN/2  
[Hz].  
Start count  
ECn pin input  
1
1
2
Up-counter  
0
2
n-1  
n
0
TDR1  
n
T1IF interrupt  
Figure 12-5 Event Counter Mode Timing Chart  
TDR1  
enable  
disable  
clear & start  
stop  
TIME  
Timer 1 (T1IF)  
Interrupt  
Occur interrupt  
Occur interrupt  
T1ST  
Start & Stop  
T1ST = 1  
T1ST = 0  
T1CN  
T1CN = 1  
Control count  
T1CN = 0  
Figure 12-6 Count Operation of Timer / Event counter  
JUNE. 2001 Ver 1.00  
47  
GMS81C2112/GMS81C2120  
12.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 0000H until it  
matches TDR0, TDR1 and then resets to 0000H. 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 T0CK[2:0].  
In 16-bit mode, the bits T1CK[1:0] and 16BIT of TM1  
should be set to "1" respectively.  
7
-
6
-
5
4
3
2
1
0
ADDRESS: 0D0H  
INITIAL VALUE: --000000B  
TM0  
TM1  
CAP0 T0CK2 T0CK1T0CK0 T0CN T0ST  
0
X
-
-
X
X
X
X
X means don’t care  
7
6
5
4
3
2
1
0
ADDRESS: 0D2H  
INITIAL VALUE: 00H  
POL 16BIT PWM1E CAP1 T1CK1T1CK0 T1CN T1ST  
0
0
X
1
1
1
X
X
X means don’t care  
T0CK[2:0]  
EDGE  
DETECTOR  
EC0 PIN  
XIN PIN  
111  
000  
T0ST  
÷2  
0: Stop  
1: Clear and start  
÷4  
÷8  
001  
010  
011  
0
T1 + T0  
(16-bit)  
1
clear  
÷ꢀꢁꢂ  
÷ꢀꢃꢂꢄ  
÷512  
100  
101  
TIMER 0  
INTERRUPT  
(Not Timer 1 interrupt)  
T0CN  
T0IF  
F/F  
÷2048  
Comparator  
110  
MUX  
TDR1 + TDR0  
(16-bit)  
T0O PIN  
Lower byte  
Higher byte  
COMPARE DATA  
TIMER 0 + TIMER 1 TIMER 0 (16-bit)  
Figure 12-7 16-bit Timer/Counter  
48  
JUNE. 2001 Ver 1.00  
 
GMS81C2112/GMS81C2120  
12.3 8-bit Compare Output (16-bit)  
The GMS81C21xx has a function of Timer Compare Out-  
put. To pulse out, the timer match can goes to port  
pin(T0O, T1O) as shown in Figure 12-2 and Figure 12-7.  
Thus, pulse out is generated by the timer match. These op-  
eration is implemented to pin, T0O, PWM1O/T1O.  
tion, 16-bit Compare output mode is available, also.  
This pin output the signal having a 50 : 50 duty square  
wave, and output frequency is same as below equation.  
Oscillation Frequency  
2 × Prescaler Value × (TDR + 1)  
---------------------------------------------------------------------------------  
=
f
COMP  
In this mode, the bit PWM1O/T1O of R5 function register  
(R5FUNC.6) should be set to "1", and the bit PWM1E of  
timer1 mode register (TM1) should be set to "0". In addi-  
12.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 12-8.  
tained correct value by counting the number of timer over-  
flow occurrence.  
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.  
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).  
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.  
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.  
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.  
For example, in Figure 12-10, the pulse width of captured  
signal is wider than the timer data value (FFH) over 2  
times. When external interrupt is occurred, the captured  
value (13H) is more little than wanted value. It can be ob-  
JUNE. 2001 Ver 1.00  
49  
GMS81C2112/GMS81C2120  
.
7
-
6
-
5
4
3
2
1
0
ADDRESS: 0D0H  
INITIAL VALUE: --000000B  
TM0  
CAP0 T0CK2 T0CK1T0CK0 T0CN T0ST  
1
X
-
-
X
X
X
X
X means don’t care  
7
6
5
4
3
2
1
0
ADDRESS: 0D2H  
INITIAL VALUE: 00H  
TM1  
POL 16BIT PWM1E CAP1 T1CK1T1CK0 T1CN T1ST  
0
1
X
0
X
X
X
X
X means don’t care  
T0CK[2:0]  
Edge  
Detector  
EC0 PIN  
XIN PIN  
111  
000  
T0ST  
0: Stop  
1: Clear and start  
÷2  
÷4  
001  
010  
011  
÷8  
T0 (8-bit)  
÷ꢀꢁꢂ  
÷ꢀꢃꢂꢄ  
÷512  
clear  
Capture  
CDR0 (8-bit)  
100  
101  
T0CN  
÷2048  
110  
MUX  
IEDS[1:0]  
“01”  
“10”  
INT0  
INTERRUPT  
INT0IF  
INT0 PIN  
T1CK[1:0]  
11  
“11”  
T1ST  
0: Stop  
1: Clear and start  
÷1  
÷2  
÷8  
00  
01  
10  
T1 (8-bit)  
clear  
Capture  
CDR1 (8-bit)  
T1CN  
MUX  
IEDS[1:0]  
“01”  
“10”  
INT1  
INTERRUPT  
INT1IF  
INT1 PIN  
“11”  
Figure 12-8 8-bit Capture Mode  
50  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
This value is loaded to CDR0  
n
T0  
n-1  
9
8
7
6
5
4
3
2
1
0
TIME  
Ext. INT0 Pin  
Interrupt Request  
( INT0F )  
Interrupt Interval Period  
Ext. INT0 Pin  
Interrupt Request  
( INT0F )  
Delay  
Clear & Start  
Capture  
( Timer Stop )  
Figure 12-9 Input Capture Operation  
Ext. INT0 Pin  
Interrupt Request  
( INT0F )  
Interrupt Interval Period = FF + 01 + FF +01 + 13 = 213  
H
H
H
H
H
H
Interrupt Request  
( T0F )  
FF  
FF  
H
H
T0  
13  
H
00  
00  
H
H
Figure 12-10 Excess Timer Overflow in Capture Mode  
JUNE. 2001 Ver 1.00  
51  
GMS81C2112/GMS81C2120  
12.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.  
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.  
The clock source of the Timer 0 is selected either internal  
7
-
6
-
5
4
3
2
1
0
ADDRESS: 0D0H  
INITIAL VALUE: --000000B  
TM0  
TM1  
CAP0 T0CK2 T0CK1T0CK0 T0CN T0ST  
1
X
-
-
X
X
X
X
X means don’t care  
7
6
5
4
3
2
1
0
ADDRESS: 0D2H  
INITIAL VALUE: 00H  
POL 16BIT PWM1E CAP1 T1CK1T1CK0 T1CN T1ST  
0
X
X
1
1
1
X
X
X means don’t care  
T0CK[2:0]  
Edge  
Detector  
EC0 PIN  
XIN PIN  
111  
000  
T0ST  
÷2  
0: Stop  
1: Clear and start  
÷4  
001  
010  
011  
TDR1 + TDR0  
(16-bit)  
÷8  
÷ꢀꢁꢂ  
÷ꢀꢃꢂꢄ  
÷512  
clear  
Capture  
100  
101  
T0CN  
÷2048  
110  
CDR1 + CDR0  
(16-bit)  
MUX  
IEDS[1:0]  
Lower byte  
Higher byte  
CAPTURE DATA  
“01”  
“10”  
INT0  
INTERRUPT  
INT0IF  
INT0 PIN  
“11”  
Figure 12-11 16-bit Capture Mode  
52  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
Example 1:  
Example 3:  
Timer0 = 16-bit capture mode  
Timer0 = 16-bit timer mode, 0.5s at 4MHz  
LDM  
LDM  
LDM  
LDM  
TM0,#0000_1111B;8uS  
LDM  
LDM  
LDM  
LDM  
LDM  
LDM  
R0FUNC,#0000_0001B;INT0 set  
TM1,#0100_1100B;16bit Mode  
TM0,#0010_1111B;Capture Mode  
TM1,#0100_1100B;16bit Mode  
TDR0,#<62500  
TDR1,#>62500  
;8uS X 62500  
;=0.5s  
TDR0,#<0FFH  
TDR1,#>0FFH  
;
;
SET1 T0E  
EI  
:
:
IEDS,#01H;Falling Edge  
SET1 T0E  
EI  
:
:
Example 2:  
Timer0 = 16-bit event counter mode  
LDM  
LDM  
LDM  
LDM  
LDM  
R0FUNC,#0000_0100B;EC0 Set  
TM0,#0001_1111B;Counter Mode  
TM1,#0100_1100B;16bit Mode  
TDR0,#<0FFH  
TDR1,#>0FFH  
;
;
SET1 T0E  
EI  
:
:
12.6 PWM Mode  
The GMS81C2120 has a high speed PWM (Pulse Width  
Modulation) functions which shared with Timer1.  
And writes duty value to the T1PDR and the  
PWM1HR[1:0] same way.  
In PWM mode, pin R56/PWM1O/T1O outputs up to a 10-  
bit resolution PWM output. This pin should be configured  
as a PWM output by setting "1" bit PWM1O in R5FUNC.6  
register.  
The T1PDR is configured as a double buffering for glitch-  
less PWM output. In Figure 12-12, the duty data is trans-  
ferred from the master to the slave when the period data  
matched to the counted value. (i.e. at the beginning of next  
duty cycle)  
The period of the PWM output is determined by the  
T1PPR (PWM1 Period Register) and PWM1HR[3:2]  
(bit3,2 of PWM1 High Register) and the duty of the PWM  
output is determined by the T1PDR (PWM1 Duty Regis-  
ter) and PWM1HR[1:0] (bit1,0 of PWM1 High Register).  
PWM Period = [PWM1HR[3:2]T1PPR] X Source Clock  
PWM Duty = [PWM1HR[1:0]T1PDR] X Source Clock  
The relation of frequency and resolution is in inverse pro-  
portion. Table 12-2 shows the relation of PWM frequency  
vs. resolution.  
The user writes the lower 8-bit period value to the T1PPR  
and the higher 2-bit period value to the PWM1HR[3:2].  
JUNE. 2001 Ver 1.00  
53  
GMS81C2112/GMS81C2120  
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 "00H", the PWM output is deter-  
mined by the bit POL (1: Low, 0: High).  
Frequency  
Resolution  
T1CK[1:0]  
T1CK[1:0]  
T1CK[1:0]  
= 10(2uS)  
= 00(250nS) = 01(500nS)  
It can be changed duty value when the PWM output. How-  
ever 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 12-14. 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.  
10-bit  
9-bit  
8-bit  
7-bit  
3.9KHz  
7.8KHz  
0.98KHZ  
1.95KHz  
3.90KHz  
7.81KHz  
0.49KHZ  
0.97KHz  
1.95KHz  
3.90KHz  
15.6KHz  
31.2KHz  
Table 12-2 PWM Frequency vs. Resolution at 4MHz  
ADDRESS : D2H  
RESET VALUE : 00000000  
T1CK1  
X
T1CK0  
X
T1CN  
X
T1ST  
X
POL  
16BIT  
PWM1E  
CAP1  
TM1  
X
-
0
-
1
-
0
-
ADDRESS : D5H  
RESET VALUE : ----0000  
PWM1HR3PWM1HR2PWM1HR1PWM1HR0  
PWM1HR  
Bit Manipulation Not Available  
-
-
-
-
X
X
X
X
Period High  
PWM1HR[3:2]  
Duty High  
X : The value "0" or "1" corresponding your operation.  
T1ST  
T1PPR(8-bit)  
COMPARATOR  
T0 clock source  
[T0CK]  
0 : Stop  
1 : Clear and Start  
R56/  
PWM1O/T1O  
S
R
Q
CLEAR  
1
MUX  
(2-bit)  
T1 ( 8-bit )  
PWM1O  
[R5FUNC.6]  
÷
÷
÷
1
2
8
POL  
fXI  
COMPARATOR  
T1CN  
Slave  
T1CK[1:0]  
T1PDR(8-bit)  
PWM1HR[1:0]  
Master  
T1PDR(8-bit)  
Figure 12-12 PWM Mode  
54  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
Source  
clock  
00 01  
02  
03  
04  
05  
7F  
81  
00 01  
02  
03  
80  
3FF  
T1  
PWM1E  
T1ST  
T1CN  
PWM1O  
[POL=1]  
PWM1O  
[POL=0]  
Duty Cycle [ 80H x 250nS = 32uS ]  
Period Cycle [ 3FFH x 250nS = 255.75uS, 3.9KHz ]  
T1CK[1:0] = 00 ( fXI )  
PWM1HR = 0CH  
T1PPR (8-bit)  
Period PWM1HR3 PWM1HR2  
1
1
FFH  
T1PPR = FFH  
T1PDR = 80H  
T1PDR (8-bit)  
80H  
PWM1HR1 PWM1HR0  
Duty  
0
0
Figure 12-13 Example of PWM at 4MHz  
T1CK[1:0] = 10 ( 1uS )  
PW M 1HR = 00H  
T1PPR = 0EH  
T1PDR = 05H  
Write T1PPR to 0AH  
Period changed  
Source  
clock  
T1  
01 02 03 04  
05  
06 07 08 09 0A 0B 0C 0D  
0E  
01 02 03 04  
05  
06 07 08 09  
0A  
01 02 03 04  
05  
PWM1O  
POL=1  
Duty Cycle  
[ 05H x 2uS = 10uS ]  
Duty Cycle  
[ 05H x 2uS = 10uS ]  
Duty Cycle  
[ 05H x 2uS = 10uS ]  
Period Cycle [ 0EH x 2uS = 28uS, 35.5KHz ]  
Period Cycle [ 0AH x 2uS = 20uS, 50KHz ]  
Figure 12-14 Example of Changing the Period in Absolute Duty Cycle (@4MHz)  
JUNE. 2001 Ver 1.00  
55  
GMS81C2112/GMS81C2120  
13. ANALOG 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  
supply voltage is connected to AVDD of ladder resistance  
of A/D module.  
And selected the corresponding channel to be converted by  
setting ADS[3:0].  
How to Use A/D Converter  
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  
13-2. 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 20  
uS (at fXI=4 MHz)  
The A/D module has two registers which are the control  
register ADCM and A/D result register ADR. The register  
ADCM, shown in Figure 13-1, controls the operation 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 R6FUNC register.  
R/W R/W R/W R/W R/W  
R
7
-
6
5
-
4
3
2
1
0
ADDRESS: 0EAH  
INITIAL VALUE: -0-0 0001B  
ADCM  
ADS2 ADS1 ADS0  
ADST ADSF  
ADEN  
A/D status bit  
0: A/D conversion is in progress  
1: A/D conversion is completed  
A/D start bit  
Setting this bit starts an A/D conversion.  
After one cycle, bit is cleared to “0” by hardware.  
Analog input channel select  
000: Channel 0 (AN0)  
001: Channel 1 (AN1)  
010: Channel 2 (AN2)  
011: Channel 3 (AN3)  
100: Channel 4 (AN4)  
101: Channel 5 (AN5)  
110: Channel 6 (AN6)  
111: Channel 7 (AN7)  
A/D converter Enable bit  
0: A/D converter module turn off and  
current is not flow.  
1: Enable A/D converter  
R
6
R
R
4
R
R
2
R
1
R
0
R
7
5
3
ADDRESS: 0EBH  
INITIAL VALUE: Undefined  
ADCR  
A/D Conversion Data  
Figure 13-1 A/D Converter Control Register  
56  
JUNE. 2001 Ver 1.00  
 
GMS81C2112/GMS81C2120  
.
“0”  
“1”  
ADS[2:0]  
R6FUNC[7:0]  
AVDD  
ADEN  
000  
R60/AN0  
R61/AN1  
ANSEL0  
001  
LADDER RESISTOR  
8-bit DAC  
ANSEL1  
ANSEL2  
ANSEL3  
ANSEL4  
ANSEL5  
010  
011  
R62/AN2  
R63/AN3  
A/D  
INTERRUPT  
SUCCESSIVE  
APPROXIMATION  
CIRCUIT  
100  
101  
ADIF  
R64/AN4  
R65/AN5  
S/H  
Sample & Hold  
ADDRESS: E9H  
RESET VALUE: Undefined  
ADR (8-bit)  
A/D result register  
110  
111  
R66/AN6  
R67/AN7  
ANSEL6  
ANSEL7  
Figure 13-2 A/D Block Diagram  
JUNE. 2001 Ver 1.00  
57  
GMS81C2112/GMS81C2120  
(2) Noise countermeasures  
In order to maintain 8-bit resolution, attention must be paid to  
noise on pins AVDD and AN7 to AN0. Since the effect increas-  
es in proportion to the output impedance of the analog in-  
put source, it is recommended that a capacitor be connected  
externally as shown in Figure 13-4 in order to reduce noise.  
ENABLE A/D CONVERTER  
A/D INPUT CHANNEL SELECT  
ANALOG REFERENCE SELECT  
A/D START ( ADST = 1 )  
NOP  
Analog  
AN11~AN0  
Input  
100~1000pF  
Figure 13-4 Analog Input Pin Connecting Capacitor  
(3) Pins AN7/R67 to AN0/R60  
The analog input pins AN7 to AN0 also function as input/  
output port (PORT R6) pins. When A/D conversion is per-  
formed with any of pins AN7 to AN0 selected, be sure not  
to execute a PORT input instruction while conversion is in  
progress, as this may reduce the conversion resolution.  
ADSF = 1  
YES  
NO  
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.  
READ ADCR  
Figure 13-3 A/D Converter Operation Flow  
(4) AVDD pin input impedance  
A/D Converter Cautions  
A series resistor string of approximately 10Kis connected be-  
tween the AVDD pin and the AVSS pin.  
(1) Input range of AN7 to AN0  
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 AVDD pin and the AVSS pin,  
and there will be a large reference voltage error.  
The input voltage of AN7 to AN0 should be within the  
specification range. In particular, if a voltage above AVDD  
or below AVSS is input (even if within the absolute maximum  
rating range), the conversion value for that channel can not be in-  
determinate. The conversion values of the other channels may  
also be affected.  
58  
JUNE. 2001 Ver 1.00  
 
GMS81C2112/GMS81C2120  
14. SERIAL PERIPHERAL INTERFACE  
The Serial Peripheral Interface (SPI) module is a serial in-  
terface useful for communicating with other peripheral of  
microcontroller devices. These peripheral devices may be  
serial EEPROMs, shift registers, display drivers, A/D con-  
verters, etc. The Serial Peripheral Interface(SPI) is 8-bit  
clock synchronous type and consists of serial I/O register,  
serial I/O mode register, clock selection circuit octal  
counter and control circuit. The SOUT pin is designed to  
input and output. So Serial Peripheral Interface(SPI) can  
be operated with minimum two pin  
SIOSF  
SIOST  
Start  
SCK[1:0]  
POL  
Complete  
overflow  
÷ 4  
00  
XIN PIN  
SPI  
CONTROL  
CIRCUIT  
÷ 16  
“0”  
“1”  
01  
Clock  
Timer0  
Overflow  
Octal  
Counter  
10  
SIOIF  
Clock  
11  
Serial communication  
Interrupt  
“11”  
MUX  
SCLK PIN  
not “11”  
SCK[1:0]  
IOSW  
SOUT  
SOUT  
PIN  
IOSWIN  
IOSWIN  
1
0
Input shift register  
SIN PIN  
Shift  
SIOR  
Internal Bus  
Figure 14-1 SPI Block Diagram  
JUNE. 2001 Ver 1.00  
59  
GMS81C2112/GMS81C2120  
Serial I/O Mode Register(SIOM) controls serial I/O func-  
tion. According to SCK1 and SCK0, the internal clock or  
external clock can be selected. The serial transmission op-  
eration mode is decided by setting the SM1 and SM0, and  
the polarity of transfer clock is selected by setting the POL.  
To accomplish communication, typically three pins are  
used:  
- Serial Data In  
- Serial Data Out  
- Serial Clock  
R54/SIN  
R55/SOUT  
R53/SCLK  
Serial I/O Data Register(SIOR) is a 8-bit shift register.  
First LSB is send or is received. When receiving mode, se-  
rial input pin is selected by IOSW. The SPI allows 8-bits  
of data to be synchronously transmitted and received.  
.
R/W R/W  
R/W R/W R/W R/W R/W  
R
7
6
5
4
3
2
1
0
ADDRESS: 0E0H  
INITIAL VALUE: 0000 0001B  
SIOM  
SM1 SM0 SCK1 SCK0  
POL IOSW  
SIOST SIOSF  
Serial transmission status bit  
0: Serial transmission is in progress  
1: Serial transmission is completed  
Serial transmission start bit  
Setting this bit starts an Serial transmission.  
After one cycle, bit is cleared to “0” by hardware.  
Serial transmission Clock selection  
00: fXIN ÷ 4  
01: fXIN ÷ 16  
10: TMR0OV(Timer0 Overflow)  
11: External Clock  
Serial transmission Operation Mode  
00: Normal Port(R55,R54,R53)  
01: Sending Mode(SOUT,R54,SCLK)  
10: Receiving Mode(R55,SIN,SCLK)  
11: Sending & Receiving Mode(SOUT,SIN,SCLK)  
Serial Input Pin Selection bit  
0: SIN Pin Selection  
1: IOSWIN Pin Selection  
Serial Clock Polarity Selection bit  
0: Data Transmission at Falling Edge  
Received Data Latch at Rising Edge  
1: Data Transmission at Rising Edge  
Received Data Latch at Falling Edge  
R/W R/W R/W R/W R/W R/W R/W  
R/W  
7
6
5
4
3
2
1
0
ADDRESS: 0E1H  
INITIAL VALUE: Undefined  
SIOR  
Sending Data at Sending Mode  
Receiving Data at Receiving Mode  
Figure 14-2 SPI Control Register  
60  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
14.1 Transmission/Receiving Timing  
The serial transmission is started by setting SIOST(bit1 of  
SIOM) to “1”. After one cycle of SCK, SIOST is cleared  
automatically to “0”. The serial output data from 8-bit shift  
register is output at falling edge of SCLK. And input data  
is latched at rising edge of SCLK pin. When transmission  
clock is counted 8 times, serial I/O counter is cleared as  
‘0”. Transmission clock is halted in “H” state and serial I/  
O interrupt(IFSIO) occurred.  
SIOST  
SCLK [R53]  
(POL=0)  
D0  
D1  
D2  
D3  
D4  
D5  
D6  
D7  
SOUT [R55]  
D0  
D1  
D2  
D3  
D4  
D5  
D6  
D7  
SIN [R54]  
(IOSW=0)  
IOSWIN [R55]  
(IOSW=1)  
D0  
D1  
D2  
D3  
D4  
D5  
D6  
D7  
SIOSF  
(SPI Status)  
SPIIF  
(SPI Int. Req)  
Figure 14-3 SPI Timing Diagram at POL=0  
SIOST  
SCLK [R53]  
(POL=1)  
D0  
D1  
D2  
D3  
D4  
D5  
D6  
D7  
SOUT [R55]  
SIN [R54]  
(IOSW=0)  
D0  
D1  
D2  
D3  
D4  
D5  
D6  
D6  
D7  
D7  
IOSWIN [R55]  
(IOSW=1)  
D0  
D1  
D2  
D3  
D4  
D5  
SIOSF  
(SPI Status)  
SPIIF  
(SPI Int. Req)  
Figure 14-4 SPI Timing Diagram at POL=1  
JUNE. 2001 Ver 1.00  
61  
GMS81C2112/GMS81C2120  
14.2 The method of Serial I/O  
Select transmission/receiving mode  
The SIO interrupt is generated at the completion of SIO  
and SIOSF is set to “1”. In SIO interrupt service routine,  
correct transmission should be tested.  
Note: When external clock is used, the frequency should  
be less than 1MHz and recommended duty is 50%.  
In case of receiving mode, the received data is acquired  
by reading the SIOR.  
In case of sending mode, write data to be send to SIOR.  
Set SIOST to “1” to start serial transmission.  
Note: If both transmission mode is selected and transmis-  
sion is performed simultaneously it would be made error.  
14.3 The Method to Test Correct Transmission  
Serial I/O Interrupt  
Service Routine  
0
SIOSF  
1
Abnormal  
SE = 0  
Write SIOM  
0
SR  
1
Overrun Error  
Normal Operation  
- SE : Interrupt Enable Register Low IENL(Bit3)  
- SR : Interrupt Request Flag Register Low IRQL(Bit3)  
Figure 14-5 Serial Method to Test Transmission  
62  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
15. BUZZER FUNCTION  
The buzzer driver block consists of 6-bit binary counter,  
buzzer register BUR, and clock source selector. It gener-  
ates square-wave which has very wide range frequency  
(480Hz ~ 250kHz at fXIN= 4MHz) by user software.  
The bit 0 to 5 of BUR determines output frequency for  
buzzer driving.  
Equation of frequency calculation is shown below.  
f
XIN  
A 50% duty pulse can be output to R03/BUZO pin to use  
for piezo-electric buzzer drive. Pin R03 is assigned for output  
port of Buzzer driver by setting the bit 3 of R0FUNC(address  
0F4H) to “1”. At this time, the pin R03 must be defined as  
output mode (the bit 3 of R0IO=1).  
---------------------------------------------------------------------------  
f
=
BUZ  
2 × DivideRatio × (BUR + 1)  
fBUZ: Buzzer frequency  
fXIN: Oscillator frequency  
Divide Ratio: Prescaler divide ratio by BUCK[1:0]  
BUR: Lower 6-bit value of BUR. Buzzer period value.  
Example: 5kHz output at 4MHz.  
LDM  
LDM  
R0IO,#XXXX_1XXXB  
BUR,#0011_0010B  
The frequency of output signal is controlled by the buzzer  
control register BUR.The bit 0 to bit 5 of BUR determine  
output frequency for buzzer driving.  
LDM  
R0FUNC,#XXXX_1XXXB  
X means don’t care  
R03 port data  
6-bit binary  
÷8  
00  
6-BIT COUNTER  
÷16  
01  
0
XIN PIN  
÷2  
÷32  
R03/BUZO PIN  
10  
1
F/F  
÷64  
11  
Comparator  
MUX  
2
Compare data  
3
R0FUNC  
[0F4H]  
6
Port selection  
BUR  
[0DEH]  
Internal bus line  
Figure 15-1 Block Diagram of Buzzer Driver  
ADDRESS : 0F4H  
RESET VALUE : ---- 0000B  
ADDRESS: 0DEH  
RESET VALUE: Undefined  
W
W
W
W
W
W
W
W
W
W
W
W
BUCK1  
BUCK0  
BUZO EC0 INT1 INT0  
-
-
R0FUNC  
-
-
BUR  
BUR[5:0]  
Buzzer Period Data  
Source clock select  
R03/BUZO Selection  
00: ÷ 8  
01: ÷ 16  
10: ÷ 32  
11: ÷ 64  
0: R03 port (Turn off buzzer)  
1: BUZO port (Turn on buzzer)  
Figure 15-2 R0FUNC and Buzzer Register  
JUNE. 2001 Ver 1.00  
63  
GMS81C2112/GMS81C2120  
The 6-bit counter is cleared and starts the counting by writ-  
ing signal at BUR register. It is incremental from 00H until  
it matches 6-bit BUR value.  
Note: BUR is undefined after reset, so it must be initialized  
to between 1H and 3FH by software.  
Note that BUR is a write-only register.  
When main-frequency is 4MHz, buzzer frequency is  
shown as below table.  
BUR[7:6]  
BUR  
BUR[7:6]  
BUR  
[5:0]  
[5:0]  
00  
01  
10  
11  
00  
01  
10  
11  
00  
01  
02  
03  
04  
05  
06  
07  
250.000  
125.000  
83.333  
62.500  
50.000  
41.667  
35.714  
31.250  
125.000  
62.500  
41.667  
31.250  
25.000  
20.833  
17.857  
15.625  
62.500  
31.250  
20.833  
15.625  
12.500  
10.417  
8.929  
31.250  
15.625  
10.417  
7.813  
6.250  
5.208  
4.464  
3.906  
20  
21  
22  
23  
24  
25  
26  
27  
7.576  
7.353  
7.143  
6.944  
6.757  
6.579  
6.410  
6.250  
3.788  
3.676  
3.571  
3.472  
3.378  
3.289  
3.205  
3.125  
1.894  
1.838  
1.786  
1.736  
1.689  
1.645  
1.603  
1.563  
0.947  
0.919  
0.893  
0.868  
0.845  
0.822  
0.801  
0.781  
7.813  
08  
09  
0A  
0B  
0C  
0D  
0E  
0F  
27.778  
25.000  
22.727  
20.833  
19.231  
17.857  
16.667  
15.625  
13.889  
12.500  
11.364  
10.417  
9.615  
8.929  
8.333  
7.813  
6.944  
6.250  
5.682  
5.208  
4.808  
4.464  
4.167  
3.906  
3.472  
3.125  
2.841  
2.604  
2.404  
2.232  
2.083  
1.953  
28  
29  
2A  
2B  
2C  
2D  
2E  
2F  
6.098  
5.952  
5.814  
5.682  
5.556  
5.435  
5.319  
5.208  
3.049  
2.976  
2.907  
2.841  
2.778  
2.717  
2.660  
2.604  
1.524  
1.488  
1.453  
1.420  
1.389  
1.359  
1.330  
1.302  
0.762  
0.744  
0.727  
0.710  
0.694  
0.679  
0.665  
0.651  
10  
11  
12  
13  
14  
15  
16  
17  
14.706  
13.889  
13.158  
12.500  
11.905  
11.364  
10.870  
10.417  
7.353  
6.944  
6.579  
6.250  
5.952  
5.682  
5.435  
5.208  
3.676  
3.472  
3.289  
3.125  
2.976  
2.841  
2.717  
2.604  
1.838  
1.736  
1.645  
1.563  
1.488  
1.420  
1.359  
1.302  
30  
31  
32  
33  
34  
35  
36  
37  
5.102  
5.000  
4.902  
4.808  
4.717  
4.630  
4.545  
4.464  
2.551  
2.500  
2.451  
2.404  
2.358  
2.315  
2.273  
2.232  
1.276  
1.250  
1.225  
1.202  
1.179  
1.157  
1.136  
1.116  
0.638  
0.625  
0.613  
0.601  
0.590  
0.579  
0.568  
0.558  
18  
19  
1A  
1B  
1C  
1D  
1E  
1F  
10.000  
9.615  
9.259  
8.929  
8.621  
8.333  
8.065  
7.813  
5.000  
4.808  
4.630  
4.464  
4.310  
4.167  
4.032  
3.906  
2.500  
2.404  
2.315  
2.232  
2.155  
2.083  
2.016  
1.953  
1.250  
1.202  
1.157  
1.116  
1.078  
1.042  
1.008  
0.977  
38  
39  
3A  
3B  
3C  
3D  
3E  
3F  
4.386  
4.310  
4.237  
4.167  
4.098  
4.032  
3.968  
3.907  
2.193  
2.155  
2.119  
2.083  
2.049  
2.016  
1.984  
1.953  
1.096  
1.078  
1.059  
1.042  
1.025  
1.008  
0.992  
0.977  
0.548  
0.539  
0.530  
0.521  
0.512  
0.504  
0.496  
0.488  
64  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
16. INTERRUPTS  
The GMS81C21xx interrupt circuits consist of Interrupt  
enable register (IENH, IENL), Interrupt request flags of  
IRQH, IRQL, Priority circuit, and Master enable flag (“I”  
flag of PSW). Nine interrupt sources are provided. The  
configuration of interrupt circuit is shown in Figure 16-2.  
register (IENH, IENL), and the interrupt request flags (in  
IRQH and IRQL) except Power-on reset and software  
BRK interrupt. Below table shows the Interrupt priority.  
Reset/Interrupt  
Symbol  
Priority  
The External Interrupts INT0 and INT1 each can be transi-  
tion-activated (1-to-0 or 0-to-1 transition) by selection  
IEDS.  
The flags that actually generate these interrupts are bit  
INT0F and INT1F in register IRQH. When an external in-  
terrupt 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.  
Hardware Reset  
External Interrupt 0  
External Interrupt 1  
Timer/Counter 0  
Timer/Counter 1  
-
RESET  
INT0  
INT1  
TIMER0  
-
1
2
3
4
-
-
-
-
TIMER1  
-
-
-
-
-
-
-
ADC Interrupt  
Watchdog Timer  
Basic Interval Timer  
Serial Communication  
ADC  
WDT  
BIT  
SCI  
5
6
7
8
The Timer 0 ~ Timer 1 Interrupts are generated by TxIF  
which is set by a match in their respective timer/counter  
register. The Basic Interval Timer Interrupt is generated by  
BITIF which is set by an overflow in the timer register.  
The AD converter Interrupt is generated by ADIF which is  
set by finishing the analog to digital conversion.  
The Watchdog timer Interrupt is generated by WDTIF  
which set by a match in Watchdog timer register.  
The Basic Interval Timer Interrupt is generated by BITIF  
which are set by a overflow in the timer counter register.  
Vector addresses are shown in Figure 8-6 on page 23. In-  
terrupt enable registers are shown in Figure 16-3. These  
registers are composed of interrupt enable flags of each in-  
terrupt source and these flags determines whether an inter-  
rupt will be accepted or not. When enable flag is “0”, a  
corresponding interrupt source is prohibited. Note that  
PSW contains also a master enable bit, I-flag, which dis-  
ables all interrupts at once.  
The interrupts are controlled by the interrupt master enable  
flag I-flag (bit 2 of PSW on page 21), the interrupt enable  
-
-
-
-
-
-
R/W R/W  
R/W R/W  
T0IF T1IF  
-
ADDRESS: 0E4H  
INITIAL VALUE: 0000 ----B  
-
INT0IF INT1IF  
IRQH  
LSB  
MSB  
Timer/Counter 1 interrupt request flag  
Timer/Counter 0 interrupt request flag  
External interrupt 1 request flag  
External interrupt 0 request flag  
-
-
-
R/W R/W R/W R/W  
ADIF WDTIF BITIF SPIF  
-
ADDRESS: 0E5H  
INITIAL VALUE: 0000 ----B  
-
-
-
-
IRQL  
MSB  
LSB  
Serial Communication interrupt request flag  
Basic Interval imer interrupt request flag  
Watchdog timer interrupt request flag  
A/D Conver interrupt request flag  
Figure 16-1 Interrupt Request Flag  
JUNE. 2001 Ver 1.00  
65  
GMS81C2112/GMS81C2120  
.
Internal bus line  
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 Enable  
Register (Higher byte)  
[0E2H]  
IENH  
IRQH  
[0E4H]  
interrupt are inhibited. When interrupt service is  
completed by "RETI" instruction, I-flag is set to  
"1" by hardware.  
INT0IF  
INT0  
INT1IF  
T0IF  
INT1  
Timer 0  
Timer 1  
Release STOP  
T1IF  
To CPU  
I-flag  
Interrupt Master  
Enable Flag  
IRQL  
[0E5H]  
A/D Converter  
Watchdog Timer  
BIT  
ADIF  
WDTIF  
BITIF  
Interrupt  
Vector  
Address  
Generator  
Serial  
SIOIF  
Communication  
Interrupt Enable  
Register (Lower byte)  
[0E3H]  
IENL  
Internal bus line  
Figure 16-2 Block Diagram of Interrupt  
-
-
-
-
-
-
R/W R/W  
R/W R/W  
T0E  
-
-
ADDRESS: 0E2H  
INITIAL VALUE: 0000 ----B  
INT0E INT1E  
T1E  
IENH  
MSB  
LSB  
Timer/Counter 1 interrupt enable flag  
Timer/Counter 0 interrupt enable flag  
External interrupt 1 enable flag  
External interrupt 0 enable flag  
VALUE  
0: Disable  
1: Enable  
-
-
-
-
-
-
R/W R/W R/W R/W  
ADE WDTE BITE SPIE  
MSB  
-
-
ADDRESS: 0E3H  
INITIAL VALUE: 0000 ----B  
IENL  
LSB  
Serial Communication interrupt enable flag  
Basic Interval imer interrupt enable flag  
Watchdog timer interrupt enable flag  
A/D Convert interrupt enable flag  
Figure 16-3 Interrupt Enable Flag  
66  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
16.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 fXIN (2  
µs at fMAIN=4.19MHz) after the completion of the current  
instruction execution. The interrupt service task is termi-  
nated upon execution of an interrupt return instruction  
[RETI].  
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.  
Interrupt acceptance  
1. The interrupt master enable flag (I-flag) is cleared to  
“0” to temporarily disable the acceptance of any follow-  
ing maskable interrupts. When a non-maskable inter-  
rupt is accepted, the acceptance of any following  
interrupts is temporarily disabled.  
5. The instruction stored at the entry address of the inter-  
rupt service program is executed.  
System clock  
Instruction Fetch  
SP-2  
PSW  
V.L.  
V.H.  
New PC  
OP code  
SP  
SP-1  
PC  
Address Bus  
Data Bus  
Not used  
PCH  
PCL  
V.L.  
ADL  
ADH  
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.  
Figure 16-4 Timing chart of Interrupt Acceptance and Interrupt Return Instruction  
When nested interrupt service is required, the I-flag should  
Basic Interval Timer  
Vector Table Address  
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.  
Entry Address  
012H  
0E3H  
0FFE6H  
0FFE7H  
0EH  
2EH  
0E312H  
0E313H  
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  
Correspondence between vector table address for BIT interrupt  
and the entry address of the interrupt service program.  
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.  
JUNE. 2001 Ver 1.00  
67  
GMS81C2112/GMS81C2120  
area for saving registers.  
16.2 BRK Interrupt  
The following method is used to save/restore the general-  
purpose registers.  
Software interrupt can be invoked by BRK instruction,  
which has the lowest priority order.  
Example: Register save using push and pop instructions  
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.  
INTxx: PUSH  
PUSH  
A
X
Y
;SAVE ACC.  
;SAVE X REG.  
;SAVE Y REG.  
PUSH  
Each processing step is determined by B-flag as shown in  
Figure 16-5.  
interrupt processing  
POP  
POP  
POP  
RETI  
Y
X
A
;RESTORE Y REG.  
;RESTORE X REG.  
;RESTORE ACC.  
;RETURN  
=0  
B-FLAG  
General-purpose register save/restore using push and pop  
instructions;  
=1  
BRK or  
TCALL0  
BRK  
TCALL0  
ROUTINE  
INTERRUPT  
ROUTINE  
main task  
RETI  
RET  
acceptance of  
interrupt  
interrupt  
service task  
saving  
registers  
restoring  
registers  
Figure 16-5 Execution of BRK/TCALL0  
interrupt return  
68  
JUNE. 2001 Ver 1.00  
 
GMS81C2112/GMS81C2120  
16.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: During Timer1 interrupt is in progress, INT0 in-  
terrupt serviced without any suspend.  
Main Program  
service  
TIMER 1  
service  
TIMER1: PUSH  
A
PUSH  
PUSH  
LDM  
LDM  
EI  
X
INT0  
service  
Y
IENH,#80H  
IENL,#0  
;Enable INT0 only  
;Disable other  
;Enable Interrupt  
enable INT0  
disable other  
EI  
:
:
:
Occur  
Occur  
INT0  
TIMER1 interrupt  
:
:
:
enable INT0  
enable other  
LDM  
LDM  
POP  
POP  
POP  
RETI  
IENH,#0F0H ;Enable all interrupts  
IENL,#0F0H  
Y
X
A
In this example, the INT0 interrupt can be serviced without any  
pending, even TIMER1 is in progress.  
Because of re-setting the interrupt enable registers IENH,IENL  
and master enable "EI" in the TIMER1 routine.  
Figure 16-6 Execution of Multi Interrupt  
JUNE. 2001 Ver 1.00  
69  
GMS81C2112/GMS81C2120  
16.4 External Interrupt  
The external interrupt on INT0 and INT1 pins are edge  
triggered depending on the edge selection register IEDS  
(address 0F8H) as shown in Figure 16-7.  
Example: To use as an INT0 and INT1  
:
:
The edge detection of external interrupt has three transition  
activated mode: rising edge, falling edge, and both edge.  
;**** Set port as an input port R00,R01  
LDM  
;
R0IO,#1111_1100B  
;**** Set port as an interrupt port  
LDM  
;
R0FUNC,#0000_0011B  
;**** Set Falling-edge Detection  
LDM  
:
:
:
IEDS,#0000_0101B  
INT1 pin  
INT0 pin  
INT1IF  
INT1 INTERRUPT  
INT0IF  
Response Time  
INT0 INTERRUPT  
2
2
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.  
Edge selection  
Register  
IEDS  
[0E6H]  
Figure 16-7 External Interrupt Block Diagram  
INT0 and INT1 are multiplexed with general I/O ports  
(R00 and R01). To use as an external interrupt pin, the bit  
of R4 port mode register R0FUNC should be set to “1” cor-  
respondingly.  
Figure 16-8shows interrupt response timings.  
max. 12 fXIN  
8 fXIN  
Interrupt  
goes  
active  
Interrupt  
latched  
Interrupt  
processing  
Interrupt  
routine  
Figure 16-8 Interrupt Response Timing Diagram  
70  
JUNE. 2001 Ver 1.00  
 
 
GMS81C2112/GMS81C2120  
W
-
W
-
W
-
W
-
W
W
W
W
ADDRESS: 0F4H  
INITIAL VALUE: ---- 0000B  
INT1 INT0  
LSB  
0: R00  
R0FUNC  
BUZOEC0  
MSB  
1: INT0  
0: R01  
1: INT1  
0: R02  
1: EC0  
0: R03  
1: BUZO  
MSB  
-
LSB  
R/W  
R/W  
R/W  
R/W  
ADDRESS: 0E6H  
INITIAL VALUE: ---- 0000B  
IEDS  
-
-
-
IED1H IED1L IED0H IED0L  
INT1  
INT0  
Edge selection register  
00: Reserved  
01: Falling (1-to-0 transition)  
10: Rising (0-to-1 transition)  
11: Both (Rising & Falling)  
Figure 16-9 R0FUNC and IEDS Registers  
JUNE. 2001 Ver 1.00  
71  
GMS81C2112/GMS81C2120  
17. Power Saving Mode  
For applications where power consumption is a critical  
factor, device provides four kinds of power saving func-  
tions, STOP mode, Sub-active mode and Wake-up Timer  
mode (Stand-by mode, Watch mode). Table 17-1 shows  
the status of each Power Saving Mode.  
The power saving function is activated by execution of  
STOP instruction and by execution of STOP instruction af-  
ter setting the corresponding status (WAKEUP) of  
CKCTLR. We shows the release sources from each Power  
Saving Mode  
Wake-up Timer  
Mode  
Wake-upTimer  
Mode  
Peripheral  
STOP Mode  
Release Source  
STOP Mode  
Stand-by Mode  
Retain  
Stand-by Mode  
RAM  
Control Registers  
I/O Ports  
Retain  
Retain  
Retain  
Stop  
RESET  
RCWDT  
EXT.INT0  
EXT.INT1  
Timer0  
O
O
O
O
Retain  
Retain  
O
X
O
O
CPU  
Stop  
Timer0  
Stop  
Operation  
Oscillation  
÷ 2048 only  
Oscillation  
Prescaler  
Stop  
Table 17-2 Release Sources from Power Saving Mode  
Stop  
Entering Condition  
[WAKEUP]  
0
1
Table 17-1 Power Saving Mode  
72  
JUNE. 2001 Ver 1.00  
 
GMS81C2112/GMS81C2120  
17.1 Operating Mode  
fXI : Main clock frequency  
fSYS : fXI,fXI÷4,fXI÷8,fXI÷32  
cpu : system clock  
tmr : timer0 clock  
peri : peripheral clock  
CKCTLR = CKCTLR[6:5]  
STANDBY Mode  
ACTIVE Mode  
CKCTLR[10]  
+
STOP  
fXI : oscillation  
fXI : oscillation  
cpu : stop  
tmr : ps11(fXI)  
peri : stop  
cpu : fSYS  
tmr : fSYS  
peri : fSYS  
TIMER0  
EXT_INT  
RESET  
RC_WDT  
CKCTLR[00]  
EXT_INT  
RESET  
+
STOP  
RC_WDT  
STOP Mode  
fXI : stop  
cpu : stop  
tmr : stop  
peri : stop  
System Clock Mode Register  
ADDRESS : FAH  
RESET VALUE : ---00---  
-
-
-
CS1  
CS0  
-
-
-
SCMR  
CS[1:0]  
Clock selection enable bits  
00 : fXI  
10 : fXI ÷ 8  
01 : fXI ÷ 4 11 : fXI ÷ 32  
JUNE. 2001 Ver 1.00  
73  
GMS81C2112/GMS81C2120  
17.2 Stop Mode  
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.  
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.  
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 17-1)  
• 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.  
When exit from Stop mode by external interrupt, enough  
oscillation stabilization time is required to normal opera-  
tion. Figure 17-2 shows the timing diagram. When release  
the Stop mode, the Basic interval timer is activated on  
wake-up. It is increased from 00H until FFH. 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.  
The Stop mode is activated by execution of STOP in-  
struction after clearing the bit WAKEUP of CKCTLR  
to “0”. (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)  
By reset, exit from Stop mode is shown in Figure .  
In the Stop mode of operation, VDD can be reduced to min-  
imize power consumption. Care must be taken, however,  
to ensure that VDD is not reduced before the Stop mode is  
invoked, and that VDD is restored to its normal operating  
level, before the Stop mode is terminated.  
STOP  
INSTRUCTION  
STOP Mode  
The reset should not be activated before VDD is restored to  
its normal operating level, and must be held active long  
enough to allow the oscillator to restart and stabilize.  
Interrupt Request  
=0  
Note: After STOP instruction, at least two or more NOP in-  
Corresponding Interrupt  
IEXX  
Enable Bit (IENH, IENL)  
=1  
struction should be written  
Ex)  
LDM CKCTLR,#0000_1110B  
STOP  
NOP  
NOP  
STOP Mode Release  
=0  
Master Interrupt  
Enable Bit PSW[2]  
I-FLAG  
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  
level (VDD/VSS); 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.  
=1  
Interrupt Service Routine  
Next  
INSTRUCTION  
Figure 17-1 STOP Releasing Flow by Interrupts  
74  
JUNE. 2001 Ver 1.00  
 
GMS81C2112/GMS81C2120  
.
Oscillator  
(X pin)  
IN  
Internal Clock  
External Interrupt  
STOP Instruction  
Executed  
BIT Counter  
n
n+1 n+2  
n+3  
1
0
FE  
0
1
2
FF  
Clear  
Normal Operation  
Stop Operation  
Normal Operation  
t
ST > 20ms  
by software  
Before executing Stop instruction, Basic Interval Timer must be set  
properly by software to get stabilization time which is longer than 20ms.  
Figure 17-2 STOP Mode Release Timing by External Interrupt  
STOP Mode  
Oscillator  
(XI pin)  
Internal  
Clock  
RESETB  
Internal  
RESETB  
STOP Instruction Execution  
Stabilization Time  
Time can not be control by software  
t
ST = 64mS @4MHz  
Figure 17-3 Timing of STOP Mode Release by RESET  
17.3 Wake-up Timer Mode  
struction should be written  
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.  
Ex)  
LDM TDR0,#0FFH  
LDM TM0,#0001_1011B  
LDM CKCTLR,#0100_1110B  
STOP  
NOP  
NOP  
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)  
In addition, the clock source of timer0 should be selected  
to 2048 divided ratio. Otherwise, the wake-up function 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 timer data register 0,  
TDR0.  
Note: After STOP instruction, at least two or more NOP in-  
JUNE. 2001 Ver 1.00  
75  
GMS81C2112/GMS81C2120  
Release the Wake-up Timer mode  
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 17-1)  
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.  
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 17-4.  
If I-flag = 1, the normal interrupt response takes place. If I-  
Oscillator  
(XI pin)  
CPU  
Clock  
STOP Instruction  
Execution  
Interrupt  
Request  
Normal Operation  
Wake-up Timer Mode  
( stop the CPU clock )  
Normal Operation  
Do not need Stabilization Time  
Figure 17-4 Wake-up Timer Mode Releasing by External Interrupt or Timer0 Interrupt  
17.4 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.  
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 execute  
the watchdog timer interrupt service routine.(Figure 17-5)  
However, if the bit WDTON of CKCTLR is set to "1", the  
device will generate the internal RESET signal and exe-  
cute the reset processing. (Figure 17-6)  
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 operation.  
If this register is set by bit manipulation instruction, for  
example "set1" or "clr1" instruction, it may be unde-  
sired operation)  
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 17-1)  
When exit from Internal RC-Oscillated Watchdog Timer  
mode by external interrupt, the oscillation stabilization  
time is required to normal operation. Figure 17-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 00H until FFH. 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.  
Note: Caution: After STOP instruction, at least two or more  
NOP instruction should be written  
Ex)  
LDM WDTR,#1111_1111B  
LDM CKCTLR,#0010_1110B  
STOP  
NOP  
NOP  
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  
By reset, exit from internal RC-Oscillated Watchdog Tim-  
er mode is shown in Figure 17-6.  
76  
JUNE. 2001 Ver 1.00  
 
GMS81C2112/GMS81C2120  
Oscillator  
(XI pin)  
Internal  
RC Clock  
Internal  
Clock  
External  
Interrupt  
( or WDT Interrupt )  
Clear Basic Interval Timer  
STOP Instruction Execution  
BIT  
Counter  
N-1  
N
N+1  
N+2  
N-2  
00  
01  
FE FF 00  
00  
Normal Operation  
Stabilization Time  
tST > 20mS  
RCWDT Mode  
Normal Operation  
Figure 17-5 Internal RCWDT Mode Releasing by External Interrupt or WDT Interrupt  
RCWDT Mode  
Oscillator  
(XI pin)  
Internal  
RC Clock  
Internal  
Clock  
RESET  
RESET by WDT  
Internal  
RESET  
STOP Instruction Execution  
Stabilization Time  
ST = 64mS @4MHz  
Time can not be control by software  
t
Figure 17-6 Internal RCWDT Mode Releasing by RESET  
17.5 Minimizing Current Consumption  
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 level  
(VDD/VSS); however, when the input level becomes higher  
The Stop mode is designed to reduce power consumption.  
To minimize current drawn during Stop mode, the user  
should turn-off output drivers that are sourcing or sinking  
current, if it is practical.  
Note: In the STOP operation, the power dissipation asso-  
JUNE. 2001 Ver 1.00  
77  
GMS81C2112/GMS81C2120  
than the power voltage level (by approximately 0.3V), a cur-  
rent begins to flow. Therefore, if cutting off the output tran-  
sistor at an I/O port puts the pin signal into the high-  
impedance state, a current flow across the ports input tran-  
sistor, requiring it to fix the level by pull-up or other means.  
But input voltage level should be VSS or VDD. Be careful  
that if unspecified voltage, i.e. if unfirmed voltage level  
(not VSSor VDD) is applied to input pin, there can be little  
current (max. 1mA at around 2V) flow.  
If it is not appropriate to set as an input mode, then set to  
output mode considering there is no current flow. Setting  
to High or Low is decided considering its relationship with  
external circuit. For example, if there is external pull-up re-  
sistor then it is set to output mode, i.e. to High, and if there  
is external pull-down register, it is set to low.  
It should be set properly in order that current flow through  
port doesn't exist.  
First conseider the setting to input mode. Be sure that there  
is no current flow after considering its relationship with  
external circuit. In input mode, the pin impedance viewing  
from external MCU is very high that the current doesn’t  
flow.  
VDD  
INPUT PIN  
INPUT PIN  
VDD  
VDD  
VDD  
internal  
pull-up  
i=0  
OPEN  
O
i
O
i
Very weak current flows  
VDD  
GND  
i=0  
X
GND  
X
OPEN  
O
Weak pull-up current flows  
O
When port is configured as an input, input level should  
be closed to 0V or 5V to avoid power consumption.  
Figure 17-7 Application Example of Unused Input Port  
OUTPUT PIN  
OUTPUT PIN  
ON  
VDD  
ON  
VDD  
OPEN  
L
L
OFF  
ON  
OFF  
ON  
O
i=0  
OFF  
OFF  
i
i
VDD  
GND  
GND  
GND  
ON  
X
O
X
OFF  
In the left case, Tr. base current flows from port to GND.  
To avoid power consumption, there should be low output  
to the port .  
O
In the left case, much current flows from port to GND.  
Figure 17-8 Application Example of Unused Output Port  
78  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
18. OSCILLATOR CIRCUIT  
The GMS81C21xx has an oscillation circuits internally.  
being used as an on-chip oscillator, as shown in Figure 18-  
1.  
X
IN and XOUT are input and output for main frequency re-  
spectively, inverting amplifier which can be configured for  
C1  
XOUT  
C2  
4.19MHz  
XIN  
VSS  
Recommend  
Crystal Oscillator  
Ceramic Resonator  
C1,C2 = 20pF  
C1,C2 = 30pF  
Crystal or Ceramic Oscillator  
XOUT  
Open  
XOUT  
REXT  
For selection R value,  
Refer to AC Characteristics  
XIN  
XIN  
External Clock  
External Oscillator  
RC Oscillator (mask option)  
Figure 18-1 Oscillation Circuit  
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.  
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.  
XOUT  
XIN  
In addition, see Figure 18-2 for the layout of the crystal.  
Note: Minimize the wiring length. Do not allow the wiring to  
intersect with other signal conductors. Do not allow the wir-  
ing to come near changing high current. Set the potential of  
the grounding position of the oscillator capacitor to that of  
SS  
Figure 18-2 Layout of Oscillator PCB circuit  
V
. Do not ground it to any ground pattern where high cur-  
rent is present. Do not fetch signals from the oscillator.  
JUNE. 2001 Ver 1.00  
79  
 
 
GMS81C2112/GMS81C2120  
19. RESET  
The GMS81C21xx have two types of reset generation pro-  
cedures; one is an external reset input, the other is a watch-  
dog timer reset. Table 19-1 shows on-chip hardware ini-  
tialization by reset action.  
On-chip Hardware  
Initial Value  
On-chip Hardware  
Peripheral clock  
Initial Value  
(FFFFH) - (FFFEH)  
Program counter  
(PC)  
(RPR)  
(G)  
Off  
Disable  
RAM page register  
G-flag  
0
Watchdog timer  
Control registers  
Power fail detector  
0
Refer to Table 8-1 on page 27  
Disable  
Operation mode  
Main-frequency clock  
Table 19-1 Initializing Internal Status by Reset Action  
19.1 External Reset Input  
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, within the  
operating voltage range and oscillation stable, it is applied,  
and the internal state is initialized. After reset, 64ms (at 4  
MHz) add with 7 oscillator periods are required to start ex-  
ecution as shown in Figure 19-2.  
A connection for simple power-on-reset is shown in Figure  
19-1.  
VCC  
10kΩ  
to the RESET pin  
7036P  
Internal RAM is not affected by reset. When VDD is turned  
on, the RAM content is indeterminate. Therefore, this  
RAM should be initialized before read or tested it.  
+
10uF  
When the RESET pin input goes to high, the reset opera-  
tion is released and the program execution starts at the vec-  
tor address stored at addresses FFFEH - FFFFH.  
Figure 19-1 Simple Power-on-Reset Circuit  
1
2
3
4
5
6
7
Oscillator  
(X pin)  
IN  
RESET  
ADDRESS  
BUS  
FFFE FFFF Start  
?
?
?
?
?
DATA  
BUS  
OP  
ADH  
FE  
ADL  
?
?
?
MAIN PROGRAM  
RESET Process Step  
1
Stabilization Time  
ST = 62.5mS at 4.19MHz  
t
tST  
=
x 256  
f
MAIN ÷1024  
Figure 19-2 Timing Diagram after RESET  
19.2 Watchdog Timer Reset  
Refer to “11. WATCHDOG TIMER” on page 39.  
80  
JUNE. 2001 Ver 1.00  
 
 
 
GMS81C2112/GMS81C2120  
20. POWER FAIL PROCESSOR  
The GMS81C21xx has an on-chip power fail detection cir-  
cuitry to immunize against power noise. A configuration  
register, PFDR, can enable or disable the power fail detect  
circuitry. Whenever VDD falls close to or below power fail  
voltage for 100ns, the power fail situation may reset or  
freeze MCU according to PFDM bit of PFDR. Refer to  
“7.4 DC Electrical Characteristics for Standard Pins(5V)”  
on page 14.  
Note: If power fail voltage is selected to 3.0V on 3V oper-  
ation, MCU is freezed at all the times.  
Power FailFunction  
OTP  
MASK  
Enable/Disable  
PFDIS flag  
PFDIS flag  
PFS0 bit  
PFS1 bit  
Level Selection  
Mask option  
In the in-circuit emulator, power fail function is not imple-  
mented and user can not experiment with it. Therefore, af-  
ter final development of user program, this function may  
be experimented or evaluated.  
Table 20-1 Power fail processor  
Note: User can select power fail voltage level according to  
PFD0, PFD1 bit of CONFIG register(703FH) at the OTP  
(GMS87C21xx) but must select the power fail voltage level  
to define PFD option of “Mask Order & Verification Sheet”  
at the mask chip(GMS81C21xx).  
Because the power fail voltage level of mask chip  
(GMS81C21xx) is determined according to mask option.  
.
R/W R/W R/W  
7
6
5
4
3
2
1
0
ADDRESS: 0EFH  
INITIAL VALUE: ---- -100B  
PFDR  
PFDM  
PFDIS  
PFS  
Power Fail Status  
0: Normal operate  
1: Set to “1” if power fail is detected  
Operation Mode  
0 : Normal operation regardless of power fail  
1 : MCU will be reset by power fail detection  
Disable Flag  
0: Power fail detection enable  
1: Power fail detection disable  
Figure 20-1 Power Fail Voltage Detector Register  
JUNE. 2001 Ver 1.00  
81  
GMS81C2112/GMS81C2120  
RESET VECTOR  
YES  
PFS =1  
NO  
RAM CLEAR  
INITIALIZE RAM DATA  
PFS = 0  
Skip the  
initial routine  
INITIALIZE ALL PORTS  
INITIALIZE REGISTERS  
FUNTION  
EXECUTION  
Figure 20-2 Example S/W of RESET flow by Power fail  
V
DD  
V
MAX  
PFD  
V
MIN  
PFD  
64mS  
Internal  
RESET  
V
DD  
V
V
MAX  
PFD  
MIN  
PFD  
When PFR = 1  
64mS  
Internal  
RESET  
t <64mS  
V
DD  
V
MAX  
PFD  
V
MIN  
PFD  
64mS  
Internal  
RESET  
Figure 20-3 Power Fail Processor Situations  
82  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
21. OTP PROGRAMMING  
21.1 DEVICE CONFIGURATION AREA  
The Device Configuration Area can be programmed or left  
unprogrammed to select device configuration such as secu-  
rity bit.  
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.  
Sixteen memory locations (7030H ~ 703FH) are designated  
7030H  
ID  
ID  
7030H  
7031H  
7032H  
7033H  
7034H  
7035H  
7036H  
7037H  
7038H  
7039H  
703AH  
703BH  
703CH  
703DH  
703EH  
703FH  
DEVICE  
CONFIGURATION  
AREA  
ID  
ID  
703FH  
ID  
ID  
ID  
ID  
ID  
ID  
ID  
ID  
ID  
ID  
ID  
CONFIG  
7
6
5
4
3
2
1
0
ADDRESS: 703FH  
INITIAL VALUE: --00 -0-0B  
PFS1 PFS0  
LOCK  
RCO  
CONFIG  
External RC OSC Selection  
0: Crystal or Resonator Oscillator  
1: External RC Oscillator  
Code Protect  
0 : Allow Code Read Out  
1 : Lock Code Read Out  
PFD Level Selection  
00: PFD = 2.7V  
01: PFD = 2.7V  
10: PFD = 3.0V  
11: PFD = 2.4V  
Figure 21-1 Device Configuration Area  
JUNE. 2001 Ver 1.00  
83  
GMS81C2112/GMS81C2120  
42PDIP  
RA  
R53  
R54  
R55  
R56  
R57  
1
2
3
4
5
6
7
8
9
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
42  
41  
40  
39  
38  
37  
36  
35  
34  
33  
32  
31  
30  
29  
28  
27  
26  
25  
24  
23  
22  
R34  
R33  
R32  
R31  
R30  
R27  
R26  
R25  
R24  
R23  
R22  
R21  
R20  
R07  
R06  
R05  
R04  
R03  
R02  
R01  
R00  
CTL3  
CTL2  
CTL1  
CTL0  
VPP  
EPROM Enable  
RESET  
XI  
XO  
VSS  
VSS  
AVSS  
R60  
R61  
R62  
R63  
R64  
R65  
R66  
R67  
AVDD  
VDD  
A_D0  
A_D1  
A_D2  
A_D3  
A_D4  
A_D5  
A_D6  
A_D7  
VDD  
Figure 21-2 Pin Assignment t  
User Mode  
Pin Name  
EPROM MODE  
Description  
Pin No.  
Pin Name  
2
3
R53  
R54  
R55  
R56  
CTL3  
Read/Write Control  
Address/Data Control  
Write Control 1  
CTL2  
CTL1  
CTL0  
VPP  
4
5
Write Control 0  
7
RESETB  
XI  
Programming Power (0V, 12.75V)  
8
EPROM Enable High Active, Latch Address in falling edge  
9
XO  
NC  
No connection  
Connect to VSS (0V)  
10  
12  
13  
14  
15  
16  
17  
18  
19  
21  
VSS  
R60  
R61  
R62  
R63  
R64  
R65  
R66  
R67  
VDD  
VSS  
A_D0  
A_D1  
A_D2  
A_D3  
A_D4  
A_D5  
A_D6  
A_D7  
VDD  
A8  
A0  
A1  
A2  
A3  
A4  
A5  
A6  
A7  
D0  
D1  
D2  
D3  
D4  
D5  
D6  
D7  
A9  
Address Input  
Data Input/Output  
A10  
A11  
A12  
A13  
A14  
A15  
Address Input  
Data Input/Output  
Connect to VDD (6.0V)  
Table 21-1 Pin Description in EPROM Mode (GMS81C2120)  
84  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
THLD1  
TSET1  
THLD2  
TDLY2  
TDLY1  
EPROM  
Enable  
TVPPS  
VIHP  
VPP  
TVPPR  
TVDDS  
0V  
CTL0/1  
CTL2  
VDD1H  
TCD1  
VDD1H  
TCD1  
0V  
TCD1  
TCD1  
CTL3  
0V  
A_D7~  
A_D0  
DATA  
OUT  
DATA  
HA  
LA  
DATA IN  
LA  
DATA IN  
OUT  
VDD1H  
VDD  
Write Mode  
Verify  
Low 8bit  
Address  
Input  
Write Mode  
Verify  
Low 8bit  
Address  
Input  
High 8bit  
Address  
Input  
Figure 21-3 Timing Diagram in Program (Write & Verify) Mode  
JUNE. 2001 Ver 1.00  
85  
GMS81C2112/GMS81C2120  
After input a high address,  
output data following low address input  
Anothe high address step  
THLD1  
TSET1  
THLD2  
TDLY2  
TDLY1  
EPROM  
Enable  
TVPPS  
VIHP  
VPP  
TVDDS  
TVPPR  
0V  
CTL0/1  
CTL2  
VDD2H  
TCD2  
TCD2  
0V  
VDD2H  
TCD1  
TCD1  
CTL3  
0V  
A_D7~  
A_D0  
HA  
LA  
LA  
DATA  
DATA  
HA  
DATA  
LA  
VDD2H  
VDD  
DATA  
Output  
DATA  
Output  
Low 8bit  
Address  
Input  
Low 8bit  
Address  
Input  
Low 8bit  
Address  
Input  
DATA  
Output  
High 8bit  
Address  
Input  
High 8bit  
Address  
Input  
Figure 21-4 Timing Diagram in READ Mode  
Parameter  
Symbol  
IVPP  
MIN  
TYP  
MAX  
Unit  
mA  
mA  
V
Programming Supply Current  
Supply Current in EPROM Mode  
VPP Level during Programming  
VDD Level in Program Mode  
-
-
50  
IVDDP  
VIHP  
-
11.5  
5
-
20  
12.0  
12.5  
VDD1H  
VDD2H  
VIHC  
6
6.5  
V
VDD Level in Read Mode  
-
2.7  
-
V
0.8VDD  
CTL3~0 High Level in EPROM Mode  
CTL3~0 Low Level in EPROM Mode  
A_D7~A_D0 High Level in EPROM Mode  
A_D7~A_D0 Low Level in EPROM Mode  
VDD Saturation Time  
-
-
V
VILC  
0.2VDD  
-
-
V
VIHAD  
VILAD  
TVDDS  
TVPPR  
TVPPS  
TSET1  
THLD1  
0.9VDD  
-
-
V
0.1VDD  
-
1
-
-
V
-
-
-
1
-
mS  
mS  
mS  
nS  
nS  
VPP Setup Time  
VPP Saturation Time  
1
-
EPROM Enable Setup Time after Data Input  
EPROM Enable Hold Time after TSET1  
200  
500  
Table 21-2 AC/DC Requirements for Program/Read Mode  
86  
JUNE. 2001 Ver 1.00  
GMS81C2112/GMS81C2120  
EPROM Enable Delay Time after THLD1  
TDLY1  
THLD2  
TDLY2  
TCD1  
200  
100  
200  
100  
100  
nS  
nS  
nS  
nS  
nS  
EPROM Enable Hold Time in Write Mode  
EPROM Enable Delay Time after THLD2  
CTL2,1 Setup Time after Low Address input and Data input  
CTL1 Setup Time before Data output in Read and Verify Mode  
TCD2  
Table 21-2 AC/DC Requirements for Program/Read Mode  
START  
Set VDD=V  
DD1H  
Report  
Verify failure  
Verify of all address  
Report  
Set VPP=V  
IHP  
Programming failure  
FAIL  
VDD=6V & 2.7V  
Verify  
FAIL  
Verify blank  
PASS  
PASS  
First Address Location  
Report  
Programming OK  
Next address location  
VPP=0V  
VDD=0V  
N=1  
N=N+1  
YES  
N ꢀ ꢁꢂ  
END  
EPROM Write  
100uS program time  
NO  
FAIL  
Verify  
PASS  
Apply 3x program cycle  
NO  
Last address  
?
YES  
Figure 21-5 Programming Flow Chart  
JUNE. 2001 Ver 1.00  
87  
GMS81C2112/GMS81C2120  
88  
JUNE. 2001 Ver 1.00  
APPENDIX  
GMS800 Series  
A. CONTROL REGISTER LIST  
Initial Value  
7 6 5 4 3 2 1 0  
Undefined  
Address  
Register Name  
Symbol  
R/W  
Page  
00C0  
00C1  
00C4  
00C5  
00C6  
00C7  
00CA  
00CB  
00CC  
00CD  
00D0  
R0 port data register  
R0  
R0IO  
R2  
R/W  
W
34  
34  
35  
35  
35  
35  
35  
35  
35  
35  
44  
48  
44  
50  
44  
44  
54  
48  
54  
50  
54  
63  
60  
60  
66  
66  
65  
65  
71  
56  
56  
38  
38  
40  
40  
81  
R0 port I/O direction register  
R2 port data register  
0 0 0 0 0 0 0 0  
Undefined  
R/W  
W
R2 port I/O direction register  
R3 port data register  
R2IO  
R3  
0 0 0 0 0 0 0 0  
Undefined  
R/W  
W
R3 port I/O direction register  
R5 port data register  
R3IO  
R5  
- - - 0 0 0 0 0  
Undefined  
R/W  
W
R5 port I/O direction register  
R6 port data register  
R5IO  
R6  
0 0 0 0 0 - - -  
Undefined  
R/W  
W
R6 port I/O direction register  
Timer mode register 0  
R6IO  
TM0  
0 0 0 0 0 0 0 0  
- - 0 0 0 0 0 0  
0 0 0 0 0 0 0 0  
1 1 1 1 1 1 1 1  
0 0 0 0 0 0 0 0  
0 0 0 0 0 0 0 0  
1 1 1 1 1 1 1 1  
1 1 1 1 1 1 1 1  
0 0 0 0 0 0 0 0  
0 0 0 0 0 0 0 0  
0 0 0 0 0 0 0 0  
- - - - 0 0 0 0  
1 1 1 1 1 1 1 1  
0 0 0 0 0 0 0 1  
Undefined  
R/W  
R
Timer 0 register  
T0  
00D1  
Timer 0 data register  
TDR0  
CDR0  
TM1  
W
Capture 0 data register  
Timer mode register 1  
R
00D2  
00D3  
R/W  
W
Timer 1 data register  
TDR1  
T1PPR  
T1  
PWM 1 period register  
W
Timer 1 register  
R
00D4  
PWM 1 duty register  
T1PDR  
CDR1  
PWM1HR  
BUR  
R/W  
R
Capture 1 data register  
PWM 1 High register  
00D5  
00DE  
00E0  
00E1  
00E2  
00E3  
00E4  
00E5  
00E6  
00EA  
00EB  
W
Buzzer driver register  
W
Serial I/O mode register  
Serial I/O data register  
Interrupt enable register high  
Interrupt enable register low  
Interrupt request flag register high  
Interrupt request flag register low  
External interrupt edge selection register  
A/D converter mode register  
A/D converter data register  
Basic interval timer mode register  
Clock control register  
SIOM  
SIOR  
IENH  
IENL  
IRQH  
IRQL  
IEDS  
ADCM  
ADCR  
BITR  
CKCTLR  
WDTR  
WDTR  
PFDR  
R/W  
R/W  
R/W  
R/W  
R/W  
R/W  
R/W  
R/W  
R
0 0 0 0 - - - -  
0 0 0 0 - - - -  
0 0 0 0 - - - -  
0 0 0 0 - - - -  
- - - - 0 0 0 0  
- 0 0 0 0 0 0 1  
Undefined  
R
0 0 0 0 0 0 0 0  
- 0 0 1 0 1 1 1  
0 0 0 0 0 0 0 0  
0 1 1 1 1 1 1 1  
- - - - - 1 0 0  
00EC  
W
Watchdog Timer Register  
Watchdog Timer Register  
Power fail detection register  
R
00ED  
00EF  
W
R/W  
JUNE. 2001  
i
GMS800 Series  
Initial Value  
7 6 5 4 3 2 1 0  
- - - - 0 0 0 0  
- 0 - - - - - -  
0 0 0 0 0 0 0 0  
0 0 0 0 0 - - -  
- - - 0 0 - - -  
Undefined  
Address  
Register Name  
Symbol  
R/W  
Page  
00F4  
00F6  
00F7  
00F9  
00FA  
00FB  
R0 Function selection register  
R5 Function selection register  
R6 Function selection register  
R5 N-MOS open drain selection register  
System clock mode register  
RA port data register  
R0FUNC  
R5FUNC  
R6FUNC  
R5MPDR  
SCMR  
W
W
34  
35  
35  
35  
73  
34  
W
W
R/W  
R
RA  
ii  
JUNE. 2001  
GMS800 Series  
B. INSTRUCTION  
B.1 Terminology List  
Terminology  
Description  
A
X
Accumulator  
X - register  
Y
Y - register  
PSW  
#imm  
dp  
Program Status Word  
8-bit Immediate data  
Direct Page Offset Address  
Absolute Address  
Indirect expression  
Register Indirect expression  
!abs  
[ ]  
{ }  
{ }+  
.bit  
Register Indirect expression, after that, Register auto-increment  
Bit Position  
A.bit  
dp.bit  
M.bit  
rel  
Bit Position of Accumulator  
Bit Position of Direct Page Memory  
Bit Position of Memory Data (000H~0FFFH)  
Relative Addressing Data  
U-page (0FF00H~0FFFFH) Offset Address  
Table CALL Number (0~15)  
upage  
n
+
Addition  
Upper Nibble Expression in Opcode  
0
x
y
Bit Position  
Bit Position  
Upper Nibble Expression in Opcode  
1
×
Subtraction  
Multiplication  
/
Division  
( )  
Contents Expression  
AND  
OR  
Exclusive OR  
~
=
NOT  
Assignment / Transfer / Shift Left  
Shift Right  
Exchange  
Equal  
Not Equal  
JUNE. 2001  
iii  
GMS800 Series  
B.2 Instruction Map  
00000 00001 00010 00011 00100 00101 00110 00111 01000 01001 01010 01011 01100 01101 01110 01111  
LOW  
HIGH  
00  
01  
02  
03  
04  
05  
06  
07  
08  
09  
0A  
0B  
0C  
0D  
0E  
0F  
SET1  
BBS  
BBS  
ADC  
ADC  
dp  
ADC  
dp+X  
ADC  
!abs  
ASL  
A
ASL  
dp  
TCALL SETA1  
.bit  
BIT  
dp  
POP  
A
PUSH  
A
000  
-
BRK  
dp.bit A.bit,rel dp.bit,rel #imm  
0
SBC  
#imm  
SBC  
dp  
SBC  
dp+X  
SBC  
!abs  
ROL  
A
ROL  
dp  
TCALL CLRA1 COM  
POP  
X
PUSH  
X
BRA  
rel  
001  
010  
011  
100  
101  
110  
111  
CLRC  
CLRG  
DI  
2
.bit  
dp  
CMP  
#imm  
CMP  
dp  
CMP  
dp+X  
CMP  
!abs  
LSR  
A
LSR  
dp  
TCALL NOT1  
TST  
dp  
POP  
Y
PUSH PCALL  
Y
4
M.bit  
Upage  
OR  
#imm  
OR  
dp  
OR  
dp+X  
OR  
!abs  
ROR  
A
ROR TCALL  
dp  
OR1  
OR1B  
CMPX  
dp  
POP  
PSW  
PUSH  
PSW  
RET  
6
AND  
#imm  
AND  
dp  
AND  
dp+X  
AND  
!abs  
INC  
A
INC  
dp  
TCALL AND1 CMPY CBNE  
INC  
X
CLRV  
SETC  
SETG  
EI  
TXSP  
TSPX  
XCN  
8
AND1B  
dp  
dp+X  
EOR  
#imm  
EOR  
dp  
EOR  
dp+X  
EOR  
!abs  
DEC  
A
DEC  
dp  
TCALL EOR1 DBNE  
XMA  
dp+X  
DEC  
X
10  
EOR1B  
dp  
LDA  
#imm  
LDA  
dp  
LDA  
dp+X  
LDA  
!abs  
LDY  
dp  
TCALL  
12  
LDC  
LDCB  
LDX  
dp  
LDX  
dp+Y  
TXA  
TAX  
DAS  
LDM  
dp,#imm  
STA  
dp  
STA  
dp+X  
STA  
!abs  
STY  
dp  
TCALL  
14  
STC  
M.bit  
STX  
dp  
STX  
dp+Y  
XAX  
STOP  
LOW 10000 10001 10010 10011 10100 10101 10110 10111 11000 11001 11010 11011  
11100  
1C  
11101  
1D  
11110  
1E  
11111  
1F  
HIGH  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
1A  
1B  
BPL  
rel  
ADC  
{X}  
ADC  
ADC  
ADC  
ASL  
!abs  
ASL  
dp+X  
TCALL  
1
JMP  
!abs  
BIT  
!abs  
ADDW  
dp  
LDX  
#imm  
JMP  
[!abs]  
CLR1  
dp.bit  
BBC  
BBC  
000  
A.bit,rel dp.bit,rel  
!abs+Y [dp+X] [dp]+Y  
BVC  
rel  
SBC  
{X}  
SBC  
SBC  
SBC  
ROL  
!abs  
ROL  
dp+X  
TCALL CALL  
TEST SUBW  
!abs dp  
LDY  
#imm  
JMP  
[dp]  
001  
010  
011  
100  
101  
110  
111  
!abs+Y [dp+X] [dp]+Y  
3
!abs  
BCC  
rel  
CMP  
{X}  
CMP  
CMP  
CMP  
LSR  
!abs  
LSR  
dp+X  
TCALL  
5
TCLR1 CMPW CMPX CALL  
MUL  
!abs+Y [dp+X] [dp]+Y  
!abs  
dp  
#imm  
[dp]  
BNE  
rel  
OR  
{X}  
OR  
OR  
OR  
ROR  
!abs  
ROR TCALL DBNE CMPX LDYA CMPY  
dp+X  
RETI  
!abs+Y [dp+X] [dp]+Y  
7
Y
!abs  
dp  
#imm  
BMI  
rel  
AND  
{X}  
AND  
AND  
AND  
INC  
!abs  
INC  
dp+X  
TCALL  
9
CMPY INCW  
INC  
Y
DIV  
TAY  
TYA  
DAA  
NOP  
!abs+Y [dp+X] [dp]+Y  
!abs  
dp  
BVS  
rel  
EOR  
{X}  
EOR  
EOR  
EOR  
DEC  
!abs  
DEC  
dp+X  
TCALL  
11  
XMA  
{X}  
XMA  
dp  
DECW  
dp  
DEC  
Y
!abs+Y [dp+X] [dp]+Y  
BCS  
rel  
LDA  
{X}  
LDA  
LDA  
LDA  
LDY  
!abs  
LDY  
dp+X  
TCALL  
13  
LDA  
{X}+  
LDX  
!abs  
STYA  
dp  
XAY  
XYX  
!abs+Y [dp+X] [dp]+Y  
BEQ  
rel  
STA  
{X}  
STA  
STA  
STA  
STY  
!abs  
STY  
dp+X  
TCALL  
15  
STA  
{X}+  
STX  
!abs  
CBNE  
dp  
!abs+Y [dp+X] [dp]+Y  
iv  
JUNE. 2001  
GMS800 Series  
B.3 Instruction Set  
Arithmetic / Logic Operation  
Op  
Code  
Byte  
No  
Cycle  
No  
Flag  
NVGBHIZC  
No.  
Mnemonic  
Operation  
1
ADC #imm  
04  
05  
06  
07  
15  
16  
17  
14  
84  
85  
86  
87  
95  
96  
97  
94  
08  
09  
19  
18  
44  
45  
46  
47  
55  
56  
57  
54  
5E  
6C  
7C  
7E  
8C  
9C  
2C  
DF  
CF  
A8  
A9  
B9  
B8  
AF  
BE  
2
2
2
3
3
2
2
1
2
2
2
3
3
2
2
1
1
2
2
3
2
2
2
3
3
2
2
1
2
2
3
2
2
3
2
1
1
1
2
2
3
1
1
2
3
4
4
5
6
6
3
2
3
4
4
5
6
6
3
2
4
5
5
2
3
4
4
5
6
6
3
2
3
4
2
3
4
4
3
3
2
4
5
5
2
2
Add with carry.  
2
ADC dp  
A ( A ) + ( M ) + C  
3
ADC dp + X  
ADC !abs  
ADC !abs + Y  
ADC [ dp + X ]  
ADC [ dp ] + Y  
ADC { X }  
AND #imm  
AND dp  
4
NV--H-ZC  
5
6
7
8
9
Logical AND  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
A ( A ) ( M )  
AND dp + X  
AND !abs  
AND !abs + Y  
AND [ dp + X ]  
AND [ dp ] + Y  
AND { X }  
ASL A  
N-----Z-  
N-----ZC  
Arithmetic shift left  
ASL dp  
C
7
6 5 4 3 2 1 0  
← ← ← ← ← ← ← ← “0”  
ASL dp + X  
ASL !abs  
CMP #imm  
CMP dp  
CMP dp + X  
CMP !abs  
CMP !abs + Y  
CMP [ dp + X ]  
CMP [ dp ] + Y  
CMP { X }  
CMPX #imm  
CMPX dp  
CMPX !abs  
CMPY #imm  
CMPY dp  
CMPY !abs  
COM dp  
N-----ZC  
Compare accumulator contents with memory contents  
( A ) - ( M )  
Compare X contents with memory contents  
( X ) - ( M )  
N-----ZC  
N-----ZC  
Compare Y contents with memory contents  
( Y ) - ( M )  
1’S Complement : ( dp ) ~( dp )  
Decimal adjust for addition  
Decimal adjust for subtraction  
Decrement  
N-----Z-  
N-----ZC  
N-----ZC  
N-----Z-  
N-----Z-  
N-----Z-  
N-----Z-  
N-----Z-  
N-----Z-  
DAA  
DAS  
DEC A  
DEC dp  
M ( M ) - 1  
DEC dp + X  
DEC !abs  
DEC X  
DEC Y  
JUNE. 2001  
v
GMS800 Series  
Op  
Code  
Byte  
No  
Cycle  
No  
Flag  
NVGBHIZC  
No.  
Mnemonic  
Operation  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
DIV  
9B  
A4  
A5  
A6  
A7  
B5  
B6  
B7  
B4  
88  
89  
99  
98  
8F  
9E  
48  
49  
59  
58  
5B  
64  
65  
66  
67  
75  
76  
77  
74  
28  
29  
39  
38  
68  
69  
79  
78  
24  
25  
26  
27  
35  
36  
37  
34  
4C  
1
2
2
2
3
3
2
2
1
1
2
2
3
1
1
1
2
2
3
1
2
2
2
3
3
2
2
1
1
2
2
3
1
2
2
3
2
2
2
3
3
2
2
1
2
12  
2
3
4
4
5
6
6
3
2
4
5
5
2
2
2
4
5
5
9
2
3
4
4
5
6
6
3
2
4
5
5
2
4
5
5
2
3
4
4
5
6
6
3
3
Divide : YA / X Q: A, R: Y  
NV--H-Z-  
EOR #imm  
EOR dp  
Exclusive OR  
A ( A ) ( M )  
EOR dp + X  
EOR !abs  
EOR !abs + Y  
EOR [ dp + X ]  
EOR [ dp ] + Y  
EOR { X }  
INC A  
N-----Z-  
Increment  
N-----ZC  
N-----Z-  
N-----Z-  
N-----Z-  
N-----Z-  
N-----Z-  
INC dp  
M ( M ) + 1  
INC dp + X  
INC !abs  
INC X  
INC Y  
LSR A  
Logical shift right  
LSR dp  
N-----ZC  
N-----Z-  
7
6 5 4 3 2 1 0  
C
“0” → → → → → → → → →  
LSR dp + X  
LSR !abs  
MUL  
Multiply : YA Y × A  
Logical OR  
OR #imm  
OR dp  
A ( A ) ( M )  
OR dp + X  
OR !abs  
N-----Z-  
OR !abs + Y  
OR [ dp + X ]  
OR [ dp ] + Y  
OR { X }  
ROL A  
Rotate left through Carry  
ROL dp  
N-----ZC  
N-----ZC  
7
6 5 4 3 2 1 0  
C
← ← ← ← ← ← ← ←  
ROL dp + X  
ROL !abs  
ROR A  
Rotate right through Carry  
6 5 4 3 2 1 0  
→ → → → → → → →  
ROR dp  
7
C
ROR dp + X  
ROR !abs  
SBC #imm  
SBC dp  
Subtract with Carry  
A ( A ) - ( M ) - ~( C )  
SBC dp + X  
SBC !abs  
SBC !abs + Y  
SBC [ dp + X ]  
SBC [ dp ] + Y  
SBC { X }  
TST dp  
NV--HZC  
Test memory contents for negative or zero, ( dp ) - 00  
Exchange nibbles within the accumulator  
N-----Z-  
N-----Z-  
H
89  
XCN  
CE  
1
5
A ~A A ~A  
0
7
4
3
vi  
JUNE. 2001  
GMS800 Series  
Register / Memory Operation  
Op  
Code  
Byte  
No  
Cycle  
No  
Flag  
NVGBHIZC  
No.  
Mnemonic  
Operation  
1
LDA #imm  
C4  
C5  
C6  
C7  
D5  
D6  
D7  
D4  
DB  
E4  
1E  
CC  
CD  
DC  
3E  
C9  
D9  
D8  
E5  
E6  
E7  
F5  
F6  
F7  
F4  
FB  
EC  
ED  
FC  
E9  
F9  
F8  
2
2
2
3
3
2
2
1
1
3
2
2
2
3
2
2
2
3
2
2
3
3
2
2
1
1
2
2
3
2
2
3
1
1
1
1
1
1
1
1
2
2
1
1
2
3
4
4
5
6
6
3
4
5
2
3
4
4
2
3
4
4
4
5
5
6
7
7
4
4
4
5
5
4
5
5
2
2
2
2
2
2
4
4
5
6
5
4
Load accumulator  
2
LDA dp  
A ( M )  
3
LDA dp + X  
LDA !abs  
LDA !abs + Y  
LDA [ dp + X ]  
LDA [ dp ] + Y  
LDA { X }  
LDA { X }+  
LDM dp,#imm  
LDX #imm  
LDX dp  
4
5
N-----Z-  
6
7
8
9
X- register auto-increment : A ( M ) , X X + 1  
Load memory with immediate data : ( M ) imm  
Load X-register  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
--------  
N-----Z-  
X ( M )  
LDX dp + Y  
LDX !abs  
LDY #imm  
LDY dp  
Load Y-register  
Y ( M )  
N-----Z-  
--------  
LDY dp + X  
LDY !abs  
STA dp  
Store accumulator contents in memory  
STA dp + X  
STA !abs  
STA !abs + Y  
STA [ dp + X ]  
STA [ dp ] + Y  
STA { X }  
STA { X }+  
STX dp  
( M ) A  
X- register auto-increment : ( M ) A, X X + 1  
Store X-register contents in memory  
( M ) X  
STX dp + Y  
STX !abs  
STY dp  
--------  
--------  
Store Y-register contents in memory  
STY dp + X  
STY !abs  
TAX  
( M ) Y  
E8  
9F  
Transfer accumulator contents to X-register : X A  
Transfer accumulator contents to Y-register : Y A  
Transfer stack-pointer contents to X-register : X sp  
Transfer X-register contents to accumulator: A X  
Transfer X-register contents to stack-pointer: sp X  
Transfer Y-register contents to accumulator: A Y  
Exchange X-register contents with accumulator :X A  
Exchange Y-register contents with accumulator :Y A  
Exchange memory contents with accumulator  
( M ) A  
N-----Z-  
N-----Z-  
N-----Z-  
N-----Z-  
N-----Z-  
N-----Z-  
--------  
--------  
TAY  
TSPX  
AE  
C8  
8E  
BF  
EE  
DE  
BC  
AD  
BB  
FE  
TXA  
TXSP  
TYA  
XAX  
XAY  
XMA dp  
XMA dp+X  
XMA {X}  
XYX  
N-----Z-  
--------  
Exchange X-register contents with Y-register : X Y  
JUNE. 2001  
vii  
GMS800 Series  
16-BIT operation  
Op  
Code  
Byte  
No  
Cycle  
No  
Flag  
NVGBHIZC  
No.  
1
Mnemonic  
Operation  
16-Bits add without Carry  
YA ( YA ) + ( dp +1 ) ( dp )  
ADDW dp  
CMPW dp  
DECW dp  
INCW dp  
LDYA dp  
STYA dp  
SUBW dp  
1D  
5D  
BD  
9D  
7D  
DD  
3D  
2
2
2
2
2
2
2
5
4
6
6
5
5
5
NV--H-ZC  
N-----ZC  
N-----Z-  
N-----Z-  
N-----Z-  
--------  
NV--H-ZC  
Compare YA contents with memory pair contents :  
2
(YA) (dp+1)(dp)  
Decrement memory pair  
( dp+1)( dp) ( dp+1) ( dp) - 1  
3
Increment memory pair  
( dp+1) ( dp) ( dp+1) ( dp ) + 1  
4
Load YA  
YA ( dp +1 ) ( dp )  
5
Store YA  
( dp +1 ) ( dp ) YA  
6
16-Bits subtract without carry  
YA ( YA ) - ( dp +1) ( dp)  
7
Bit Manipulation  
Op  
Code  
Byte  
No  
Cycle  
No  
Flag  
NVGBHIZC  
No.  
Mnemonic  
Operation  
1
2
AND1 M.bit  
AND1B M.bit  
BIT dp  
8B  
8B  
0C  
1C  
y1  
3
3
2
3
2
2
1
1
1
3
3
3
3
3
3
3
2
2
1
1
3
4
4
4
5
4
2
2
2
2
5
5
4
4
5
5
5
4
2
2
2
6
Bit AND C-flag : C ( C ) ( M .bit )  
Bit AND C-flag and NOT : C ( C ) ~( M .bit )  
Bit test A with memory :  
-------C  
-------C  
MM----Z-  
3
Z ( A ) ( M ) , N ( M ) , V ( M )  
4
BIT !abs  
7
6
5
CLR1 dp.bit  
CLRA1 A.bit  
CLRC  
Clear bit : ( M.bit ) “0”  
Clear A bit : ( A.bit ) “0”  
Clear C-flag : C “0”  
Clear G-flag : G “0”  
Clear V-flag : V “0”  
--------  
--------  
-------0  
--0-----  
-0--0---  
-------C  
-------C  
-------C  
-------C  
--------  
-------C  
-------C  
--------  
--------  
-------1  
--1-----  
--------  
6
2B  
20  
7
8
CLRG  
40  
9
CLRV  
80  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
EOR1 M.bit  
EOR1B M.bit  
LDC M.bit  
LDCB M.bit  
NOT1 M.bit  
OR1 M.bit  
OR1B M.bit  
SET1 dp.bit  
SETA1 A.bit  
SETC  
AB  
AB  
CB  
CB  
4B  
6B  
6B  
x1  
Bit exclusive-OR C-flag : C ( C )  
( M .bit )  
Bit exclusive-OR C-flag and NOT : C ( C ) ~(M .bit)  
Load C-flag : C ( M .bit )  
Load C-flag with NOT : C ~( M .bit )  
Bit complement : ( M .bit ) ~( M .bit )  
Bit OR C-flag : C ( C ) ( M .bit )  
Bit OR C-flag and NOT : C ( C ) ~( M .bit )  
Set bit : ( M.bit ) “1”  
0B  
A0  
C0  
EB  
Set A bit : ( A.bit ) “1”  
Set C-flag : C “1”  
SETG  
Set G-flag : G “1”  
STC M.bit  
Store C-flag : ( M .bit ) C  
Test and clear bits with A :  
A - ( M ) , ( M ) ( M ) ~( A )  
22  
23  
TCLR1 !abs  
TSET1 !abs  
5C  
3C  
3
3
6
6
N-----Z-  
N-----Z-  
Test and set bits with A :  
A - ( M ) , ( M ) ( M ) ( A )  
viii  
JUNE. 2001  
GMS800 Series  
Branch / Jump Operation  
Op  
Code  
Byte  
No  
Cycle  
No  
Flag  
NVGBHIZC  
No.  
Mnemonic  
Operation  
1
2
3
4
BBC A.bit,rel  
BBC dp.bit,rel  
BBS A.bit,rel  
BBS dp.bit,rel  
y2  
y3  
x2  
x3  
2
3
2
3
4/6  
5/7  
4/6  
5/7  
Branch if bit clear :  
--------  
--------  
if ( bit ) = 0 , then pc ( pc ) + rel  
Branch if bit set :  
if ( bit ) = 1 , then pc ( pc ) + rel  
Branch if carry bit clear  
if ( C ) = 0 , then pc ( pc ) + rel  
5
6
BCC rel  
BCS rel  
BEQ rel  
BMI rel  
BNE rel  
BPL rel  
BRA rel  
BVC rel  
50  
D0  
F0  
90  
70  
10  
2F  
30  
2
2
2
2
2
2
2
2
2/4  
2/4  
2/4  
2/4  
2/4  
2/4  
4
--------  
--------  
--------  
--------  
--------  
--------  
--------  
--------  
--------  
Branch if carry bit set  
if ( C ) = 1 , then pc ( pc ) + rel  
Branch if equal  
if ( Z ) = 1 , then pc ( pc ) + rel  
7
Branch if minus  
if ( N ) = 1 , then pc ( pc ) + rel  
8
Branch if not equal  
if ( Z ) = 0 , then pc ( pc ) + rel  
9
Branch if minus  
if ( N ) = 0 , then pc ( pc ) + rel  
10  
11  
12  
Branch always  
pc ( pc ) + rel  
Branch if overflow bit clear  
if (V) = 0 , then pc ( pc) + rel  
2/4  
Branch if overflow bit set  
if (V) = 1 , then pc ( pc ) + rel  
13  
14  
15  
BVS rel  
B0  
3B  
5F  
2
3
2
2/4  
8
CALL !abs  
CALL [dp]  
Subroutine call  
M( sp)( pc ), spsp - 1, M(sp)(pc ), sp sp - 1,  
H
L
8
--------  
--------  
if !abs, pcabs ; if [dp], pc ( dp ), pc ( dp+1 ) .  
L
Compare and branch if not equal :  
if ( A ) ( M ) , then pc ( pc ) + rel.  
Decrement and branch if not equal :  
if ( M ) 0 , then pc ( pc ) + rel.  
Unconditional jump  
H
16  
17  
18  
19  
20  
21  
22  
CBNE dp,rel  
CBNE dp+X,rel  
DBNE dp,rel  
DBNE Y,rel  
JMP !abs  
FD  
8D  
AC  
7B  
1B  
1F  
3F  
3
3
3
2
3
3
2
5/7  
6/8  
5/7  
4/6  
3
--------  
--------  
JMP [!abs]  
JMP [dp]  
5
pc jump address  
4
U-page call  
M(sp) ( pc ), sp sp - 1, M(sp) ( pc ),  
23  
24  
PCALL upage  
TCALL n  
4F  
nA  
2
1
6
8
--------  
--------  
H
L
sp sp - 1, pc ( upage ), pc ”0FF ” .  
L
H
H
Table call : (sp) ( pc ), sp sp - 1,  
H
M(sp) ( pc ),sp sp - 1,  
L
pc (Table vector L), pc (Table vector H)  
L
H
JUNE. 2001  
ix  
GMS800 Series  
Control Operation & Etc.  
Op  
Code  
Byte  
No  
Cycle  
No  
Flag  
NVGBHIZC  
No.  
1
Mnemonic  
Operation  
Software interrupt : B ”1”, M(sp) (pc ), sp sp-1,  
M(s) (pc ), sp sp - 1, M(sp) (PSW), sp sp -1,  
H
BRK  
0F  
1
8
---1-0--  
L
pc ( 0FFDE ) , pc ( 0FFDF ) .  
L
H
H
H
2
3
DI  
EI  
60  
E0  
FF  
0D  
2D  
4D  
6D  
0E  
2E  
4E  
6E  
1
1
1
1
1
1
1
1
1
1
1
3
3
2
4
4
4
4
4
4
4
4
Disable all interrupts : I “0”  
Enable all interrupt : I “1”  
No operation  
-----0--  
-----1--  
--------  
4
NOP  
5
POP A  
sp sp + 1, A M( sp )  
sp sp + 1, X M( sp )  
sp sp + 1, Y M( sp )  
sp sp + 1, PSW M( sp )  
M( sp ) A , sp sp - 1  
M( sp ) X , sp sp - 1  
M( sp ) Y , sp sp - 1  
M( sp ) PSW , sp sp - 1  
Return from subroutine  
6
POP X  
--------  
restored  
--------  
7
POP Y  
8
POP PSW  
PUSH A  
PUSH X  
PUSH Y  
PUSH PSW  
9
10  
11  
12  
13  
RET  
6F  
1
5
--------  
sp sp +1, pc M( sp ), sp sp +1, pc M( sp )  
L
H
Return from interrupt  
sp sp +1, PSW M( sp ), sp sp + 1,  
14  
15  
RETI  
7F  
1
1
6
3
restored  
--------  
pc M( sp ), sp sp + 1, pc M( sp )  
L
H
STOP  
EF  
Stop mode ( halt CPU, stop oscillator )  
x
JUNE. 2001  
C. MASK ORDER SHEET  
MASK ORDER & VERIFICATION SHEET  
GMS81C21XX-HJ  
Customer should write inside thick line box.  
2. Device Information  
Package 42SDIP  
1. Customer Information  
Company Name  
44MQFP  
Hitel  
40PDIP  
Internet  
File Name  
ROM Size (bytes)  
Chollian  
) .OTP  
Application  
YYYY  
(
MM  
DD  
Order Date  
12K  
20K  
Tel:  
Fax:  
Check Sum  
(
)
E-mail address:  
(20K)  
(12K)  
3000H  
5000H  
Name &  
Signature:  
.OTP file  
Set “00 ” in blanked area  
H
7FFFH  
(Please check markinto  
)
3. Marking Specification  
12 or 20  
Customer’s logo  
GMS81C21XX-HJ  
YYWW  
GMS81C21XX-HJ  
YYWW  
KOREA  
KOREA  
Customer logo is not required.  
If the customer logo must be used in the special mark, please submit a clean original of the logo.  
Customers part number  
4. Delivery Schedule  
Date  
Quantity  
HYNIX Confirmation  
YYYY  
YYYY  
MM  
MM  
DD  
DD  
Customer sample  
Risk order  
pcs  
pcs  
5. ROM Code Verification  
Please confirm out verification data.  
YYYY  
YYYY  
MM  
DD  
MM  
DD  
Approval date:  
Verification date:  
I agree with your verification data and confirm you to  
make mask set.  
Check sum:  
Tel:  
Fax:  
Tel:  
Fax:  
E-mail address:  
E-mail address:  
Name &  
Signature:  
Name &  
Signature:  
GMS81C21XX MASK OPTION LIST  
Customer should write inside thick line box.  
1. RA/Vdisp  
RA without pull-down resistor  
Vdisp  
(Please check markinto  
)
2. CONFIG OPTION Check  
CONFIG Default Value : XX00X0X0  
X
X
X
X
7
6
5
4
3
2
1
0
ADDRESS: 703FH  
INITIAL VALUE: --00 -0-0B  
PFS1 PFS0  
LOCK  
RCO  
CONFIG  
External RC OSC Selection  
0: Crystal or Resonator Oscillator  
1: External RC Oscillator  
PFD Level Selection  
00: PFD = 2.7V  
01: PFD = 2.7V  
Code Protect  
0 : Allow Code Read Out  
1 : Lock Code Read Out  
10: PFD = 3.0V  
11: PFD = 2.4V  
3. H/V Port OPTION Check (Pull-down Option Check )  
Option  
Option  
Option  
ON OFF  
Port  
Port  
Port  
ON OFF  
ON OFF  
R00/INT0  
R01/INT1  
R02/EC0  
R03/BUZO  
R04  
R20  
R21  
R22  
R23  
R24  
R25  
R26  
R27  
R30  
R31  
R32  
R33  
R34  
R05  
R06  
ON : with pull-down resistor  
OFF : without pull-down resistor  
R07  
4. Normal Port OPTION Check ( Pull-up Option Check )  
Option  
Option  
Port  
Port  
ON OFF  
O N OFF  
R60/AN0  
R61/AN1  
R62/AN2  
R63/AN3  
R64/AN4  
R65/AN5  
R66/AN6  
R67/AN7  
R53/SCLK  
R 54/SIN  
R 55/SO UT  
R 56/PW M  
R 57  
ON : with pull-up resistor  
OFF : without pull-up resistor  
 复制成功!