Specifications
II-12 EPSON S1C6S2N7 TECHNICAL SOFTWARE
CHAPTER 2: INITIAL RESET
Initialize Program Example
The following is a program that clears the RAM and LCD,
resets the flags, registers, timer, and stopwatch timer, and
sets the stack pointer immediately after resetting the sys-
tem.
Label Mnemonic/operand Comment
ORG 100H
JP INIT ;Jump to "INIT"
;
ORG 110H
INIT RST F,0011B ;Interrupt mask, decimal
;adjustment off
;
LD X,0 ;
RAMCLR LDPX MX,0 ;
CP XH,5H ;
JP NZ,RAMCLR ;
LD X,90H ;
LCDCLR LDPX MX,0 ;
CP XM,0BH ;
JP NZ,LCDCLR ;
;
LD A,0 ;
LD B,4 ;
LD SPL,A ;
LD SPH,B ;
;
LD X,0F9H ;
OR MX,0101B ;
;
LD X,0EBH ;
OR MX,0111B ;
;
LD X,0E8H ;
OR MX,1111B ;
;
LD X,0E9H ;
OR MX,0001B ;
Clear RAM (00H–4FH)
Enable timer interrupt
Enable input interrupt
(K03–K00)
Clear LCD (90H–AFH)
Reset timer and stopwatch
timer
Set stack pointer to 40H
2.2
Enable motor driver
interrupt