FB_BA_MUX_XX
Multiplexer function blocks exist for different variable types (BOOL, INT, LREAL, REAL, USINT, UINT, UDINT and DINT) and in different input parameters (4, 8, 12 and 16), but they all have the same functionality.
The function block FB_BA_MUX_LR16 is described as an example.
In active state (bEn=TRUE), the function block outputs the input value (lrIn01..lrIn16) at output lrQ, whose number is entered at input udiSel.
Example:
Inputs | Output |
---|---|
bEn = TRUE | lrQ = 16.5 |
udiSel = 5 |
|
lrIn01 = 15.9 |
|
lrIn02 = 32.5 |
|
lrIn03 = 17.4 |
|
lrIn04 = 5.84 |
|
lrIn05 = 9.56 |
|
lrIn06 = 16.5 |
|
lrIn07 = 32.781 |
|
lrIn08 = 25.4 |
|
lrIn09 = 44.5 |
|
lrIn10 = 66.1 |
|
lrIn11 = 45.5 |
|
lrIn12 = 83.3 |
|
lrIn13 = 54.56 |
|
lrIn14 = 33.8 |
|
lrIn15 = 98.5 |
|
lrIn16 = 71.3 |
|
If the value entered at udiSel is greater than the number of inputs, the "highest-ranking" input is output at lrQ:
Inputs | Output |
---|---|
bEn = TRUE | lrQ = 2.3 |
udiSel = 25 |
|
lrIn01 = 15.9 |
|
lrIn02 = 32.5 |
|
lrIn03 = 17.4 |
|
lrIn04 = 5.84 |
|
lrIn05 = 9.56 |
|
lrIn06 = 16.5 |
|
lrIn07 = 32.781 |
|
lrIn08 = 25.4 |
|
lrIn09 = 44.5 |
|
lrIn10 = 66.1 |
|
lrIn11 = 45.5 |
|
lrIn12 = 83.3 |
|
lrIn13 = 54.56 |
|
lrIn14 = 33.8 |
|
lrIn15 = 98.5 |
|
lrIn16 = 71.3 |
|
If bEn=FALSE, 0.0 is output at lrQ, or FALSE for boolean multiplexers.
VAR_INPUT
bEn : BOOL;
udiSel : UDINT;
lrIn00 : LREAL;
lrIn01 : LREAL;
lrIn02 : LREAL;
lrIn03 : LREAL;
lrIn04 : LREAL;
lrIn05 : LREAL;
lrIn06 : LREAL;
lrIn07 : LREAL;
lrIn08 : LREAL;
lrIn09 : LREAL;
lrIn10 : LREAL;
lrIn11 : LREAL;
lrIn12 : LREAL;
lrIn13 : LREAL;
lrIn14 : LREAL;
lrIn15 : LREAL;
lrIn16 : LREAL;
bEn: Activation of the block function.
udiSel: Number of the input, whose value is to be output at lrQ.
lr00...lr16: Input values to select from.
VAR_OUTPUT
lrQ : LREAL;
lrQ: Value of the selected input.
Requirements
Development environment | Required PLC library |
---|---|
TwinCAT from v3.1.4024.7 | Tc3_BA from v1.1.6.0 |