Skip to main content

FB_VIOLATIONCNT

Description Function Block

The FB_VIOLATIONCNT function block is used to implement a weighted error counter.

The bEnable input is used to activate or deactivate the counter. When the counter is deactivated, the bInputOK outputs are set to FALSE and ActViolationCnt is set to 0.

When bEnable is set to TRUE, the bInput input is checked each time the function block is called.

  • When the input bInput = TRUE, the error counter ActViolationCnt is decremented by the value uiDecrementNoError.

    Note: The input can be negated, in which case the input signal must be FALSE.

  • When the input bInput = FALSE, the error counter ActViolationCnt is incremented by the value uiIncrementError.

    Note: The input can be negated, in which case the input signal must be TRUE.

As soon as the error counter reaches the maximum value udiCounterLimit, bInputOK is set to FALSE.

Tip

The availability of this function block depends on the state indicators FBSupportFlags of the ESI description file. These flags FBSupportFlags are evaluated as of CODESYS Safety for EtherCAT Safety Module 4.3.0.0.

The usage of this function block is prevented if the device in question does not explicitly support this function block.

EL6900_VIOLATIONCNT.png
Table 58. VAR_INPUT

Name

Data Type

Initial Value

Description, Parameter Values

bEnable

SAFEBOOL

FALSE

Input for activating the function

TRUE: The internal counter is activated.

FALSE: The internal counter is deactivated.

bInput

SAFEBOOL

FALSE

When the counter is activated, the input is checked each time the function block is called.

. Input not negated
  • TRUE: Counter is decremented by the value uiDecrementNoError.

  • FALSE: Counter is incremented by the value uiIncrementError.

. Input negated
  • TRUE: Counter is incremented by the value uiIncrementError.

  • FALSE: Counter is decremented by the value uiDecrementNoError.

uiIncrementError

SAFEUINT

0

Value by which the internal counter is incremented

Only a constant value is permitted (no variable)

uiDecrementNoError

SAFEUINT

0

Value by which the internal counter is decremented

Only a constant value is permitted (no variable)

udiCounterLimit

SAFEUINT

0

Maximum value for the internal counter. Above this value, the bInputOK output is set to FALSE.

Only a constant value is permitted (no variable)



Table 59. VAR_OUTPUT

Name

Data Type

Initial Value

Description, Parameter Values

bInputOK

SAFEBOOL

FALSE

When Enable = TRUE and the internal error counter is below the maximum value, the output is set to TRUE.

ActViolationCnt

SAFEUINT

0

Indicates the current internal counter value when the input bEnable = TRUE. Otherwise the output is set to 0.