SHL¶
Shifts a bit string left by a specified number of positions.
Signature¶
┌─────────┐
IN ─┤ │
│ SHL ├─ OUT
N ─┤ │
└─────────┘
FUNCTION SHL : ANY_BIT
VAR_INPUT
IN : ANY_BIT;
N : ANY_INT;
END_VAR
END_FUNCTION
The return type matches the type of IN. SHL accepts BYTE,
WORD, DWORD, LWORD for IN; N is INT.
Inputs
Name |
Type |
Description |
|---|---|---|
|
|
The bit string to shift. |
|
|
Number of positions to shift left. |
Outputs
Name |
Type |
Description |
|---|---|---|
Return value |
|
IN shifted left by N positions, with zeros filled in on the right. Same type as IN. |
Description¶
Shifts the bit string IN left by N positions. Vacated positions on the right are filled with zeros. Bits shifted beyond the leftmost position are discarded.
Example¶
result := SHL(WORD#16#00FF, 8); (* result = 16#FF00 *)
See Also¶
References¶
IEC 61131-3 §2.5.1.5.6