Siemens Simatic S7-300 Service Manual Page 169

  • Download
  • Add to my manuals
  • Print
  • Page
    / 272
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 168
Statement List (STL) for S7-300 and S7-400 Programming
A5E00706960-01
11-1
11 Shift and Rotate Instructions
11.1 Shift Instructions
11.1.1 Overview of Shift Instructions
Description
You can use the Shift instructions to move the contents of the low word of
accumulator 1 or the contents of the whole accumulator bit by bit to the left or the
right (see also CPU Registers). Shifting by n bits to the left multiplies the contents of
the accumulator by ”2
n
”; shifting by n bits to the right divides the contents of the
accumulator by ”2
n
”. For example, if you shift the binary equivalent of the decimal
value 3 to the left by 3 bits, you end up with the binary equivalent of the decimal value
24 in the accumulator. If you shift the binary equivalent of the decimal value 16 to the
right by 2 bits, you end up with the binary equivalent of the decimal value 4 in the
accumulator.
The number that follows the shift instruction or a value in the low byte of the low word
of accumulator 2 indicates the number of bits by which to shift. The bit places that are
vacated by the shift instruction are either filled with zeros or with the signal state of
the sign bit (a 0 stands for positive and a 1 stands for negative). The bit that is shifted
last is loaded into the CC 1 bit of the status word. The CC 0 and OV bits of the status
word are reset to 0. You can use jump instructions to evaluate the CC 1 bit. The shift
operations are unconditional, that is, their execution does not depend on any special
conditions. They do not affect the result of logic operation.
The following Shift instructions are available:
SSI Shift Sign Integer (16-Bit)
SSD Shift Sign Double Integer (32-Bit)
SLW Shift Left Word (16-Bit)
SRW Shift Right Word (16-Bit)
SLD Shift Left Double Word (32-Bit)
SRD Shift Right Double Word (32-Bit)
Page view 168
1 2 ... 164 165 166 167 168 169 170 171 172 173 174 ... 271 272

Comments to this Manuals

No comments