Skip to main content

7.5.2 SHL

Function

Move the operand input by IN to the left by N bits in binary digits, and fill the vacant bits on the right with zeros. Finally, the result is output in OUT

LD graphics

Alt text

  • The following figure illustrates how to shift the integer data type operand to the left by 3 bits:

alt text

Parameter description

Interface variableDeclarationData typeDescription
INVar_InputANY_BITOperand to shift left
NVar_InputANY_INTNumber of bits to shift to the left
Function nameReturn valueANY_BITValue after left shift
warning
  • Here ANY_BIT data type is BYTE, WORD, DWORD, LWORD;
  • BOOL has no meaning, the return value type is the same as IN type

Example

  • LD example is shown below:

alt text

  • ST example is shown in the following code:
wVar:=SHL(IN:=wVar,N:=nVar);