Skip to main content

7.6.2 PACK_BITS_TO_WORD

Function

Realize the combination of 16 BOOL input quantities BIT0--BIT15 into a WORD return value

LD graphics

alt text

Parameter description

Interface VariableDeclarationTypeDescription
BIT0Var_InputBOOLbit0 of the WORD return value
BIT1Var_InputBOOLbit1 of the WORD return value
BIT2Var_InputBOOLbit2 of the WORD return value
BIT3Var_InputBOOLbit3 of the WORD return value
BIT4Var_InputBOOLbit4 of the WORD return value
BIT5Var_InputBOOLbit5 of the WORD return value
BIT6Var_InputBOOLbit6 of the WORD return value
BIT7Var_InputBOOLbit7 of the WORD return value
BIT8Var_InputBOOLbit8 of the WORD return value
BIT9Var_InputBOOLbit9 of the WORD return value
BIT10Var_InputBOOLbit10 of the WORD return value
BIT11Var_InputBOOLbit11 of the WORD return value
BIT12Var_InputBOOLbit12 of the WORD return value
BIT13Var_InputBOOLbit13 of the WORD return value
BIT14Var_InputBOOLbit14 of the WORD return value
BIT15Var_InputBOOLbit15 of the WORD return value
Function nameReturn valueWORDConverted result

Example

  • LD sample animation is as follows:

alt text

  • ST example is shown in the following code:
OUT:=PACK_BITS_TO_WORD(
BIT0:=1,
BIT1:=1,
BIT2:=1,
BIT3:=1,
BIT4:=1,
BIT5:=1,
BIT6:=1,
BIT7:=1,
BIT8:=1,
BIT9:=1,
BIT10:=1,
BIT11:=1,
BIT12:=0,
BIT13:=1,
BIT14:=0,
BIT15:=1
);