BD55_INT_COMPOSITION
PROGRAM BD55 VAR LINT1:LINT; ARRAY1 : ARRAY [0..3] OF DINT := [3, 6, 10, 5]; LOW : ARRAY[0..3] OF LIB.CORE.V1_0.BIT32:= [1, 5, 9, 13]; HIGH : ARRAY[0..3] OF LIB.CORE.V1_0.BIT32:= [4, 8, 12, 16]; END_VAR LINT1:= LIB.CORE.V1_0.BD55_INT_COMPOSITION(LOW := LOW ,HIGH := HIGH ,BS:=TRUE,IN:=ARRAY1); END_PROGRAM
LIB\CORE
V1.0
The block composes the output value from up to 4 binary input vectors with defined positioning within the output vector.
Input | Type | Description | Default value |
IN | DINT | Input data, up to 4 inputs possible | [0] |
BS | BOOL | Sign of the output value | False |
LOW | ARRAY[0..3] OF LIB.CORE.V1_0.BIT32 | first bits of the range, array [0..3] with values 1 to 32 | [1] |
HIGH | ARRAY[0..3] OF LIB.CORE.V1_0.BIT32 | last bits of the range, array [0..3] with values 1 to 32 | [1] |
Output | Type | Description |
⇒ | lint | Output value |
The block composes the output integer value from up to 4 parts according to given parameters in,low, and high. The output value sign is given by the bs variable. E.g. the input value will have 4 bits and shall be inserted as 5th to 8th bit of the output value: low = [5,0,0,0], high = [8,0,0,0]. The input value itself is e.g. 6: in = [6,0,0,0]. Note that if the ranges overlap there may be undefined behaviour of the output value.