FB_BA_PrioSwi_XX

FB_BA_PrioSwi_XX 1:

The priority switches exist for different variable types (BOOL, INT, LREAL, REAL, USINT, UINT, UDINT and DINT) and in different output sizes (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 lrVal the value with the highest priority is applied whose input bEnxx is TRUE.

Example:

Inputs

Outputs

bEn01

FALSE

 

bQ

TRUE

 

lrVal01

 

32.5

lrVal

 

5.84

bEn02

FALSE

 

udiActvPrio

 

3

lrVal02

 

17.4

 

 

 

bEn03

TRUE

 

 

 

 

lrVal03

 

5.84

 

 

 

bEn04

TRUE

 

 

 

 

lrVal04

 

9.56

 

 

 

bEn05

FALSE

 

 

 

 

lrVal05

 

16.5

 

 

 

bEn06

TRUE

 

 

 

 

lrVal06

 

32.781

 

 

 

bEn07

FALSE

 

 

 

 

lrVal07

 

25.4

 

 

 

bEn08

TRUE

 

 

 

 

lrVal08

 

44.5

 

 

 

If none of the priorities is enabled, the output bQ switches to FALSE. 0 is output at lrVal and udiActvPrio. For a boolean priority switch, FALSE is then output at bVal.

Inputs

Outputs

bEn01

FALSE

 

bQ

FALSE

 

lrVal01

 

32.5

lrVal

 

0.0

bEn02

FALSE

 

udiActvPrio

 

0

lrVal02

 

17.4

 

 

 

bEn03

FALSE

 

 

 

 

lrVal03

 

5.84

 

 

 

bEn04

FALSE

 

 

 

 

lrVal04

 

9.56

 

 

 

bEn05

FALSE

 

 

 

 

lrVal05

 

16.5

 

 

 

bEn06

FALSE

 

 

 

 

lrVal06

 

32.781

 

 

 

bEn07

FALSE

 

 

 

 

lrVal07

 

25.4

 

 

 

bEn08

FALSE

 

 

 

 

lrVal08

 

44.5

 

 

 

If no priority is active, the value of the global constant ConstudiNoActvPrio is output at udiActvPrio.

VAR_INPUT

bEn01   : BOOL;
lrVal01 : LREAL;
bEn02   : BOOL;
lrVal02 : LREAL;
bEn03   : BOOL;
lrVal03 : LREAL;
bEn04   : BOOL;
lrVal04 : LREAL;
bEn05   : BOOL;
lrVal05 : LREAL;
bEn06   : BOOL;
lrVal06 : LREAL;
bEn07   : BOOL;
lrVal07 : LREAL;
bEn08   : BOOL;
lrVal08 : LREAL;

bEn01...bEn08: Enabling the priority value.

lrVal01...lrVal08: Priority value.

VAR_OUTPUT

bQ          : BOOL;
lrVal       : LREAL;
udiActvPrio : UDINT;

bQ: Output to indicate whether a priority is enabled.

lrVal: Output of the value of the current (highest) priority that is enabled.

udiActvPrio: Current (highest) priority that is enabled.

Requirements

Development environment

Required PLC library

TwinCAT from v3.1.4024.7

Tc3_BA from v1.1.6.0