General functioning of the FB_CTRL_... Function blocks eErrorId: The error number [ } 16] is provided at this output if the bError output is TRUE. Using the global base time (only available on a PC system) In order to be able to use the function blocks of a PLC task with a cycle time of less than 1ms, it is possible to interpret the specified cycle times as ticks of a base time. In this special parameterization, the time unit of 1ms is interpreted as 1 tick. This approach is equivalent to setting a PLC cycle time of less than 1ms in the TwinCAT System Manager.
The switchover and declaration of the base time is done with the global structure stCtrl_GLOBAL_CycleTimeInterpretation for all function blocks of the toolbox. VAR_GLOBAL stCtrl_GLOBAL_CycleTimeInterpretation : ST_CTRL_CYCLE_TIME_INTERPRETATION; END_VAR TYPE ST_CTRL_CYCLE_TIME_INTERPRETATION : STRUCT bInterpretCycleTimeAsTicks : BOOL; (* e.g. 2ms -> 2ticks *) fBaseTime : FLOAT; (* Base time in seconds, e.g. 200µs -> 200E-6s *) END_STRUCT END_TYPE In order to interpret the specified cycle times as ticks, the variable bInterpretCycleTimeAsTicks in the global structure stCtrl_GLOBAL_CycleTimeInterpretation is set to TRUE.
Within this structure, the base time unit has to be set in variable fBaseTime . By setting the flag bInterpretCycleTimeAsTicks , the interpretation of the parameters with the names tTaskCycleTime tCtrlCycleTime is changed. The interpretation and effect of all other parameters of type TIME remains unaffected. Sample: The base time unit of the TwinCAT system is 200µs. The PLC task, and therefore the function blocks of the Toolbox, are called cyclically every 400µs. Setting the global structure: stCtrl_GLOBAL_CycleTimeInterpretation.bInterpretCycleTimeAsTicks := TRUE; stCtrl_GLOBAL_CycleTimeInterpretation.fBaseTime := 200E-6; Parameterization of a function block from the Toolbox:
stParams.tTaskCycleTime := T#2ms; (*2*200µs=400µs *) stParams.tCtrlCycleTime := T#4ms; (*4*200µs=800µs *) stParams. ... The TaskCycleTime specified on the function blocks is 2•200E-6s = 400µs and thus corresponds to the set PLC cycle time. The CtrlCycleTime is set to 800µs = 4•200E-6s, so that the control loop operates with a sampling time of 800µs, i.e. it is processed during every second PLC cycle. TS4100 12 Version: 1.1