{"id":"iec-rol","model_id":"ROL","name":"CODESYS ROL","summary":"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.","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."],"safety_notes":[],"sources":[{"url":"https://infosys.beckhoff.com/content/1033/tc3_plc_intro/2528945291.html","title":"Beckhoff Information System","accessed":"2026-10-26"},{"url":"https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_operator_rol.html","title":"CODESYS Group","accessed":"2026-10-26"}],"verification":{"status":"source_checked","checked_at":"2026-10-26","values":9,"method":"llm_source_check"},"updated_at":"2026-10-26","type":"instruction","spec":{"language":"iec_61131_3","code":"ROL","syntax":"erg := ROL(in, n)","parameters":[{"name":"in","data_type":"BYTE, WORD, DWORD, LWORD","description":"Operand to be rotated left; its data type determines the number of bits used."},{"name":"n","data_type":"BYTE","description":"Number of bit positions the operand is rotated to the left."}],"dialect":"CODESYS","related":[],"standards":[]},"url":"https://machineschema.com/instruction/iec-rol","license":"https://creativecommons.org/licenses/by/4.0/"}