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.

Accumulator Instructions<br />

14.2 TAK Toggle ACCU 1 with ACCU 2<br />

Format<br />

Description<br />

Status word<br />

TAK<br />

TAK (toggle ACCU 1 with ACCU 2) exchanges the contents of ACCU 1 with the<br />

contents of ACCU 2. The instruction is executed without regard to, and without<br />

affecting, the status bits. The contents of ACCU 3 and ACCU 4 remain unchanged<br />

for CPUs with four ACCU s.<br />

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

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

Example: Subtract smaller value from greater value<br />

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

L MW10 //Load contents of MW10 into ACCU 1-L.<br />

L MW12 //Load contents of ACCU 1-L into ACCU 2-L. Load contents of MW12 into<br />

ACCU 1-L.<br />

>I //Check if ACCU 2-L (MW10) greater than ACCU 1-L (MW12).<br />

SPB NEXT //Jump to NEXT jump label if ACCU 2 (MW10) is greater than ACCU 1 (MW12).<br />

TAK //Swap contents ACCU 1 and ACCU 2<br />

NEXT: -I //Subtract contents of ACCU 2-L from contents of ACCU 1-L.<br />

T MW14 //Transfer result (= greater value minus smaller value) to MW14.<br />

Contents ACCU 1 ACCU 2<br />

before executing TAK instruction <br />

after executing TAK instruction <br />

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

14-2 A5E00706960-01

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

Saved successfully!

Ooh no, something went wrong!