Samsung KS57C2308 Manual page 19

Single-chip cmos microcontroller
Table of Contents

Advertisement

KS57C2308/P2308/C2316/P2316
+ +
PROGRAMMING TIP — Selecting the Working Register Area
The following examples show the correct programming method for selecting working register area:
1. When ERB = "0":
VENT2 1,0,INT0
INT0
PUSH
SRB
PUSH
PUSH
PUSH
PUSH
SMB
LD
LD
LD
INCS
LD
LD
POP
POP
POP
POP
POP
IRET
The POP instructions execute alternately with the PUSH instructions. If an SMB n instruction is used in an
interrupt service routine, a PUSH and POP SB instruction must be used to store and restore the current SMB and
SRB values, as shown in Example 2 below.
2. When ERB = "1":
VENT2 1,1,INT0
INT0
PUSH
SRB
SMB
LD
LD
LD
INCS
LD
LD
POP
IRET
SB
2
HL
WX
YZ
EA
0
EA,#00H
80H,EA
HL,#40H
HL
WX,EA
YZ,EA
EA
YZ
WX
HL
SB
SB
2
0
EA,#00H
80H,EA
HL,#40H
HL
WX,EA
YZ,EA
SB
; EMB
1, ERB
; PUSH current SMB, SRB
; Instruction does not execute because ERB = "0"
; PUSH HL register contents to stack
; PUSH WX register contents to stack
; PUSH YZ register contents to stack
; PUSH EA register contents to stack
; POP EA register contents from stack
; POP YZ register contents from stack
; POP WX register contents from stack
; POP HL register contents from stack
; POP current SMB, SRB
; EMB
1, ERB
; Store current SMB, SRB
; Select register bank 2 because of ERB = "1"
; Restore SMB, SRB
ADDRESS SPACES
0, Jump to INT0 address
1, Jump to INT0 address
2-11

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

P2308C2316P2316Ks57p2308Ks57c2316Ks57p2316

Table of Contents