Priority Encoder
medium
Encodes eight BOOL inputs into the index of the highest-priority active input.
What it teaches
When several fault or request lines are active together, report the highest-numbered one as a compact index from 0 to 7. Sts_Active distinguishes active In_0 from no request. Unlike Bit Pack, one winning input is reported instead of preserving every active bit.
Inputs and outputs
| Tag | Type | Default | Description |
|---|---|---|---|
| In_0 | BOOL | — | — |
| In_1 | BOOL | — | — |
| In_2 | BOOL | — | — |
| In_3 | BOOL | — | — |
| In_4 | BOOL | — | — |
| In_5 | BOOL | — | — |
| In_6 | BOOL | — | — |
| In_7 | BOOL | — | — |
| Out_Index | DINT | — | Number of the highest active input |
| Sts_Active | BOOL | — | 1 while at least one input is active |
Required behavior
- Out_Index is the number of the highest active input: with In_5 and In_2 both on, Out_Index is 5.
- Sts_Active is 1 while any input is on.
- With no input active, Out_Index is 0 and Sts_Active is 0 — Sts_Active is what tells In_0 apart from nothing.