Published by
MCU Application Team in HYUNDAI ELCETRONICS Co., Ltd.
¨Ï
HYUNDAI ELECTRONICS Co., Ltd. 1998 All Right Reserved.
Additional information of this manual may be served by HYUNDAI ELECTIONICS Offices in Korea or
Distributors and Representative listed at address directory.
HYUNDAI ELECTIONICS reserves the right to make changes to any Information here in at any time
without notice.
The information, diagrams, and other data in this manual are correct and reliable; however, HYUNDAI
ELECTIONICS Co., Ltd. is in no way responsible for any violations of patents or other rights of the
third party generated by the use of this manual.
The GMS810 Series is the high speed and Low voltage operating 8-bit single chip
microcomputers. This MCU contains G8MC core, ROM, RAM, input/output ports and five
multi-function timer/counters.
tcpnsXin250500 10001
tsys
tcpH
tcpL
trcp
tfcp
tIH
tIL
tRSTL
tECH
tECL
trEC
tfEC
Xin
Xin
Xin
Xin
INT1~INT2
INT1~INT2
RESET
EC
EC
EC
EC
Specification
mintypmax
500 1000 2000
40
40
40
40
2
2
8
2
2
40
40
ns
ns
ns
ns
ns
tsys
tsys
tsys
tsys
tsys
ns
ns
1 - 16
Page 22
Chapter 1. Overview
Xin
INT1
INT2
RESET
EC
trCP
0.8Vcc
tfEC
tCPH
tfCP
tRSTL
tCP
tIH
tECHtECL
0.8Vcc0.8Vcc
trEC
tCPL
Vcc-0.5V
0.5V
tIL
0.2Vcc
0.2Vcc
0.2Vcc
* FIG-1 : Clock, INT, RESET. EC input timing
1 - 17
Page 23
OVERVIEW1
FUNCTION DESCRIPTION2
I/O PORT3
PERIPHERAL HARDWARE4
INTERRUPT5
STANDBY FUNCTION6
RESET FUNCTION7
APPENDIX A.8
APPENDIX B.9
Page 24
CHAPTER 2. FUNCTION DESCRIPTION
2.1 REGISTERS
1570
Chapter 2. Function Description
PCHPCL
70
A
1570
70
70
70
70
NVGBHIZC
¡é
X
Y
SP
PSW
Program Counter
A-Register
YA (16bit Accumulator)
X-Register
Y-Register
Stack Pointer ¡Ø1
Program Status Word
¡é
Carry Flag
Zero Flag
Interrupt Enable Flag
Half Carry Flag
Break Flag
G Flag
Overflow Flag
Negative Flag
¡Ø
1 Stack Address
1570
PCHPCL
¡é
Fixed as 01XXh (=RAM 1page)
¡é
SP
2 - 1
Page 25
Chapter 2. Function Description
2.1.1 A register
- 8bit Accumulator.
- In the case of 16-bit operation, compose the lower 8-bit of A, upper 8bit in Y (16-bit
Accumulator)
- In the case of multiplication instruction, execute as a multiplier register. After
multiplication operation, the lower 8-bit of the result enters. (Y*A ¡æ YA)
- In the case of division instruction, execute as the lower 8-bit of dividend. After
division operation, quotient enters.
2.1.2 X register
- General-purpose 8-bit register
- In the case of index addressing mode within direct page(RAM area), execute as
index register.
- In the case of division instruction, execute as register.
2.1.3 Y register
- General-purpose 8-bit register
- In the case of index addressing mode, execute as index register
- In the case of 16-bit operation instruction, execute as the upper 8-bit of YA (16-bit
accumulator).
- In the case of multiplication instruction, execute as a multiplicand register. After
multiplication operation, the upper 8-bit of the result enters.
- In the case of division instruction, execute as the upper 8-bit of dividend. After
division operation, remains enters.
- Can be used as loop counter of conditional branch command. (e.g.DBNE Y, rel)
2.1.4 Stack Pointer
- In the cases of subroutine call, Interrupt and PUSH, POP, RETI, RET instruction,
stack data on RAM or in the case of returning, assign the storage location having
stacked data.
- Stack area is constrained within 1-page (00H-FFH). The SP is post-decremented
when a subroutine call or a push instruction is executed, or when an interrupt is
accepted; and the SP is pre-incremented when a return or a pop instruction is
executed.
- SP should be initialized as follows
ex) LDX #0FEH: 0FEH ¡æ X reg.
TXSP: X reg. ¡æ SP
- The behaviors of stack pointer according to each instruction are the following.
2 - 2
Page 26
2.1.4.1 Interrupt
Chapter 2. Function Description
M(SP) ¡ç (PCH)
SP ¡ç SP - 1
2.1.4.2 RETI( Return from interrupt )
SP ¡ç SP + 1
(PSW) ¡ç M(SP)
2.1.4.3 Subroutine call
M(SP) ¡ç (PCH)
SP ¡ç SP - 1
M(SP) ¡ç (PCL)
SP ¡ç SP - 1
SP ¡ç SP + 1
(PCL) ¡ç M(SP)
M(SP) ¡ç (PCL)
SP ¡ç SP - 1
M(SP) ¡ç (PSW)
SP ¡ç SP - 1
SP ¡ç SP + 1
(PCH) ¡ç M(SP)
2.1.4.4 RET(Return from subroutine)
SP ¡ç SP + 1
(PCL) ¡ç M(SP)
SP ¡ç SP + 1
(PCH) ¡ç M(SP)
2 - 3
Page 27
Chapter 2. Function Description
2.1.4.5 PUSH A(X, Y, PSW)
M(SP) ¡ç A
SP ¡ç SP - 1
2.1.4.6 POP A(X, Y, PSW)
SP ¡ç SP + 1
A ¡ç M(SP)
2.1.5 PC (Program Counter)
- Program counter is a 16-bit counter consisted of 8-bit register PCH and PCL.
- Addressing space is 64K bytes.
2.1.6 PSW (Program Status Word)
- PSW is an 8-bit register.
- Consisted of the flags showing the post state of operation and the flags determining
the CPU operation, initialized as 00H in reset state.
2.1.7 Flag register.
2.1.7.1 Carry flag (C)
- After operation, set when there is a carry from bit7 of ALU or there is not a borrow.
- Set by SETC and clear by CLRC.
- Executable as 1-bit accumulator.
- Branch condition flag of BCS, BCC.
2.1.7.2 Zero flag (Z)
- After operation also including 16-bit operatiion, set if the result is ¡È0
¡È
- Branch condition flag of BEQ, BNE.
2.1.7.3 Interrupt enable flag (I)
- Master enable flag of interrupt except for RST (reset).
- Set and cleared by EI, DI
2 - 4
Page 28
Chapter 2. Function Description
2.1.7.4 Half carry flag (H)
- After operation, set when there is a carry from bit3 of ALU or there is not a borrow
from bit4 of ALU.
- Can not be set by any instruction.
- Cleared by CLRV instruction like V flag.
2.1.7.5 Break flag (B)
- Set by BRK (S/W interrupt) instruction to distinguish BRK and TCALL instruction
having the same vector address.
2.1.7.6 G flag (G)
- Set and cleared by SETG, CLRG instruction.
- Assign direct page (0-page, 1-page).
- Addressable directly to RAM 1-page by SETG. and to RAM 0-page by CLRG.
2.1.7.7 Overflow flag (V)
- After operation, set when overflow or underflow occurs.
- In the case of BIT instruction, bit6 memory location is transferred to V-flag.
- Cleared by CLRV instruction, but not set by any instruction.
- Branch condition flag of BVS, BVC.
2.1.7.8 Negative flag (N)
- Set whenever the result of a data transfer or operation is negative (bit7 is set to
¡È1¡È
).
- In the case of BIT instruction, bit7 of memory location is transferred to N-flag
- N-flag is not affected by CLR or SET instruction.
* This vector area is used in BRK command and TCALL0 command.
2 - 7
Page 31
Chapter 2. Function Description
2.4 ZERO-PAGE PERIPHERAL REGISTERS
ADDRESS
FUNCTION REGISTERS
R/W
SYMBOL
7 6 5 4 3 2 1 0
RESET VALUE
00C0H
00C1HPORT R0 DATA DIRECTION REG.WR0DD00
00C2HPORT R1 DATA REG.R/WR1Undefined
00C3HPORT R1 DATA DIRECTION REG.WR1DD00
00C4HPORT R2 DATA REG.R/WR2Undefined
00C5HPORT R2 DATA DIRECTION REG.WR2DD00
00C6HReserved
CLOCK CONTROL REG.WCKCTLR
BASIC INTERVAL REG.RBITRUndefined
TIMER0 LOW-MSB DATA REG.WT0LMDUndefined
TIMER0 LOW-MSB COUNT REG.RUndefined
TIMER0 LOW-LSB DATA REG.WT0LLDUndefined
TIMER0 LOW-LSB COUNT REG.RUndefined
TIMER1 LOW DATA REG.WT1LDUndefined
TIMER1 LOW COUNT REG.RUndefined
TIMER2 DATA REG.WT2DRUndefined
TIMER2 COUNT REG.RUndefined
R/W
R0
Undefined
- - 1 1 0 1 1 1
- 0 0 0 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 -
- ; Not used
* Caution : Write only register can not be accessed by bit manipulation instruction.
: Do not access the Reserved registers .
2 - 8
Page 32
OVERVIEW1
FUNCTION DESCRIPTION2
I/O PORT3
PERIPHERAL HARDWARE4
INTERRUPT5
STANDBY FUNCTION6
RESET FUNCTION7
APPENDIX A.8
APPENDIX B.9
Page 33
Chapter 3. I/O PORT
CHAPTER 3. I/O PORTS
The GMS810series has 21 I/O ports which are PORT0(8 I/O), PORT1 (8 I/O) and
PORT2 (8 I/O). Each port contains data direction register which controls I/O and data
register which stores port data.
3.1 PORT R0
3.1.1 PORT R0 Registers
REGISTER
R0 I/O Data Direction Register
R0 Data RegisterR0R/WUndefined00C0H
SYMBOLR/WRESET VALUEADDRESS
R0DDW00H00C1H
Table 3.1 Port R0 Registers
3.1.2 I/O Data Direction Register (R0DD)
bit
initial value
R/W
7
R0DD7R0DD6R0DD5R0DD4R0DD3R0DD2R0DD1R0DD0
0
W
6
0
W
5
0
W
4
0
W
3
0
W
2
0
W
1
0
W
0
<00C1H>R0DD
0
W
R0 I/O Data Direction Register(R0DD) is 8-bit register, and can assign input state or
output state to each bit. If R0DD is ¡È1¡È, port R0 is in the output state, and if ¡È0¡È, it is
in the input state. R0DD is write-only register. Since R0DD is initialized as ¡È00H¡È in
reset state, the whole port R0 becomes input state.
3.1.1 Data Register(R0)
bit
initial value
R/W
7
R07R06R05R04R03R02R01R00
X
R/W
6
X
R/W
5
X
R/W
4
X
R/W
3
X
R/W
2
X
R/W
1
X
R/W
0
<00C0H>R0
X
R/W
PORT0 data register (R0) is 8-bit register to store data of port R0.
When setted as the output state by R0DD, and data is written in R0, data is outputted
into R0 pin. When set as the input state, input state of pin is read.
The initial value of R0 is unknown in reset state.
R1 Data Direction Register(R1DD) is 8-bit register, and can assign input state or output
state to each bit. If R1DD is ¡È1¡È, port R1 is in the output state, and if ¡È0¡È, it is in the
input state. R1DD is write-only register. Since R1DD is initialized as ¡È00H¡È in reset
state, the whole port R1 becomes input state.
3 - 2
Page 35
Chapter 3. I/O PORT
3.2.3 Data Register(R1)
R1 Data Register(R1) is 8-bit register to store data of port R1. When set as the output
state by R1DD, and data is written in R1, data is output into R1 pin.
The initial value of R1 is unknown in reset state.
bit
7
6
5
4
3
2
1
0
initial value
R/W
R17R16R15R14R13R12R11R10
X
R/W
X
R/W
X
R/W
X
R/W
X
R/W
X
R/W
X
R/W
R/W
<00C2H>R1
X
3.2.4 Port R1 Open drain Assign Register (R1ODC)
bit
initial value
R/W
7
R17ODR16ODR15ODR14ODR13ODR12ODR11ODR10OD
0
W
6
0
W
5
0
W
4
0
W
3
0
W
2
0
W
1
0
W
0
<00DEH>R1ODC
0
W
Port R1 Open Drain Assign Register(R1ODC) is 8bit register, and can assign R1 port as
open drain output port each bit, if corresponding port is selected as output. If R1ODC is
selected as ¡È1¡È, port R1 is open drain output, and if selected as¡È0¡È, it is push-pull
output. R1ODC is write-only register and initialized as ¡È00H¡È in reset state.
3 - 3
Page 36
Chapter 3. I/O PORT
3.2.5 Port R1 Mode Register (PMR1)
bit
7
6
5
4
3
2
1
0
initial value
R/W
T0ST1ST2SECS-INT2SINT1S-
0
W
0
W
0
W
0
W
0
W
0
W
0
W
<00C9H>PMR1
0
W
R1 Port Mode Register(PMR1) is 8-bit register, and can assign the selection mode for
each bit. When set as¡È0¡È, corresponding bit of PMR1 acts as port R1 selection mode,
and when set as¡È1¡È, it becomes function selection mode.
BIT NAME
T0S
T1S
T2S
ECS
-
INT2S
INT1S
-
PMR1Selection ModeRemarks
0
1
0
1
0
1
0
1
0
1
0
1
0
1
R17 Sel(I/O)
T0 Sel (Output)
R16 Sel (I/O)
T1 Sel (Output)
R15 Sel (I/O)
T2 Sel (Output)
R14 Sel (I/O)
EC Sel (Input)
R12 sel (I/O)
INT2 Sel (Input)
R11 Sel (I/O)
INT1 Sel (Input)
Output Port of Timer0
Output Port of Timer1
Output Port of Timer2
Input Port of Timer0 Event Input
Input Port of Timer0 Input capture
-
-
Table 3.3 Selection Mode of PMR1
PMR1 is write-only register and initialized as ¡È 00H¡È in reset state. Therefore,
becomes Port selection mode. Port R1 can be I/O port by manipulating each R1DD bit,
if corresponding PMR1 bit is selected as ¡È0¡È.
3 - 4
Page 37
3.3 PORT R2
3.3.1 PORT R2 Registers
Chapter 3. I/O PORT
REGISTERS
R2 I/O Data Direction Register
R2 Data RegisterR2R/WUndefined00C4H
SYMBOLR/WRESET VALUEADDRESS
R2DDW00H00C5H
Table 3.3 Port R2 Registers
3.3.2 I/O Data Direction Register (R2DD)
bit
initial value
R/W
7
R2DD7R2DD6R2DD5R2DD4R2DD3R2DD2R2DD1R2DD0
0
W
6
0
W
5
0
W
4
0
W
3
0
W
2
0
W
1
0
W
0
<00C5H>R2DD
0
W
R2 Data Direction Register(R2DD) is 8-bit register, and can assign input state or output
state or output state to each bit. If R2DD is ¡È1¡È, port R2 is in the output state, and if
¡È0¡È
, it is in the input state.
R2DD is write-only register. Since R2DD is initialized as ¡È00H¡È in reset state, the
whole port R2 becomes input state.
3.3.3 Data Register (R2)
bit
initial value
R/W
7
R27R26R25R24R23R22R21R20
X
R/W
6
X
R/W
5
X
R/W
4
X
R/W
3
X
R/W
2
X
R/W
1
X
R/W
0
<00C4H>R2
X
R/W
R2 Data Register(R2) is 8-bit register to store data of port R2.
When setted as the output state by R2DD, and data is written in R2, data is output into
R2 pin. When setted as input state, input state of pin is read.
The initial value of R2 is unknown in reset state.
3 - 5
Page 38
OVERVIEW1
FUNCTION DESCRIPTION2
I/O PORT3
PERIPHERAL HARDWARE4
INTERRUPT5
STANDBY FUNCTION6
RESET FUNCTION7
APPENDIX A.8
APPENDIX B.9
Page 39
Chapter 4. Peripheral Hardware
CHAPTER 4. PERIPHERAL HARDWARE
4.1 CLOCK GENERATING CIRCUIT
Clock generating circuit consists of Clock Pulse Generator(C.P.G), Prescaler, Basic
Interval Timer(B.I.T) and Watch Dog Timer.
The clock applied to the Xin pin divided by two is used as the internal system clock.
Circuit
PRESCALER
8
Peripheral
CKCTLR
OSC
ENPCK
0 1 2 3 4
C.P.G
PS1
MUX
BTCL
3
5
fcpufex
B.I.T (8)
Internal Data Bus
COMPARATOR
WDTON
0
WDT (6)
6
WDTR
Fig. 4.1 Block diagram of clock generating circuit
Internal System Clock
IFBIT
5070
WDTCL
9
IFWDT
5 6
To Reset
6
Circuit
4 - 1
Page 40
Chapter 4. Peripheral Hardware
4.1.1 Oscillation Circuit
Oscillation circuit is designed to be used either with a ceramic resonator or crystal
oscillator. Fig. 4.2-(a) shows circuit diagrams using a crystal (or ceramic) oscillator.
As shown in the diagram, oscillation circuits can be constructed by connecting a
oscillator between Xout and Xin. Clock from oscillation circuit makes CPU clock via
clock pulse generator, and then enters prescaler to make peripheral hardware clock.
alternately, the oscillator may be driven from an external source as shown is Fig. 4.2.(b). In the Standby(STOP) mode, oscillatiion stop, Xout state goes to ¡ÈHIGH¡È, Xin
state goes to ¡ÈLOW¡È, and built-in feed back resistor is disabled.
(a) External Crystal (Ceramic) oscillator circuit
Cout
Xout
Xin
Cin
(b) External clock input circuit
Xout
Xin
External clock
Fig. 4.2 Oscillator configurations
*. Recommendable resonator
FrequencyResonator MakerPart NameLoad Capacitor Operating Voltage
CQ
4.0MHz
¡Ø
MC type is building in load capacitior.CCR type is chip type.
Prescaler consists of 12-bit binary counter. The clock supplied from oscillation circuit is
input to prescaler (fex). The divided output from each bit of prescaler is provided to
peripheral hardware.
4.1.3 Peripheral hardware clock control
Clock to peripheral hardware can be stopped by bit4 (ENPCK) of CKCTLR Register.
ENPCK is set to ¡È1¡È in reset state.
- Use the bit output of prescaler as input to secure the oscillation stabilization time
after power-on
- Secures the oscillation stabilization time in standby mode (stop mode) release
- Contents of B.I.T can be read
- Provides the clock for watch dog timer.
DATA BUS
--WTONENPCKBTCLBTS2BTS1BTS0
CKCTLR
PS3
PS4
PS5
PS6
PS7
PS8
PS9
PS10
MUX
BIT0BIT1BIT2BIT3BIT4BIT5BIT6BIT7
Fig. 4.4 Block diagram of Basic Interval Timer
4 - 4
BITR
IFBIT
DATA BUS
Page 43
Chapter 4. Peripheral Hardware
4.1.4.1 Control of B.I.T
If bit3(BTCL) of CKCTLR is set to ¡È1¡È, B.I.T is cleared, and then, after one machine
cycle, BTCL becomes ¡È0¡È, and B.I.T starts counting. BTCL is set to ¡È0¡È in reset
state.
Clock Control Register
70
CKCTLRW <00C7H>
--WDTONENPCKBTCLBTS2BTS1BTS0
BTCL
0
1
B.I.T Operation
free-run
Automatically cleared, after one cycle
4.1.4.2 Input Clock Selection of Basic Interval Timer
The input clock of B.I.T can be selected from the prescaler within a range of 2us to
256us by clock input selection bits(BTS2~BTS0). (at fex = 4MHz).
In reset state, or power on reset, BTS2=1, BTS1=1, BTS0=1 to secure the longest
oscillation stabilization time.
B.I.T can generate the wide range of basic interval time interrupt request(IFBIT) by
selecting prescaler output.
Interrupt interval can be selected to 8 kinds of interval time as shown in Table. 4.1.
4 - 5
Page 44
Chapter 4. Peripheral Hardware
70
CKCTLRW <00C7H>
--WDTONENPCKBTCLBTS2BTS1BTS0
BTS2
BTS1
0
0
0
0
1
1
1
1
BTS0
0
0
1
1
0
0
1
1
B.I.T. Input clock
0
1
0
1
0
1
0
1
PS3 (2us)
PS4 (4us)
PS5 (8us)
PS6 (16us)
PS7 (32us)
PS8 (64us)
PS9 (128us)
PS10 (256us)
Standby release time
512 us
1,024 us
2,048 us
4,096 us
8,192 us
16,384 us
32,768 us
65,536 us
Table 4.1 Standby release time according to BTS
4.1.4.3 Reading Basic Interval Timer
By reading of the Basic Interval Timer Register(BITR), we can read counter value of
B.I.T. Because B.I.T can be cleared or read, the spending time up to maximum 65.5ms
can be available. B.I.T is read-only register. If B.I.T register is written, then CKCTLR
register with same address is written.
Basic Interval Timer Register
70
BITRR <00C7H>
BIT7BIT6BIT5BIT4BIT3BIT2BIT1BIT0
4 - 6
Page 45
Chapter 4. Peripheral Hardware
4.1.5 Watch Dog Timer
Watch Dog Timer(WDT) consists of 6-bit binary counter, 6-bit comparator, and Watch
Dog Timer Register (WDTR).
IFBIT
05
WDT0WDT1WDT2WDT3WDT4WDT5
CLR WDTON
To Reset circuit
6BIT COMPARATOR
IF WDT
06
WDTR
WDTR0WDTR1WDTR2WDTR3WDTR4WDTR5WDTCL
W <00C8H>
Internal Data Bus
Fig. 4.5 Block diagram of Watch Dog Timer
4.1.5.1 Control of WDT
Watch Dog Timer can be used 6-bit general Timer or specific Watch dog timer by setting
bit5(WDTON) of Clock Control Register(CKCTLR).
Clock Control Register
70
CKCTLRW <00C7H>
--WDTONENPCKBTCLBTS2BTS1BTS0
WDTON
0
1
Watch Dog Timer Function Control
6-bit Timer
Watch Dog Timer
4 - 7
Page 46
Chapter 4. Peripheral Hardware
By assigning bit6(WDTCL) of WDTR, 6-bit counter can be cleared
Watch Dog Timer Register
70
WDTRW <00C8H>
-WDTCLWDTR5WDTR4WDTR3WDTR2WDTR1WDTR0
Determine Interval of IFWDT
Interval of IFWDT = Value of WDTR ¡¿ Interval of IFBIT
WDTCL
0
1
Watch Dog Timer Operation
Free-run
Automatically cleared, after one machine cycle
(Caution) : after WDTCL = 1, timer maximum error is one cycle of IFBIT.
4.1.5.2 WDT Interrupt Interval
WDT Interrupt(IFWDT) interval is determined by the interrupt IFBIT interval of Basic
Interval Timer and the value of WDT Register.
Interval of IFWDT = (IFBIT interval) * (WDTR value)
Interval of IFWDT : 512us ¡¿ 1 = 512us (MIN>)
: 65,536us ¡¿ 63 = 4,128,768us (MAX>)
As IFBIT (Basic Interval Timer Interrupt Request) is used for input clock of WDT, Input
clock cycle is possible from 512us to 65,536us by BTS. (at fex = 4MHz)
*At Hardware reset time ,WDT starts automatically.Therefore, the user must select
the CKCTLR,WDTR before WDT overflow.
( Reset WDTR value = 0Fh,15
interval of WDT = 65,536 ¡¿ 15 = 983040 uS (about 1second ) )
4 - 8
Page 47
Chapter 4. Peripheral Hardware
70
CKCTLRW <00C7H>
--WDTONENPCKBTCLBTS2BTS1BTS0
BTS2
0
0
0
0
1
1
1
1
BTS1
0
0
1
1
0
0
1
1
BTS0
0
1
0
1
0
1
0
1
Input clock of WDT
512 us
1,024 us
2,048 us
4,096 us
8,192 us
16,384 us
32,768 us
65,536 us
Max. Interval of WDT
output (*note1)
32,756 us
64,512 us
129,024 us
258,048 us
516,096 us
1,032,192 us
2,064,384 us
4,128,768 us
*note1) When WDTR Register value is 63(3FH)
Caution : Do not use ¡È0¡È for WDTR Register value.
Device come into the reset state by WDT
4 - 9
Page 48
Chapter 4. Peripheral Hardware
4.2 TIMER
4.2.1 Timer operation mode
Timer consists of 16bit binary counter Timer0(T0), 8bit binary Timer1(T1), Timer2(T2),
Timer Data Register, Timer Mode Register (TM01, TM0, TM1, TM2) and control circuit.
Timer Data Register Consists of Timer0 High-MSB Data Register(T0HMD), Timer0 HighLSB Data Register(T0HLD), Timer0 Low-MSB Data Register(T0LMD), Timer0 Low-LSB
Data Register(T0LLD), Timer1 High Data Register(T1HD), Timer1 Low Data
Register(T1LD), Timer2 Data Register(T2DR).
Any of the PS0~PS5, PS11 and external event input EC can be selected as clock source
for T0. Any of the PS0~PS3, PS7~PS10 can be selected as clock T1. Any of the
PS5~PS12 can be selected as clock source for T2.
- 16-bit Interval Timer
Timer0
Timer1
- 16-bit Event Counter
- 16-bit Input Capture
- 16-bit rectangular-wave output
- 8-bit Interval Timer
-8-bit rectangular-wave output
- Single/Modulo-N Mode
- Timer Output Initial Value Setting
- Timer0~Timer1 combination Logic Output
- One Interrupt Generating Every 2nd Counter Overflow
Timer2
- 8-bit Interval Timer
-8-bit rectangular-wave output
- Modulo-N Mode
*Relevant Port Mode Register (PMR1 : 00C9H) value should be assigned for event counter,
rectangular-wave output and input capture mode.
-FallingEdge Selection
Rising Edge Selection
Both Edge Selection
Page 59
Chapter 4. Peripheral Hardware
4.2.3 Timer0, Timer1
TIMER0 and TIMER1 have an up-counter. When value of the up-counter
reaches the content of Timer Data Register(TDR), the up-counter is cleared to
¡È
00H¡È, and interrupt(IFT0, IFT1) is occured at the next clock
Fig. 4. 10 Operatiion of Timer0
T0 Data
Registers
Value
T0 Value
0
ConcurrenceConcurrenceConcurrence
CLEARCLEARCLEAR
INTERRUPTINTERRUPTINTERRUPT
IFT0
Interval period
For Timer0, the internal clock(PS) and the external clock(EC) can be selected as
counter clock. But Timer1 and Timer2 use only internal clock. As internal clock.
Timer0 can be used as internal-timer which period is determined by Timer Data
Register(TDR). Chosen as external clock, Timer0 executes as event-counter.
The counter execution of Timer0 and Timer1 is controlled by T0CN, T0ST,
CAP0, T1CN, T1ST, of Timer Mode Register TM0 and TM1. T0CN, T1CN are
used to stop and start Timer0 and Timer1 without clearing the counter. T0ST,
T1ST is used to clear the counter. For clearing and starting the counter, T0ST
or T1ST should be temporarily set to ¡È0¡È and then set to ¡È1¡È. T0CN,
T1CN, T0ST and T1ST should be set ¡È1¡È, when Timer counting-up.
Controlling of CAP0 enables Timer0 as input capture. By programming of CAP0
to ¡È1¡È, the period of signal from INT2 can be measured and then, event
counter value for INT2 can be read.
4 - 21
Page 60
Chapter 4. Peripheral Hardware
T0 Data
Register
Value
T0 Value
Counter
0
IFT0
T0ST
T0CN
Concurrence
CLEAR
INTERRUPT
Count
Fig. 4. 11. Start/Stop operation of Timer0
01
StopClear
& Count
Clear & Start
01
StopCount
Concurrence
CLEAR
INTERRUPT
Clear & Start
continue
INT0
T3
T2
T1
T0
Fig. 4. 12. Input capture operation of Timer0
4 - 22
Page 61
Chapter 4. Peripheral Hardware
During counting-up, value of counter can be read. Timer execution is stopped by the
reset signal (RESET = ¡ÈL¡È)
(Note) in the process of reading 16-bit Timer Data, first read the upper 8-bit data. Then
read the lower 8-bit data, and read the upper 8-bit data again. If the earlier read upper
8-bit data are matched with the later read upper 8-bit data, read 16-bit data are correct.
If not, caution should be taken in the selection of upper 8-bit data.
Example)
1) Upper8-bitRead0A 0A
2) Lower8-bit ReadFF 01
3) Upper8-bitRead0B 0B
¡é ¡é
0AFF0B01
4.2.3.1 Single/Modulo-N Mode
Timer0 (Timer1) can select initial (T0INIT, T1INIT of TM0, TM1) output level of Timer
Output port. If initial level is ¡ÈL¡È, Low-Data Register value of Timer Data Register is
transferred to comparator and T0OUT(T1OUT) is to be ¡ÈLow¡È, if initial level is
¡È
High¡È, High -Data Register is transferred and to be ¡ÈHigh¡È. Single Mode can be
set by Mode Select bit(T0MOD, T1MOD) of Timer Mode Register (TM0, TM1) to ¡È1
¡È
When used as Single Mode, Timer counts up and compares with value of Data Register.
If the result is same, Time Out interrupt occurs and level of Timer Output port toggle,
then counter stops as reset state. When used as Modulo-N Mode, T0MOD(T1MOD)
should be set ¡È0¡È. Counter counts up until the value of Data Register and occurs
Time-out interrupt. The level of Timer Output port toggle and repeats process of
counting the value which is selected in Data Register. During Modulo-N Mode, If
interrupt select bit(T0IFS, T1IFS) of Mode Register is ¡È0¡È, Interrupt occurs on every
Time-out. If it is ¡È1¡È, Interrupt occurs every second time-out.
(*note. Timer Output is toggled whenever time out happen)
4 - 23
Page 62
Chapter 4. Peripheral Hardware
8bit / 16bit
counting
Timer Enable initial.
value toggle.
Timer Enable initial.
value toggle.
Timer-output toggle.
interrupt occurs.
count stop.
< Single Mode >
8bit / 16bit
counting
Timer-Output Toggle.
Int occurs(IFS = 1) Each 2nd time out.
Int occurs(IFS = 0) When Time out.
< Modulo-N Mode >
Fig. 4. 13 Operation Diagram for Single/Modulo-N Mode
4 - 24
Page 63
Chapter 4. Peripheral Hardware
4.2.4 Timer2
Timer2 operates as a up-counter. The content of T2DR are compared with the
contents of up-counter. If a match is found. Timer2 interrupt (IFT2) is generated
and the up-counter is cleared to ¡È00H¡È. Therefore, Timer2 executes as a
interval timer. Interrupt period is determined by the count source clock for the
Timer2 and content of T2DR.
When T2ST is set to 1, count value of Timer 2 is cleared and starts countingcup. For clearing and starting the Timer2. T2ST have to set to ¡È1¡È after set to
¡È0¡È
. In order to write a value directly into the T2DR, T2ST should be set to
¡È0¡È
. Count value of Timer2 can be read at any time.
T2 Data
Registers
Value
T2 Value
ConcurrenceConcurrenceConcurrence
0
INTERRUPTINTERRUPTINTERRUPT
IFT0
Interval period
Fig. 4. 14 Operation of Timer2
CLEARCLEARCLEAR
4 - 25
Page 64
Chapter 4. Peripheral Hardware
T2 Data
Register
Value
T2 Value
0
IFT2
T2ST
Counter
Concurrence
CLEAR
INTERRUPT
count stop by 0count start clear by 1
Count up
Count Stop
Concurrence
CLEAR
Count
continue
INTERRUPT
Count up after clear
Fig. 4. 15. Start/Stop of Timer2
4 - 26
Page 65
OVERVIEW1
FUNCTION DESCRIPTION2
I/O PORT3
PERIPHERAL HARDWARE4
INTERRUPT5
STANDBY FUNCTION6
RESET FUNCTION7
APPENDIX A.8
APPENDIX B.9
Page 66
Chapter 5. Interrupt
CHAPTER 5. INTERRUPT
The GMS810 Series contains 8 interrupt sources; 3 externals and 5 internals. Nested
interrupt services with priority control is also possible. Software interrupt is nonmaskable interrupt, the others are all maskable interrupts.
- Read and write of interrupt request flag are possible.
- In interrupt accept, request flag is automatically cleared.
Interrupt hardware consists of Interrupt Mode Register(MOD), Interrupt Enable Register
High (IENH), Interrupt Enable Register Low(IENL), Interrupt Request Register
High(IRQH), Interrupt Request Register Low(IRQL) and priority circuit. Interrupt function
block diagram is shown in Fig. 5.1
5.1 INTERRUPT SOURCE
Each interrupt vector is independent and has its own priority. Software interrupt(BRK) is
also available. Interrupt source classification is shown in Table 5.1
5 - 1
Page 67
Chapter 5. Interrupt
070707
- - - - ----- -
IENLIENHIMOD
Internal Data Bus
KSCN
INT1
INT2
IFT0
IFT1
IFT2
IFWDT
IFBIT
KSCNR
INT1R
INT2R
T0R
T1R
T2R
WDTR
BITR
IRQ
Hardware
Interrupt
Mask
Non-maskable
Maskable
PRIORITY
CONTROL
Fig. 5.1 Interrupt Source
Priority
-
0KSCNR (Key Scan)FFFBFFFA
1INT1R(External Interrupt 1)FFF9FFF8
2INT2R(External Interrupt 2)FFF7FFF6
3T0R (Timer0)FFF3FFF2
4T1R (Timer1)FFF1FFF0
Interrupt Source
RST (RESET PIN)
INT Vector H
FFFF
INT.
VECTOR
ADDR.
BRK
Standby Mode Release
INT Vector L
FFFE
Software
Interrupt
5T2R (Timer2)FFEFFFEE
6WDTR (Watch Dog Timer)FFE9FFE8
7BITR (Basic Interval Timer)FFE7FFE6
--BRK InstructionFFDFFFDE
Table 5.1 Interrupt Source
5 - 2
Page 68
Chapter 5. Interrupt
5.2 INTERRUPT CONTROL REGISTER
I flag of PSW is a interrupt mask enable flag. When I flag = ¡È0¡È, all interrupts become
disable. When I flag = ¡È1¡È, interrupts can be selectively enabled and disabled by
contents of corresponding Interrupt Enable Register.
When interrupt is occured, interrupt request flag is set, and Interrupt request is detected
at the edge of interrupt signal. The accepted interrupt request flag is automatically
cleared during interrupt cycle process. The interrupt request flag maintains ¡È1¡È until
the interrupt is accepted or is cleared in program.
In reset state, interrupt request flag register(IRQH, IRQL) is cleared to ¡È0¡È. It is
possible to read the state of interrupt register and to mainpulate the contents of register
and to generate interrupt. (Refer to software interrupt).
70
IENLR/W <00CCH>
IENHR/W <00CEH>
IRQLR/W <00CDH>
IRQHR/W <00CFH>
-WDTRBITE-----
70
KSCNEINT1EINT2E-T0ET1ET2E-
70
-WDTRBITE-----
70
KSCNRINT1RINT2R-T0RT1RT2R-
Interrupt Enable Register Low
Interrupt Enable Register High
Interrupt Request Register Low
Interrupt Request Register High
5 - 3
Page 69
Chapter 5. Interrupt
5.3 INTERRUPT ACCEPT MODE
The interrupt priority order is determined by bit(IM1, IM0) of IMOD register.
Interrupt Mode Register
70
IMODR/W <00CAH>
--IM1IM0IP3IP2IP1IP0
Assigning by interrupt accept mode bit
IM1IM0Priority
00Fixed by H/W
01Changeable by IP 3-0
1*Interrupt is inhibited
5.3.1 Selection of interrupt by IP3 - IP0
The condition allow for accepting interrupt is set state of the interrupt mask enable flag
and the interrupt enable bit must be ¡È1¡È.
*In Reset state, these IP3 - IP0 registers become all ¡È0¡È.
5 - 4
Page 70
5.3.2 Interrupt Timing
Chapter 5. Interrupt
CLOCK
SYNC
A command before interruptinterrupt process step
Interrupt Request Sampling
Fig. 5.2 Interrupt Enable Accept Timing
Interrupt Request
sampling time
Maximum 12 machine cycle (When execute DIV instruction)
Minimum 0 machine cycle
Interrupt preprocess step is 8 machine cycle
Maximum 1 + 12 + 8 = 21 machine cycle
Interrupt overhead
Minimum 1 + 0 + 8 = 9 machine cycle
5.3.3 The valid timing after executing Interrupt control instructions
I flag is valid just after executing of EI/DI on the contrary.
Interrupt Enable register is valid one instruction after controlling interrupt Enable
Register.
5 - 5
Page 71
Chapter 5. Interrupt
5.4 INTERRUPT PROCESSING SEQUENCE
When an interrupt is accepted, the on-going process is stopped and the interrupt service
routine is executed. After the interrupt service routine is completed it is necessary to
restore everything to the state before the interrupt occured.
As soon as an interrupt is accepted, the content of the program counter and PSW are
saved in the stack area.
At the same time, the content of the vector address corresponding to the accepted
interrupt, which is in the interrupt vector table, enters into the program counter and
interrupt service is executed. In order to execute the interrupt service routine, it is
necessary to write the jump addresses in the vector table (FFEOH-FFFFH)
corresponding to each interrupt
Interrupt Processing Step
1) Store upper byte of Program Counter, SP ¡ç SP
2) Store lower byte of Program Counter, SP ¡ç SP - 1
3) Store Program Status Word, SP ¡ç SP - 2
4) After resetting of I-flag, clear accepted Interrupt
Request Flag.(Set B-flag for BRK Instruction)
5) Call Interrupt service routine
5 - 6
Page 72
Clock
SYNC
R/W
Chapter 5. Interrupt
Interrupt Process StepISR
*1
INTERNAL
ADDR. BUS
INTERNAL
DATA BUS
INTERNAL
READ
INTERNAL
WRITE
PCSPSP-1SP-2LVA*2HVA*3NEW PC
OP
CODEOPCODE
PCHPCLPSW
¡ÈL¡È
VECTOR
¡ÈH¡È
VECTOR
Fig. 5. 3 Interrupt Procesing Step Timing
*1 ISR : Interrupt Service Routine
*2 LVA : Low Vector Address
*3 HVA : High Vector Address
5.1 SOFTWARE INTERRUPT
5.5.1 Interrupt by Break(BRK) Instruction
Software interrupt is available just by writing ¡ÈBreak(BRK)¡È instruction.
The values of PC and PSW is stacked by BRK instruction and then B flag of PSW is set
and I flag is reset.
Flag change by BRK execution
NVGBHIZC
setreset
NVG1H0ZC
(Right after BRK execution)
5 - 7
PSW
PSW
Page 73
Chapter 5. Interrupt
Interrupt vector of BRK instruction is shared by vector of Table Call(TCALL0). When
both instruction of BRK and TCALL0 are used, as shown in Fig. 5.4 each processing
routine is judged by contents of B flag.
There is no instruction to reset directly B flag.
0
BRK or
TCALL0
B flag
1
BRK INTERRUPT ROUTINETCALL0 ROUTINE
RETIRET
Fig. 5.4 Execution of BRK or TCALL0
5.6 MULTIPLE INTERRUPT
If there is an interrupt, Interrupt Mask Enable Flag is automatically cleared before
entering the Interrupt Service Routine. After then, no interrupt is accepted. If EI
instruction is executed, interrupt mask enable bit becomes ¡È1¡È, and each enable bit
can accept interrupt request. When two or more interrupts are generated
simultaneously, the highest priority interrupt set by Interrupt Mode Register is accepted.
5 - 8
Page 74
Chapter 5. Interrupt
5.7 Key Scan Input Processing
Key Scan Interrupt is generated by detecting low Input from each Input pin (R0, R1) or
standby(SLEEP, STOP) release signal. Key Scan ports are all 16bit which are
controlled by Stand-by Mode Release Register (SMRR0, SMRR1). Key Input is
considered as Interrupt, therefore, KSCNE bit of IEHN should be set for correct interrupt
executing, SLEEP mode and STOP mode, the rest of executing is the same as that of
external Interrupt. Each SMRR Register bit is allowed for each port(for Bit=0, no Key
Input, for Bit=1, Key Input available). At reset, SMRR becomes ¡È00H¡È. So, there is
no Key Input source.
70
SMRR0W <00DCH>
R00
R01
.
.
R07
70
R0 port
Selection Logic
Internal
Key Scan
Interrupt
W <00DDH>SMRR1
R10
R11
R17
.
.
R1 port
Selection Logic
<Key Scan Block>
5 - 9
Page 75
Chapter 5. Interrupt
SMRR0 Mode Register
70
SMRR0W <00DCH>
KR07KR06KR05KR04KR03KR02KR01KR00
KR00Key Input Selection
0
1
KR01Key Input Selection
0
1
KR02Key Input Selection
0
1
KR03Key Input Selection
0
1
KR04Key Input Selection
0
1
no select
select
no select
select
no select
select
no select
select
no select
select
5 - 10
KR05Key Input Selection
0
1
KR06Key Input Selection
0
1
KR07Key Input Selection
0
1
no select
select
no select
select
no select
select
Page 76
SMRR1 Mode Register
70
Chapter 5. Interrupt
SMRR1W <00DDH>
KR17KR16KR15KR14KR13KR12KR11KR10
KR10Key Input Selection
0
1
KR11Key Input Selection
0
1
KR12Key Input Selection
0
1
KR13Key Input Selection
0
1
KR14Key Input Selection
0
1
no select
select
no select
select
no select
select
no select
select
no select
select
5 - 11
KR15Key Input Selection
0
1
KR16Key Input Selection
0
1
KR17Key Input Selection
0
1
no select
select
no select
select
no select
select
Page 77
OVERVIEW1
FUNCTION DESCRIPTION2
I/O PORT3
PERIPHERAL HARDWARE4
INTERRUPT5
STANDBY FUNCTION6
RESET FUNCTION7
APPENDIX A.8
APPENDIX B.9
Page 78
Chapter6. Standby Function
CHAPTER 6. STANDBY FUNCTION
To save power consumption, there is STOP modes. In this modes, the execution of
program stops.
6.1 STOP MODE
STOP mode can be entered by STOP instruction during program. In STOP mode,
oscillator is stopped to make all clocks stop, which leads to less power consumption. All
registers and RAM data are preserved. ¡ÈNOP¡È instruction should be follows STOP
instruction for rising precharge time of Data Bus line.
ex) STOP : STOP instructiion excution
NOP : NOP instruction
6 - 1
Page 79
Chapter6. Standby Function
STOP
Control
Signal
OSC.
Circuit
S Q
R
Clock Pulse GEN
CLR
MUX
Prescaler
CLR
S Q
R
Release Signal From Interrupt Circuit
RESET
Fig. 6.1 Block Diagram of Standby Circuit
CPU Clock
Basic Interval Timer
CLR
Overflow Detection
B.I.T 7
ENPCK
Prescaler
Peripheral
PS10
Selector
Basic Interval Timer
Fig. 6.2 ENPCK and Basic Interval Timer Clock
6 - 2
Page 80
Chapter6. Standby Function
6.2 STANDBY MODE RELEASE
6.2.1 STOP Mode Release
Release of STANDBY mode is executed by RESET input and Interrupt signal. Register
value is defined when Reset. When there is a release signal of STOP mode (Interrupt,
RESET input), the instruction execution starts after stabilization oscillation time is set by
value of BTS2~BTS0 and set ENPCK to 1.
Table 6.1. Standby Mode Register
Release SignalSTOP
RESET0
KSCN (Key input)0
INT1 - INT20
Table 6.2 Standby Mode Release
Release FactorRelease Method
RESET PinBy RESET Pin = Low level, Standby mode is release and system is initialized
KSCN
(Key input)
INT 1 pin
INT 2 pin
Standby mode is released by Low input of selected pin by Key Scan Input
(SMRR0, SMRR1)
In case of interrupt Mask Enable flag = 0, program executes just after standby
instruction, if flag = 1, enters each interrupt service routine.
When external interrupt (INT1, INT2) enable flag is ¡È1¡È, standby mode is
released at the rising edge of each terminal.
When Standby mode is released at interrupt. Mask Enable flag = 0, program
executes from the next instruction of standby instruction.
When 1, enters each interrupt service routine.
6 - 3
Page 81
Chapter6. Standby Function
<STOP MODE>
CLCOK
STOP Mode
Release By Interrupt
Program Setting Time by CKCTLR
RESET
Stable
OSC. time
Refer to Table 4-1
Longer than stable OSC. Time
Fig. 6.3 Release Timing of Standby Mode
6.3 RELEASE OPERATION OF STANDBY MODE
After Standby mode is released, the operation begins according to content of
related interrupt register just before Standby mode start(Fig. 6.3)
6.3.1 In Case of Interrupt Enable Flag(I) of PSW = 0
Release by only interrupt which interrupt enable flag = 1, and starts to execute from next
to Standby instruction (STOP).
6 - 4
Page 82
Chapter6. Standby Function
6.3.2 In Case of Interrupt Enable Flag(I) of PSW = 1
Released by only interrupt which each interrupt enable flag = 1, and jump to the relevant
interrupt service routine.
Note) When STOP instruction is used, B.I.T should guarantee the stabilization oscillation
time. Thus, just before entering STOP mode, clock of bit10(PS10) of Prescaler is
selected or peripheral hardware clock control bit(ENPCK) to 1, Therefore the clock
necessary for stabilization oscillation time should be input into B.I.T. otherwise, Standby
mode is released by reset signal. In case of interrupt request flag and interrupt enable
flag are both ¡È1¡È, Standby mode is not entered.
Fig. 6.5 Standby Mode Release Flow
STOP Command
Standby Mode
Interrupt Request GEN.
IE Flag
1
Standby Mode Release
PSW
IE Flag
1
Interrupt Service Routine
0
0
Standby Next Command
Execution
6 - 5
Page 83
Chapter6. Standby Function
Internal circuitSTOP Mode
OscillatorStop
Internal CPU clockStop
RegisterRetained
I/O portRetained
PrescalerStop
Basic Interval TimerStop
Watch Dog TimerStop
Address Bus, Data BusRetained
Table 6.3 Operation State in Standby Mode
RAMRetained
TimerStop
6 - 6
Page 84
OVERVIEW1
FUNCTION DESCRIPTION2
I/O PORT3
PERIPHERAL HARDWARE4
INTERRUPT5
STANDBY FUNCTION6
RESET FUNCTION7
APPENDIX A.8
APPENDIX B.9
Page 85
Chapter7. Reset Function
CHAPTER 7. RESET FUNCTION
7.1 EXTERNAL RESET
The RESET pin should be held at low for at least 2machine cycles with the power supply
voltage within the operating voltage range and must be connected 0.1uF capacitor
for stable system initialization.
The RESET pin contains a Schmitt trigger with an internal pull-up resistor.
RESET
0.1uF capacitor
Fig 7.0 RESET Pin connection.
7.2 POWER ON RESET
Power On Reset circuit automatically detects the rise of power voltage (the rising time
should be within 50ms) the power voltage reaches a certain level, RESET terminal is
maintained at ¡ÈL¡È Level until a crystal ceramic oscillator oscillates stably. After power
applies and starting of oscillation, this reset state is maintained for about oscillation cycle of
219 (about 65.5ms : at 4MHz).
The execution of built-in Power On Reset circuit is as follows :
(1) Latch the pulse from Power On Detection Pulse Generator circuit, and reset
Prescaler, B.I.T and B.I.T Overflow detection circuit.
(2) Once B.I.T Overflow detection circuit is reset. Then, Prescaler starts to count.
(3) Prescaler output is inputted into B.I.T and PS10 of Prescaler output is automatically
selected. If overflow of B.I.T is detected, Overflow detection circuit is set.
(4) Reset circuit generates maximum period of reset pulse from Prescaler and B.I.T.
7 - 1
Page 86
Chapter7. Reset Function
Internal IC
RESET
0.1uF
XTALPS10MSB
OSC.
VDD
VSS
CLR
Prescaler
CLR
Basic Interval
Tiemr
Internal Reset
Power On DET
Pulse GEN.
CLR
Basic Interval
Tiemr
Fig. 7.1 Block Diagram of Power On Reset Circuit
Notice ; When Power On Reset, oscillator stabilization time doesn`t include OSC. Start time.
VDD
OSC. START TIMING
PRESCALER COUNT START
Fig. 7.2 Oscillator stabilization diagram
7 - 2
Page 87
RESET
INTERNAL
RESET
Chapter7. Reset Function
ADDR. BUS
INTERNAL
DATA BUS
SPSP-1SP-2FFFE FFFF NEW PC
FELSB
VECTOR
Fig. 7.3 Reset Timing by Diagram
MSB
VECTOR
7 - 3
Page 88
Chapter7. Reset Function
7.3 Low Voltage Detection Mode
7.3.1 Low voltage detection condition
An on board voltage comparator checks that VDD is at the required level to ensure
correct operation of the device. If VDD is below a certain level, Low voltage detector
forces the device into low voltage detection mode.
7.3.2 Low Voltage Detection Mode
There is no power consumption except stop current, stop mode release function is
disabled. All I/O port is configured as input mode and Data memory is retained until
voltage through external capacitor is worn out. In this mode, all port can be selected with
Pull-up resistor by Mask option. If there is no information on the Mask option sheet ,the
default pull up option (all port connect to pull-up resistor ) is selected.
7.3.3 Release of Low Voltage Detection Mode
Reset signal result from new battery(normally 3V) wakes the low voltage detection mode
and come into normal reset state. It depends on user whether to execute RAM clear
routine or not.
Low Voltage (V)
3.0
2.8
2.6
2.4
2.2
2.0
1.8
1.6
1.4
1.2
1.0
0.8
0.6
0.4
0.2
0.0
0¡É10¡É20¡É30¡É40¡É50¡É60¡É70¡É
Temperature(¡É)
Fig 7.5 Low Voltage vs Temperature
7 - 4
Page 89
* SRAM BACK-UP after Low Voltage Detection.
3.0V
about hours depend on Vcc-Gnd Capacitor
Chapter7. Reset Function
MCU OPR.
Voltage
1.8V(TYP)
( 20¡É)
Low Voltage Detection
point
0.7V(VRET)
0V
* SRAM Data Backup
* The operation after Low voltage detection
Interrupt : disable
User
Removes
Batteries
Stop release: disable
All I/O port: input Mode
Remout port: Low Level
OSC : STOP
All I/O port pull-up ON (Mask Option )
SRAM Data retention
* S/W flow chart example after Reset using SRAM Back-up
RESET
Stack Pointer initialize
Power On Reset
( SRAM retention)
Power On Reset
( SRAM unstable )
User
Replace
Batteries
Check the SRAM value
(RAM Pattern, Check sum..)
SRAM DATA IS VALID?
Y
Use saved SRAM
value
7 - 5
N
Clear All Ram area
Page 90
OVERVIEW1
FUNCTION DESCRIPTION2
I/O PORT3
PERIPHERAL HARDWARE4
INTERRUPT5
STANDBY FUNCTION6
RESET FUNCTION7
APPENDIX A.8
APPENDIX B.9
Page 91
APPENDIX A. INSTRUCTION SET TABLE
Appendix A. Instruction Set Table
No.MNEMONICOP CODE Words
1
ADC#imm
2
ADCdp
3
ADCdp+X
4
ADC!abs
5
ADC!abs+Y
6
ADC[dp+X]
7
ADC[dp]+Y
8
ADC{X}
9
AND#imm
10
ANDdp
11
ANDdp+X
12
AND!abs
13
AND!abs+Y
14
AND[dp+X]
15
AND[dp]+Y
16
AND{X}
17
ASLA
18
ASLdp
19
ASLdp+X
20
ASL!abs
21
BBCA.bit, rel
22
BBCdp.bit, rel
23
BBSA.bit, rel
24
BBSdp.bit, rel
25
BCCrel
26
BCSrel
27
BEQrel
28
BITdp
29
BIT!abs
30
BMIrel
31
BNErel
32
BPLrel
33
BRArel
34
BRK
35
BVCrel
36
BVSrel
37
CLR1dp.bit
38
CLRA1A.bit
39
CLRC
40
CLRG
41
CLRV
D0
F0
0C
1C
2F
0F
B0
2B
04
05
06
07
15
16
17
14
84
85
86
87
95
96
97
94
08
09
19
18
y2
y3
x2
x3
50
90
70
10
30
y1
20
40
80
2
2
2
3
3
2
2
1
2
2
2
3
3
2
2
1
1
2
2
3
2
3
2
3
2
2
2
2
3
2
2
2
2
1
2
2
2
2
1
1
1
Exec.
Cycle
2
3
4
4
5
6
6
3
2
3
4
4
5
6
6
3
2
4
5
5
4/6
5/7
4/6
5/7
2/4
2/4
2/4
4
5
2/4
2/4
2/4
4
8
2/4
2/4
4
2
2
2
2
OPERATION
A = A + op + C
¡È
¡È
¡È
¡È
¡È
¡È
¡È
A = A & op
¡È
¡È
¡È
¡È
¡È
¡È
¡È
op = op << 1
¡È
¡È
¡È
if (bit = 0)
then branch
if (bit = 1)
then branch
if (C=0) branch
if (C=1) branch
if (Z=1) branch
Z = A & op
¡È
if (N=1) branch
if (Z=0) branch
if (N=0) branch
Branch
S/W interrupt
if (V=0) branch
if (V=1) branch
op.bit = 0
¡È
C = 0
G = 0
V = 0
Flag
MVG HIZC
N V . . H . Z C
N V . . H . Z C
N V . . H . Z C
N V . . H . Z C
N V . . H . Z C
N V . . H . Z C
N V . . H . Z C
N V . . H . Z C
< NOTICE >
. *0 : is only available in Low Voltage detectionOption = Y (No . 3)
*1 : is not available for 20PIN & 24PIN. So, Default option is Pull-Up.
. *2 : is not available for 20PIN. So, Default Option is Pull-Up.
3. Low Voltage Detection
Y/N
GMS81024
GMS81032
R01yR02yR03yR04yR05yR06yR07
y
R11nR12*2nR13*2nR14*2nR15*2nR16
n
R21*1 R22*1 R23*1 R24*1
n
n
HYUNDAI ELCTRONICS Co., Ltd.
Please enter check marks as
n
Y : Yes
N : No
Date :
Company Name :
Section Name :
Signature :
MCU Application Team.
Y : Yes
N : No
y
Y : Yes
N : No
R17
n
S/W example Refer to Circuit B-1
B-1 ,Circuit Description:
device : GMS81016
package : 24PIN SOP
port R0x : All input port with pull-up resistor
port R1x : All output port with N-MOS
Open drain
port R20 : LED Drive port
; Example program for Port setting.
ORG 0C000H ; GMS81016 Program Start Address
Reset :
clrg ; Clear G-Flag
ldx #0feh ; Stack Pointer Initialize
txsp
DI ; Interrupt disable
ldm R2dd,#0001_1111b ; R2 direction setting,R20: Output
ldm R2,#1111_1111b ; R2 data setting , R20 : High,Led off
ldm R1odc,#1111_1111b ; R1 port all open drain
ldm R1dd,#1111_1111b ; R1 direction setting ,All output
ldm R1,#0000_0000b ; R1 data setting , all Low for key scan
ldm R0dd,#0000_0000b ; R0 direction setting ,All input
ldm smrr0,#1111_1111b ; Stop mode release by R0
ldm smrr1,#0000_0000b ; Stop disable by R1
ldm Ienh,#1000_0000b ; Key scan interrupt setting
ldm ckctlr,#0001_1101b ; Ckctlr setting for 16mS time delay after
; release from stop mode, WDT disable.
clr1 IRQKSCN ; key scan interrupt request flag clear
STOP
NOP ; `NOP instruction must to be used after
ldm R1,#1111_1111b ; Stop instruction
B -2
Page 99
Appendix B. PROGRAMMER`S GUIDE
Key Scan
- To secure the key board scanning , read the input port after minimum 60uS delay time from
output port set to `Low `. This time delay is for the port rising time depend on the
input pull-up resistor .
; program example ,See the circuit B-1
.
ldm R1,#1111_1110b;R10 port set to LOW
call delay_60uS;60uS time delay routine
lda R0;R0 port Read
.
.
R0 port Read timing
R10
R11
60uS
60uS
Fig B-2 , Input with pull-up port read time method
< NOTICE >
. *0 : is only available in .Low Voltage detectionOption = Y ( No. 3 )
*1 : is not available for 20PIN & 24PIN. So, Default Option is Pull-Up.
. *2 : is not available for 20PIN. So Default Option is Pull-Up.
3. Low Voltage Detection
Y/N
Date :
Company Name :
Section Name :
Signature :
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.