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.

11 Shift and Rotate Instructions<br />

11.1 Shift Instructions<br />

11.1.1 Overview of Shift Instructions<br />

Description<br />

You can use the Shift instructions to move the contents of the low word of<br />

accumulator 1 or the contents of the whole accumulator bit by bit to the left or the<br />

right (see also CPU Registers). Shifting by n bits to the left multiplies the contents of<br />

the accumulator by ”2 n ”; shifting by n bits to the right divides the contents of the<br />

accumulator by ”2 n ”. For example, if you shift the binary equivalent of the decimal<br />

value 3 to the left by 3 bits, you end up with the binary equivalent of the decimal value<br />

24 in the accumulator. If you shift the binary equivalent of the decimal value 16 to the<br />

right by 2 bits, you end up with the binary equivalent of the decimal value 4 in the<br />

accumulator.<br />

The number that follows the shift instruction or a value in the low byte of the low word<br />

of accumulator 2 indicates the number of bits by which to shift. The bit places that are<br />

vacated by the shift instruction are either filled with zeros or with the signal state of<br />

the sign bit (a 0 stands for positive and a 1 stands for negative). The bit that is shifted<br />

last is loaded into the CC 1 bit of the status word. The CC 0 and OV bits of the status<br />

word are reset to 0. You can use jump instructions to evaluate the CC 1 bit. The shift<br />

operations are unconditional, that is, their execution does not depend on any special<br />

conditions. They do not affect the result of logic operation.<br />

The following Shift instructions are available:<br />

• SSI Shift Sign Integer (16-Bit)<br />

• SSD Shift Sign Double Integer (32-Bit)<br />

• SLW Shift Left Word (16-Bit)<br />

• SRW Shift Right Word (16-Bit)<br />

• SLD Shift Left Double Word (32-Bit)<br />

• SRD Shift Right Double Word (32-Bit)<br />

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

A5E00706960-01 11-1

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

Saved successfully!

Ooh no, something went wrong!