26.10.2012 Views

Statement List (STL) - DCE FEL ČVUT v Praze

Statement List (STL) - DCE FEL ČVUT v Praze

Statement List (STL) - DCE FEL ČVUT v Praze

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Integer Math Instructions<br />

7.6 /I Divide ACCU 2 by ACCU 1 as Integer (16-Bit)<br />

Format<br />

/I<br />

Description<br />

Status word<br />

Example<br />

/I (divide 16-bit integer numbers) divides the contents of ACCU 2-L by the contents of<br />

ACCU 1-L. The contents of ACCU 1-L and ACCU 2-L are interpreted as 16-bit<br />

integer numbers. The result is stored in accumulator 1 and consists of two 16-bit<br />

integer numbers, the quotient, and the remainder. The quotient is stored in ACCU<br />

1-L and the remainder in ACCU 1-H. The instruction is executed without regard to,<br />

and without affecting, the RLO. The status word bits CC 1, CC 0, OS, and OV are set<br />

as a function of the result of the instruction.<br />

The contents of accumulator 2 remain unchanged for CPUs with two ACCUs.<br />

The contents of accumulator 3 are copied into accumulator 2, and the contents of<br />

accumulator 4 are copied into accumulator 3 for CPUs with four ACCUs. The<br />

contents of accumulator 4 remain unchanged.<br />

See also Evaluating the Bits of the Status Word with Integer Math Instructions.<br />

BR CC 1 CC 0 OV OS OR STA RLO /FC<br />

writes: - x x x x - - - -<br />

Status bit generation CC 1 CC 0 OV OS<br />

Quotient = 0 0 0 0 -<br />

-32768 = Quotient > 0 1 0 0 -<br />

Quotient = 32768 1 0 1 1<br />

Division by zero 1 1 1 1<br />

<strong>STL</strong> Explanation<br />

L IW10 //Load the value of IW10 into ACCU 1-L.<br />

L MW14 //Load the contents of ACCU 1-L into ACCU 2-L. Load the value of MW14 into<br />

ACCU 1-L.<br />

/I //Divide ACCU 2-L by ACCU 1-L; store the result in ACCU 1: ACCU 1-L:<br />

quotient, ACCU 1-H: remainder<br />

T MD20 //The contents of ACCU 1 (result) are transferred to MD20.<br />

<strong>Statement</strong> <strong>List</strong> (<strong>STL</strong>) for S7-300 and S7-400 Programming<br />

7-6 A5E00706960-01

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!