beckhoff TF4100 — 4.2.1.1.2 FB_CTRL_GET_TASK_CYCLETIME

PLC API 4.2.1.1.2 FB_CTRL_GET_TASK_CYCLETIME This function block allows the task cycle time of a program to be determined with a resolution of 1 ms. Correct use of the function block The TaskCycleTime can only be correctly determined if the program does not contain any active breakpoints. The task cycle time is only determined once. No further measurements are taken if either of the bCycleTimeValid or bError outputs is TRUE. Do not use this function block if you use cycle times that are less than 1 ms or not multiples of 1 ms Inputs VAR_INPUT eMode : E_CTRL_MODE; END_VAR VAR_OUTPUT tTaskCycleTime : TIME; bCycleTimeValid : BOOL; eState : E_CTRL_STATE; eErrorId : E_CTRL_ERRORCODES; bError :

BOOL; END_VAR Outputs Sample: PROGRAM PRG_GET_TASK_CYCLETIME_TEST VAR tTaskCycleTime : TIME; bCycleTimeValid : BOOL; eState : E_CTRL_STATE; eErrorId : E_CTRL_ERRORCODES; bError : BOOL; fbCTRL_GET_TASK_CYCLETIME : FB_CTRL_GET_TASK_CYCLETIME; bInit : BOOL := TRUE; fSetpointValue : FLOAT := 45.0; fActualValue : FLOAT; fbCTRL_PI : FB_CTRL_PI; stCTRL_PI_Params : ST_CTRL_PI_PARAMS; TF4100 22 Version: 2.2.4 Name Type Description eMode E CTRL MODE _ _ Input that specifies the operation mode [} 173] of the function block. Name Type Description tTaskCycleTime TIME This output indicates the current task cycle time, with a resolution of 1 ms.

bCycleTimeValid BOOL The time contained in the tTaskCycleTime output is valid when this output is TRUE. eState E CTRL STATE _ _ State of the function block eErrorId E CTRL ERROR _ _ CODES Supplies the error number [} 173] when the output bError is set. bError BOOL Becomes TRUE, as soon as an error occurs.