{"id":"iec-shl","model_id":"SHL","name":"CODESYS SHL","summary":"SHL is an IEC operator that shifts the bits of an operand to the left by a specified number of positions. It is written as erg := SHL(in, n), where in is the value to shift and n is the number of bit positions. The result is assigned to erg.","study_notes":["CODESYS uses the data type of the input variable in to determine how many bits are used for the operation.","If n exceeds the data type width, the target system determines padding for BYTE, WORD, DWORD, and LWORD operands: padding with zeros or n MOD <register size>.","Example: in_byte := 16#45 shifted by n := 2 gives erg_byte := 16#14; in_word := 16#0045 shifted by 2 gives erg_word := 16#0114."],"safety_notes":[],"sources":[{"url":"https://infosys.beckhoff.com/content/1033/tc3_plc_intro/2528934539.html","title":"Beckhoff Information System","accessed":"2026-10-26"},{"url":"https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_operator_shl.html","title":"CODESYS Group","accessed":"2026-10-26"}],"verification":{"status":"source_checked","checked_at":"2026-10-26","values":7,"method":"llm_source_check"},"updated_at":"2026-10-26","type":"instruction","spec":{"language":"iec_61131_3","code":"SHL","group":"Operator","syntax":"erg := SHL (in, n)","parameters":[{"name":"in","description":"Operand which is shifted to the left"},{"name":"n","description":"Number of bits to shift in to the left"}],"dialect":"CODESYS","related":[],"standards":[]},"url":"https://machineschema.com/instruction/iec-shl","license":"https://creativecommons.org/licenses/by/4.0/"}