FB_BA_PrioSwi_XX
The priority switches exist for different variable types (BOOL, INT, LREAL, REAL, USINT, UINT, UDINT and DINT) and in different output values (4, 8, 12 and 16 or 24), but they all have the same functionality.
The function block FB_BA_PrioSwi_LR08 is described as an example.
Priority switches are available for selecting different values. At output fVal the value with the highest priority is applied whose input bEnxx is TRUE.
Example:
Inputs | Outputs | ||||
---|---|---|---|---|---|
bEn01 | FALSE |
| bQ | TRUE |
|
fVal01 |
| 32.5 | fVal |
| 5.84 |
bEn02 | FALSE |
| nActvPrio |
| 3 |
fVal02 |
| 17.4 |
|
|
|
bEn03 | TRUE |
|
|
|
|
fVal03 |
| 5.84 |
|
|
|
bEn04 | TRUE |
|
|
|
|
fVal04 |
| 9.56 |
|
|
|
bEn05 | FALSE |
|
|
|
|
fVal05 |
| 16.5 |
|
|
|
bEn06 | TRUE |
|
|
|
|
fVal06 |
| 32.781 |
|
|
|
bEn07 | FALSE |
|
|
|
|
fVal07 |
| 25.4 |
|
|
|
bEn08 | TRUE |
|
|
|
|
fVal08 |
| 44.5 |
|
|
|
If none of the priorities is enabled, the output bQ switches to FALSE. 0 is output at the outputs fVal and nActvPrio. For a boolean priority switch, FALSE is then output at bVal.
Inputs | Outputs | ||||
---|---|---|---|---|---|
bEn01 | FALSE |
| bQ | FALSE |
|
fVal01 |
| 32.5 | fVal |
| 0.0 |
bEn02 | FALSE |
| nActvPrio |
| 0 |
fVal02 |
| 17.4 |
|
|
|
bEn03 | FALSE |
|
|
|
|
fVal03 |
| 5.84 |
|
|
|
bEn04 | FALSE |
|
|
|
|
fVal04 |
| 9.56 |
|
|
|
bEn05 | FALSE |
|
|
|
|
fVal05 |
| 16.5 |
|
|
|
bEn06 | FALSE |
|
|
|
|
fVal06 |
| 32.781 |
|
|
|
bEn07 | FALSE |
|
|
|
|
fVal07 |
| 25.4 |
|
|
|
bEn08 | FALSE |
|
|
|
|
fVal08 |
| 44.5 |
|
|
|
If no active priority is present, then the value of the global constant nNoActivePrio is output at the output nActvPrio.
Inputs
VAR_INPUT
bEn01 : BOOL;
fVal01 : LREAL;
bEn02 : BOOL;
fVal02 : LREAL;
bEn03 : BOOL;
fVal03 : LREAL;
bEn04 : BOOL;
fVal04 : LREAL;
bEn05 : BOOL;
fVal05 : LREAL;
bEn06 : BOOL;
fVal06 : LREAL;
bEn07 : BOOL;
fVal07 : LREAL;
bEn08 : BOOL;
fVal08 : LREAL;
END_VAR
Name | Type | Description |
---|---|---|
bEn01...bEn08 | BOOL | Enabling the priority value |
fVal01...fVal08 | LREAL | Priority value |
Outputs
VAR_OUTPUT
bQ : BOOL;
fVal : LREAL;
nActvPrio : UDINT;
END_VAR
Name | Type | Description |
---|---|---|
bQ | BOOL | Output to indicate whether a priority is enabled. |
fVal | LREAL | Output of the value of the current (highest) priority that is enabled. |
nActvPrio | UDINT | Current (highest) priority that is enabled. |
Requirements
Development environment | Required PLC library |
---|---|
TwinCAT from v3.1.4024.22 | Tc3_BA2 from v5.2.5.0 |