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

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

Advertisement

Data Movement Instructions
00000
LIFO Stack Operation
418
When the execution condition is ON, COLL(81) shifts the contents of each word
within the stack down by one address, finally shifting the data from SBs+1 (the
first value written to the stack) to the destination word (D). The content of the
stack pointer (SBs) is then decremented by one.
Note COLL(81) will be executed every cycle unless the differentiated form
(@COLL(81)) is used or COLL(81) is used with DIFU(13) or DIFD(14).
Example
The following example shows how to use COLL(81) to create a stack between
DM 0001 and DM 0005. DM 0000 acts as the stack pointer.
When IR 00000 goes from OFF to ON, COLL(81) shifts the contents of DM 0002
to DM 0005 down by one address, and shifts the data from DM 0001 to IR 001.
The content of the stack pointer (DM 0000) is then decremented by one.
@COLL(81)
DM 0000
216
001
IR 216
9005
DM 0000
0005
DM 0001
AAAA
DM 0002
BBBB
DM 0003
CCCC
DM 0004
DDDD
DM 0005
EEEE
When bits 12 to 15 of C=8, COLL(81) can be used for an LIFO stack operation.
The other 3 digits of C specify the number of words in the stack (000 to 999). The
content of SBs is the stack pointer.
When the execution condition is ON, COLL(81) copies the data from the word
indicated by the stack pointer (SBs+the content of SBs) to the destination word
(D). The content of the stack pointer (SBs) is then decremented by one.
The stack pointer is the only word changed in the stack.
Note COLL(81) will be executed every cycle unless the differentiated form
(@DIST(80)) is used or DIST(80) is used with DIFU(13) or DIFD(14).
Example
The following example shows how to use COLL(81) to create a stack between
DM 0001 and DM 0005. DM 0000 acts as the stack pointer.
Address Instruction
00000
00001
Stack pointer
DM 0000
0004
decremented
DM 0001
BBBB
DM 0002
CCCC
DM 0003
DDDD
DM 0004
EEEE
DM 0005
EEEE
Section
7-17
Operands
LD
00000
@COLL(81)
DM
0000
IR 001
AAAA
216
001

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents