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.

Conversion Instructions<br />

3.11 NEGD Twos Complement Double Integer (32-Bit)<br />

Format<br />

Description<br />

Status word<br />

Example<br />

NEGD<br />

NEGD (twos complement double integer) forms the twos complement of the 32-bit<br />

value in ACCU 1. Forming the twos complement inverts the value bit by bit, that is,<br />

zeros replace ones and ones replace zeros; then a "1" is added. The result is stored<br />

in accumulator 1. The twos complement instruction is equivalent to a multiplication<br />

by "-1" The instruction is executed without regard to, and without affecting, the RLO.<br />

The status bits CC 1, CC 0, OS, and OV are set as a function of the result of the<br />

operation.<br />

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

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

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

Result = 0 0 0 0 -<br />

-2.147.483.648 = 1 1 0 0 -<br />

Result = 2 147 483 648 0 1 1 1<br />

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

L ID8 //Load value into ACCU 1.<br />

NEGD //Generate twos complement (32-bit).<br />

T MD10 //Transfer result to MD10.<br />

Contents ACCU1-H ACCU1-L<br />

Bit 31 . . . . . . . . . . 16 15 . . . . . . . . . . 0<br />

before execution of<br />

NEGD<br />

0101 1111 0110 0100 0101 1101 0011 1000<br />

after execution of NEGD 1010 0000 1001 1011 1010 0010 1100 1000<br />

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

A5E00706960-01 3-11

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

Saved successfully!

Ooh no, something went wrong!