Omron CPM1 - PROGRAMING MANUAL 02-2001 Programming Manual page 434

Hide thumbs Also See for CPM1 - PROGRAMING MANUAL 02-2001:
Table of Contents

Advertisement

Data Movement Instructions
00000
Stack Operation
00000
IR 200
IR 216
DM 0000
DM 0001
DM 0002
DM 0003
DM 0004
DM 0005
Flags
416
Example
The following example shows how to use DIST(80) to copy #00FF to HR 10 + Of.
The content of LR 10 is #3005, so #00FF is copied to HR 15 (HR 10 + 5) when
IR 00000 is ON.
@DIST(80)
#00FF
HR 10
LR 10
LR 10
3 0 0
5
When bits 12 to 15 of C=9, DIST(80) can be used for a stack operation. The other
3 digits of C specify the number of words in the stack (000 to 999 in BCD). The
content of DBs is the stack pointer.
When the execution condition is OFF, DIST(80) is not executed. When the
execution condition is ON, DIST(80) copies the content of S to DBs+1+the con-
tent of DBs. In other words, 1 and the content of DBs are added to DBs to deter-
mine the destination word. The content of DBs is then incremented by 1.
Note
1. DIST(80) will be executed every cycle unless the differentiated form
(@DIST(80)) is used or DIST(80) is used with DIFU(13) or DIFD(14).
2. Be sure to initialize the stack pointer before using DIST(80) as a stack op-
eration.
Example
The following example shows how to use DIST(80) to create a stack between
DM 0001 and DM 0005. DM 0000 acts as the stack pointer.
@DIST(80)
200
DM 0000
216
FFFF
9005
0000
First execution
0000
0000
Stack pointer
0000
incremented
0000
0000
ER:
The offset or stack length in the control word is not BCD.
Indirectly addressed DM word is non-existent. (Content of *DM word is
not BCD, or the DM area boundary has been exceeded.)
Address Instruction
00000
00001
#00FF
0 0 F
F
Address Instruction
00000
00001
DM 0000
0001
Second
DM 0001
FFFF
execution
DM 0002
0000
DM 0003
0000
Stack pointer
DM 0004
0000
incremented
DM 0005
0000
Section
Operands
LD
@DIST(80)
#
HR
LR
HR 10
0 0 0
0
HR 15
0 0 F
F
Operands
LD
@DIST(80)
DM
DM 0000
0002
DM 0001
FFFF
DM 0002
FFFF
DM 0003
0000
DM 0004
0000
DM 0005
0000
7-17
00000
00FF
10
10
00000
200
0000
216

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the CPM1 - PROGRAMING MANUAL 02-2001 and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents