Integer decomposition
Block name
BD54_INT_DECOMPOSITION
ST call
PROGRAM BD54 VAR ARRAY1: ARRAY [0..3] OF DINT; ARRAY2: ARRAY [0..3] OF REAL; DINT1: DINT := 23139; FB: LIB.CORE.V1_0.BD54_INT_DECOMPOSITION := (LOW := [1, 5, 1, 13] ,HIGH := [4, 8, 8, 16]); END_VAR FB(IN:= DINT1, OUT=>ARRAY1, DY=>ARRAY2); END_PROGRAM
Library
LIB\CORE
Version
V1.0
Description
The block decomposes the input data to up to four (integer) values composed from defined range of bits.
Inputs
Outputs
Output | Type | Description |
OUT | ARRAY_DINT | Output value, array [0..3] |
DY | ARRAY_REAL | Output value, array [0..3] |
bs | bool | Sign of the input value |
Function
The block decomposes the input data according to the low and high parameters. For example, to evaluate the first 4 bits as a value ranged from 0 to 15, fill in low as [1,0,0,0] and high as [4,0,0,0]: the low bit is 1, the high bit is 4. The resulting value will be in the first element of the output array. bs is the sign of the input data. The displayed range may be 2 to 32 bits.