Siemens Simatic S7-300 Service Manual Page 100

  • Download
  • Add to my manuals
  • Print
  • Page
    / 272
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 99
Integer Math Instructions
Statement List (STL) for S7-300 and S7-400 Programming
7-6
A5E00706960-01
7.6 /I Divide ACCU 2 by ACCU 1 as Integer (16-Bit)
Format
/I
Description
/I
(divide 16-bit integer numbers) divides the contents of ACCU 2-L by the contents of
ACCU 1-L. The contents of ACCU 1-L and ACCU 2-L are interpreted as 16-bit
integer numbers. The result is stored in accumulator 1 and consists of two 16-bit
integer numbers, the quotient, and the remainder. The quotient is stored in ACCU
1-L and the remainder in ACCU 1-H. The instruction is executed without regard to,
and without affecting, the RLO. The status word bits CC 1, CC 0, OS, and OV are set
as a function of the result of the instruction.
The contents of accumulator 2 remain unchanged for CPUs with two ACCUs.
The contents of accumulator 3 are copied into accumulator 2, and the contents of
accumulator 4 are copied into accumulator 3 for CPUs with four ACCUs. The
contents of accumulator 4 remain unchanged.
See also Evaluating the Bits of the Status Word with Integer Math Instructions.
Status word
BR CC 1 CC 0 OV OS OR STA RLO /FC
writes: - x x x x - - - -
Status bit generation CC 1 CC 0 OV OS
Quotient = 0 0 0 0 -
-32768 <= Quotient < 0 0 1 0 -
32767 >= Quotient > 0 1 0 0 -
Quotient = 32768 1 0 1 1
Division by zero 1 1 1 1
Example
STL Explanation
L IW10 //Load the value of IW10 into ACCU 1-L.
L MW14 //Load the contents of ACCU 1-L into ACCU 2-L. Load the value of MW14 into
ACCU 1-L.
/I //Divide ACCU 2-L by ACCU 1-L; store the result in ACCU 1: ACCU 1-L:
quotient, ACCU 1-H: remainder
T MD20 //The contents of ACCU 1 (result) are transferred to MD20.
Page view 99
1 2 ... 95 96 97 98 99 100 101 102 103 104 105 ... 271 272

Comments to this Manuals

No comments