Bit-shift operators, Bit-shift operators 1, L-force | plc designer – Lenze PLC Designer PLC Designer (R3-1) User Manual
Page 1053
L-force | PLC Designer
Programming Reference
DMS 4.1 EN 03/2011 TD29
1051
Example in FBD:
16.3.4
Bit-Shift Operators 
The following bit-shift operators, matching the IEC1131-e standard, are available: 
SHL, SHR, ROL, ROR 
 
SHL 
IEC Operator: Bitwise left-shift of an operand. 
erg:= SHL (in, n)
in: Operand to be shifted to the left. 
n: Number of bits, by which in gets shifted to the left. 
If n exceeds the data type width, BYTE, WORD, DWORD and LWORD operands will be 
filled with zeros, operands of signed data types, like for example INT, will get an 
arithmetic shift, that means they will be filled with the value of the topmost bit. 
Note: Please note, that the amount of bits, which is noticed for the arithmetic 
operation, is pretended by the data type of the input variable !. If the input variable 
is a constant the smallest possible data type is noticed. The data type of the output 
variable has no effect at all on the arithmetic operation. 
Note: See in the following example in hexadecimal notation that you get different 
results for erg_byte and erg_word depending on the data type of the input variable 
(BYTE or WORD), although the values of the input variables in_byte and in_word are 
the same.