beckhoff TF4100 — 4.1 General operating principle

PLC API The outputs of the function blocks eState This output indicates the current internal state of the function block. bError An error in the function block is indicated by a TRUE at this boolean output. eErrorId The error number [ } 173] is provided at this output if the bError output is TRUE. Using the global base time 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 TF4100 19 Version: 2.2.4 Task: Configuration Parameter: tTaskCycleTime Parameter: tCtrlCycleTime Action T#10ms T#10ms T#10ms The control loop is processed using a 10 ms sampling time.

T#10ms T#10ms T#50ms The control loop is processed using a 50 ms sampling time. T#100ms T#100ms T#100ms The control loop is processed using a 100 ms sampling time. T#100ms T#100ms T#50ms ERROR, execution is not possible! T#100ms T#50ms T#50ms ERROR, although the function block has been executed, incorrect output values have been calculated! eCTRL STATE IDLE _ _ The function block has successfully been reset, and is now waiting for selection of the operation mode. eCTRL STATE PASSIVE _ _ The function block is in the passive state in which no calculations are carried out. eCTRL STATE ACTIVE _ _ The function block is in the active state, which is the normal operating state.

eCTRL STATE RESET _ _ A reset request is being processed, but the reset has not yet been completed. eCTRL STATE MANUAL _ _ The function block is in the manual state, and the output value can be manually specified at the appropriate input. eCTRL STATE ... _ _ If there are any other internal states, they are described together with the corresponding function blocks. eCTRL STATE ERROR _ _ An error has occurred; the function block is not executed when in this state. See eErrorId for further information.