The IEC operator is used for bitwise rotation of an operand to the left.
Permitted data types: BYTE, WORD, DWORD, LWORD
erg := ROL (in, n)
CODESYS moves in n-times one bit to the left and adds the bit to the leftmost position from the right.
|
Important |
|---|---|
|
Note the number of bits which CODESYS uses for this operation as defined by the data type of the |
Example 120. Examples
The results for erg_byte and erg_word are different depending on the data type of the input variables, although the values of the in_byte and in_word input variables are the same.
ST
PROGRAM rol_st VAR in_byte : BYTE := 16#45; in_word : WORD := 6#45; erg_byte : BYTE; erg_word : WORD; n: BYTE := 2; END_VAR erg_byte := ROL(in_byte,n); (* Result: 16#15 *) erg_word := ROL(in_word,n); (* Result: 16#0114 *)
FBD
IL