BackgroundTask (FB)

FUNCTION_BLOCK FINAL BackgroundTask EXTENDS FBF.InstanceBase IMPLEMENTS IBackgroundTask, ICmpEventCallback

Encapsulates all the details of managing a iec task in the context of the runtime system.

A running background task can be controlled via the methods of IBackgroundTask.

Note
Watchdog Sensitivity:

If the actual cycle time of a task exceeds the currently udiWatchdogTime, the currently defined usiWatchdogSensitivity value is taken into account:

  • Sensitivity 0, 1 => exception in cycle 1

  • Sensitivity 2 => exception in cycle 2

  • Sensitivity n => exception in cycle n

  • Single Timeout => Exception if the actual cycle time is longer than usiWatchdogSensitivity x udiWatchdogTime.

InOut:

Scope

Name

Type

Comment

Input

tgTaskGroup

TASK_GROUP

anAppName

APP_NAME

tnTaskName

TASK_NAME

usiTaskPrio

USINT

udiTaskInterval

UDINT

Taskinterval in µs

xWatchdogEnabled

BOOL

TRUE => Watchdog will be enabled

udiWatchdogTime

UDINT

Watchdog Time in µs

usiWatchdogSensitivity

USINT

Defines the behavior of a task watchdog when exceeding the udiWatchdogTime. (See note above)

xEnable

BOOL

TRUE: Activates the defined operation FALSE: Aborts/resets the defined operation

itfParams

SHD.ISharedQueue

Parameter Queue feeding the IAsyncActionProvider.AsyncAction

itfAction

IAsyncActionProvider

Specifies the action executed in the context of this background task

Output

xBusy

BOOL

TRUE: Operation is running

xError

BOOL

TRUE: Error condition reached

eErrorID

ERROR

If xError is TRUE => Information about the current error condition

itfResult

SHD.ISharedArea

Current states and results of the background task

dwCurrentCycleTime

DWORD

dwAverageCycleTime

DWORD

dwMaxCycleTime

DWORD

dwMinCycleTime

DWORD

dwCycleCounter

DWORD

Properties:

ActionController

ModelTimeLimit

ModelTimeOut

Methods:

SetInitialValue

AbortModel

GetConfiguration

GetConfiguration2

GetModelState

ResetModel

StartModel

TaskDisableScheduling

TaskDisableWatchdog

TaskEnableScheduling

TaskEnableWatchdog

TaskResetStatistics

Structure: