Shift Operations - Siemens SIMATIC S5-100U System Manual

Simatic s5 series cpu 100/102/103
Hide thumbs Also See for SIMATIC S5-100U:
Table of Contents

Advertisement

STEP 5 Operations
8.2.5

Shift Operations

Shift operations shift a bit pattern in ACCU 1. The contents of ACCU 2 are not affected. Shifting
multiplies or divides the contents of ACCU 1 by powers of two. Table 8-15 provides an overview of
the shift operations. Examples follow the table.
Operation
Operand
SLW
SRW
Processing a Shift Operation
Execution of shift operations is unconditional. The RLO is not affected. However, shift operations
set condition codes.
Consequently, the status of the last bit that is shifted out can be scanned with jump functions.
The shift statement parameter indicates the number of bit positions by which the contents of
ACCU 1 are to be shifted to the left (SLW) or to the right (SRW). Bit positions vacated during
shifting are assigned zeros.
The contents of the bits that are shifted out of ACCU 1 are lost. Following execution of the
operation, the state of bit 2
then be evaluated.
A shift operation with parameter "0" is handled like a "NOP" operation. The central processor pro-
cesses the next STEP 5 statement with no further reaction.
Before executing a shift operation, load the operand to be processed into ACCU 1.
The altered operand is available there for further processing.
8-48
Table 8-15. Overview of Shift Operations
Shift to the left.
The bit pattern in ACCU 1 is shifted to the left.
Shift to the right.
The bit pattern in ACCU 1 is shifted to the right.
Parameter
0 to 15
0
15
(SRW) or bit 2
(SLW) has an influence on the CC1 bit, which can
Meaning
EWA 4NEB 812 6120-02b
S5-100U

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents