Skip to main content

7.6.1 PACK_BITS_TO_BYTE

Function

Implement the combination of 8 BOOL input quantities BIT0--BIT7 into one BYTE return value

LD graphics

alt text

Parameter description

Interface VariableDeclarationTypeDescription
BIT0Var_InputBOOLbit0 of the BYTE return value
BIT1Var_OutputBOOLbit1 of the BYTE return value
BIT2Var_OutputBOOLbit2 of the BYTE return value
BIT3Var_OutputBOOLbit3 of the BYTE return value
BIT4Var_OutputBOOLbit4 of the BYTE return value
BIT5Var_OutputBOOLbit5 of the BYTE return value
BIT6Var_OutputBOOLbit6 of the BYTE return value
BIT7Var_OutputBOOLbit7 of the BYTE return value
Function nameReturn valueBYTEConverted result

Example

  • LD sample animation is as follows:

alt text

  • ST example is shown in the following code:
OUT:=PACK_BITS_TO_BYTE(
BIT0:=0,
BIT1:=1,
BIT2:=0,
BIT3:=1,
BIT4:=1,
BIT5:=1,
BIT6:=1,
BIT7:=1
);