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.

3.15 RND Round<br />

Format<br />

Description<br />

Status word<br />

Example<br />

RND<br />

Conversion Instructions<br />

RND (conversion of a 32-bit IEEE floating-point number to 32-bit integer) interprets<br />

the contents of ACCU 1 as a 32-bit IEEE floating-point number (32-bit, IEEE-FP).<br />

The instruction converts the 32-bit IEEE floating-point number to a 32-bit integer<br />

(double integer) and rounds the result to the nearest whole number. If the fractional<br />

part of the converted number is midway between an even and an odd result, the<br />

instruction chooses the even result. If the number is out of the permissible range,<br />

then the status bits OV and OS are set to 1. The result is stored in accumulator 1.<br />

Conversion is not performed and an overflow indicated in the event of a fault<br />

(utilization of a NaN or a floating-point number that cannot be represented as a 32-bit<br />

integer number).<br />

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

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

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

L MD10 //Load the floating-point number into ACCU 1-L.<br />

RND //Convert the floating-point number (32-bit, IEEE-FP) into an integer (32-bit)<br />

and round off the result.<br />

T MD20 //Transfer result (double integer number) to MD20.<br />

Value before conversion Value after conversion<br />

MD10 = "100.5" => RND => MD20 = "+100"<br />

MD10 = "-100.5" => RND => MD20 = "-100"<br />

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

A5E00706960-01 3-15

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

Saved successfully!

Ooh no, something went wrong!