3.11 Stack Operations
It should be noted that with Stack operations all read/write operations on the Data Stack take place
according to the LIFO principle (Last In – First Out).
3.11.1 Load Data onto the Data Stack (PS)
Abbreviation for PLC Editor:
Execution time [µs]
Number of bytes
Logic Execution with the PS Command
Operands: M, I, O, T, C
Operation:
With the PS command, data can be buffered. Thus the addressed operand is loaded onto the Data
Stack. Since the Data Stack is organised as 16 bit, a minimum width of one Word must be used in
writing to it. During this the operand value is copied into bit 7 of the current address in the Data
Stack. The free bits of the reserved memory are undefined or unused. In the event of a Stack
overflow, an error message will be issued.
Memory allocation in the Data Stack:
Word Execution with the PS Command
Operands: B, W, D, K
Operation:
With the PS command, data can be buffered. Thus the addressed memory area (B, W, D, K) is
copied into the current address of the Data Stack. With Word execution, two Words are reserved as
standard on the Data Stack per PS command. The operand is extended in the Stack with sign
justification corresponding to the MSB. In the event of a Stack overflow, an error message will be
issued.
Memory allocation in the Data Stack upon saving of:
Bit 31
Byte
X X X X X X X X X X X X X X X X
Word
X X X X X X X X X X X X X X X X
Doubleword
D D D D D D D D D D D D D D D D
Constant
K K K K K K K K K K K K K K K K
7-100
TNC 407/TNC 415/TNC 425
PS (PUSH)
Logic
Byte/Word
1.4 to 2.0
1.5 to 2.0
24
Bit 15
x x x x x x x x L x x x x x x x
3 Commands
Double
1.3 to 1.8
26
22
7
0
15
X X X X X X X X B B B B B B B B
W WW WW WW W W W W WW WW W
D D D D D D D D D D D D D D D D
K K K K K K K K K K K K K K K K
Constant
1.0 to 1.1
24
7
0
01.98