Bit composition, 8 bits

BD18_BIT_COMPOSITION_8BIT

PROGRAM BD18_8B_TEST
 
VAR 
 
    IN1: ARRAY [0 .. 7] OF BOOL;
 
    O1: USINT;
 
END_VAR
 
 
 
    O1:= LIB.Core.V1_0.BD18_BIT_COMPOSITION_8BIT(IN := IN1);
 
END_PROGRAM

LIB\CORE

V1.0

The function brings 8 bits together to create an integer value.

Input Type Description
ENABLEDBOOL Enable function
IN ARRAY [0 .. 7] OF BOOLArray of input values (bits)
IN0 BOOL First input (simple type)
IN1 BOOL Second input (simple type)
OutputType Description
OUT USINTOutput value

The block brings together the input bit values IN[0..7] to a USINT (unsigned short integer) output out.


At the example, simple type (BOOL) inputs are used rather than the input array of BOOLs. The block is used e.g. to create a unit status value, such as Off / On / Auto which corresponds to values of 0 / 1 / 2.

  • © Energocentrum Plus, s.r.o. 2017 - 2024