December 2001 Commands 7 – 133
Example:
Multiply a constant with double word D36, compare the result with double
word D12, and assign the result to output O15.
Initial state:
Constant = 1000 (dec)
Double word D12 = 15000 (dec)
Double word D36 = 10 (dec)
Output O15 = ?
To improve clarity, the contents of the accumulator and operand are shown in
decimal notation. The ten-digit accumulator results from the greatest possible
accumulator content (2 147 483 647).
Function STL Accumulator contents (dec or [bit]) Operand content
(dec or [bits])
x xxx xxx xxx
Load the double
word D12 into the
word accumulator.
L D12 15 000 15000
Opening
parenthesis: Buffer
the accumulator
content onto the
program stack.
== [ 1 5 0 0 0
Load the constant
into the word
accumulator.
L K1000 1 0 0 0
Multiply the content
of the word
accumulator with
double word W36.
x D36 1 0 0 0 0 1 0
31..15 ..................... 7 .................. 0
Closing parenthesis:
Gate the
accumulator content
with the program
stack (==[, >=[ ...); if
condition not
fulfilled, set logic
accumulator to 0.
] x ..... x x x x x x x x 0 x x x x x x x
Assign the result to
output O15.
= O15 x ..... x xxxxxxx0xxxxxxx 0