CODESYS ROL

ROL is an IEC operator in CODESYS that performs a bitwise rotation of an operand to the left. It moves the input value n bit positions to the left and places the bits shifted out of the leftmost position back in from the right. The result is assigned to an output variable; permitted data types are BYTE, WORD, DWORD and LWORD.

Source checked9/9 values · 2026-10-26

Specification

2 sources
Languageiec 61131 3
CodeROL
Syntaxerg := ROL(in, n)
DialectCODESYS

Parameters

NameData typeDescription
inBYTE, WORD, DWORD, LWORDOperand to be rotated left; its data type determines the number of bits used.
nBYTENumber of bit positions the operand is rotated to the left.

Study notes

  • Permitted data types for the operand are BYTE, WORD, DWORD and LWORD.
  • The number of bits used for the rotation is defined by the data type of the in input variable.
  • If the input is a constant, CODESYS uses the smallest possible data type.
  • The data type of the output variable does not influence the operation.
  • Example: with n = 2, ROL on BYTE 16#45 gives 16#15, while ROL on WORD 6#45 gives 16#0114, because the input data types differ.
  • The operator is shown with ST, FBD and IL representations.
↑↓ navigate↵ openesc close