SHL
Bitwise left-shift of an operand : A:= SHL (IN, N)A, IN and N should be of the type BYTE, WORD, or DWORD. IN will be shifted to the left by N bits and filled with zeros on the right.
![]() | Please note, that the amount of bits, which is regarded 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 regarded. The data type of the output variable has no effect at all on the arithmetic operation. |
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.
Example in ST:
Example in IL:
LD 1
SHL 1
ST Var1 (* Result is 2 *)