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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Conversion Instructions<br />

3.10 NEGI Twos Complement Integer (16-Bit)<br />

Format<br />

Description<br />

Status word<br />

Example<br />

NEGI<br />

NEGI (twos complement integer) forms the twos complement of the 16-bit value in<br />

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

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

low word of accumulator 1. The twos complement instruction is equivalent to<br />

multiplication by "-1." The status bits CC 1, CC 0, OS, and OV are set as a function of<br />

the result of the 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 />

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

Result = 2768 0 1 1 1<br />

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

L IW8 //Load value into ACCU 1-L.<br />

NEGI //Form twos complement 16-bit.<br />

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

Contents ACCU1-L<br />

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

before execution of NEGI 0101 1101 0011 1000<br />

after execution of NEGI 1010 0010 1100 1000<br />

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

3-10 A5E00706960-01

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

Saved successfully!

Ooh no, something went wrong!