FB_ReadTaskExceedCounter

FB_ReadTaskExceedCounter 1:

The function block reads the Exceed Counter. The Exceed Counter is incremented by the system whenever the selected task exceeds the set task time. This means that maintaining real-time in the cycle was not possible.

There can be many reasons for exceeding real-time, but it is usually due to the PLC runtime and the application within this runtime. An example of this is programming loops such as FOR, WHILE, REPEAT, since these are always processed in one cycle.

FB_ReadTaskExceedCounter 2: Inputs

VAR_INPUT
    bExecute         : BOOL;
    nTaskAdsPort     : UINT;
END_VAR

Name

Type

Description

bExecute

BOOL

A positive edge activates the function block.

nTaskAdsPort

UINT

ADS Port of the selected task
Example of a possible assignment:
TwinCAT_SystemInfoVarList._TaskInfo[GETCURTASKINDEXEX()].AdsPort

FB_ReadTaskExceedCounter 3: Outputs

VAR_OUTPUT
    bBusy          : BOOL;
    bError         : BOOL;
    nErrorID       : UDINT;
    nExceedCounter : UDINT;
END_VAR

Name

Type

Description

bBusy

BOOL

The function block is active and working.

bError

BOOL

An error has been detected in the function block.

nErrorID

UDINT

ADS error code.

nExceedCounter

UDINT

Read value of the Exceed Counter.

Development environment

Target platform

PLC libraries to include

TwinCAT v3.1.4024.22

PC or CX (x86, x64, ARM)

Tc2_System (system) >= 3.4.25.0