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.3 ITB Integer (16-Bit) to BCD<br />

Format<br />

Description<br />

Status word<br />

Example<br />

ITB<br />

Conversion Instructions<br />

ITB (binary to decimal conversion of a 16-bit integer number) interprets the contents<br />

of ACCU 1-L as a 16-bit integer and converts it to a three-digit binary coded decimal<br />

number (BCD). The result is stored in the low word of accumulator 1. Bit 0 to bit 11<br />

contain the value of the BCD number. Bit 12 to bit 15 are set to the state of the sign<br />

(0000 = positive, 1111= negative) of the BCD number. The high word of accumulator<br />

1 and accumulator 2 remain unchanged.<br />

The BCD number can be in the range of "-999" to "+999." If the number is out of the<br />

permissible range, then the status bits OV and OS are set to 1.<br />

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

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

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

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

L MW10 //Load the integer number into ACCU 1-L.<br />

ITB //Convert from integer to BCD (16-bit); store result in ACCU 1-L.<br />

T MW20 //Transfer result (BCD number) to MW20.<br />

ITB<br />

MW10<br />

MW20<br />

15... ...8 7... ...0<br />

1 1 1 1 1 1 1 0 0 1 1 0 0 0 1 1<br />

1<br />

1<br />

1<br />

1<br />

0<br />

1<br />

Integer to BCD<br />

0<br />

0<br />

" - " " 4 " " 1 " " 3 "<br />

0<br />

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

A5E00706960-01 3-3<br />

0<br />

0<br />

1<br />

0<br />

0<br />

1<br />

1<br />

"-413" Integer<br />

"-413" BCD

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

Saved successfully!

Ooh no, something went wrong!