Cyclic Data
All function blocks accessing cyclic data use two interface variables to parametrize the access to the cyclic data:
-
i_hwStartAddress for cyclic input data
-
iq_hwQWAddress for cyclic output data
Interface variable “i_hwStartAddress” (data type “Variant”) is used by the function blocks to retrieve the full amount of cyclic input data associated with the avatar. For the function block to do that, it must be parametrized with the starting address of the input range of the avatar (input sub-module of the avatar for PROFINET IO, avatar module for PROFIBUS DP). The usual method is to create PLC Tags for an address at the beginning of the range. The data size of the PLC tag is of no consequence, as long as it is at the beginning of the range (for example, BOOL “AvPump02_StartAddress” pointing to Address “%I4.0” for the Pump avatar in the example below).
For the output data direction, the function blocks use the in/out variable “iq_hwQWAddress” (in some cases also “iq_hwQBAddress” because there is only a single Byte of output data for the avatar). In contrast to the input data, this variable refers to the complete output data of the island (in most cases one Word) and is connected as an in/out variable to the function block—as in some cases, multiple function blocks access the output data of the same avatar in different areas (for example, Avatar Control function block in conjunction with an Avatar Diagnostic function block) and therefore the current status needs to be read before a change is written to the output. Usually access to the output area of the avatar should also be configured using a PLC tag for the complete output area (in the example above, “AvConveyorOneDir03_OutAddress” of type Word referencing address “%QW5”).
As soon as the input variable “i_xEnable” is set to “true” in the program, function blocks involving cyclic communication will execute and update the cyclic data. This means that any input variables at the function block interface controlling the avatar through cyclic communication (for example, “i_xRunFwd” in the example above) will be written to the output data area of the avatar. At the same time, any relevant status information from the input data area of the avatar are read by the function block and copied to the output interface (for example, “q_xRunFwd”).
The status output “q_xActive” of the function blocks is the counterpart of “i_xEnable”. If the execution of the function block is enabled and no detected error occurred, “q_xActive” is “true”. If a detected error occurs during the execution of the function block, this is signaled by a rising edge on “q_xError”. The retrieval of cyclic input data and execution of the function block is halted. Additionally, “q_dwErrorID” provides details about what kind of detected error occurred using one of the error code values from the data block ConstTeSysIsland (see Data Block ConstTeSysIsland). At the same time, all outputs of the function block which are results of either cyclic or acyclic communication with the TeSys island are reset to their respective default values. This means the following:
-
All results of numeric (INT, UINT, …) of bitfield (WORD, DWORD, …) type are set to 0
. -
All results of string type are set to an empty string.
-
All results of Boolean type are set to FALSE.
-
All results of the date and time type (DTL in this library) are reset to the minimal value of that type (DTL#1970-01-01-00:00:00.0).
-
All results grouped into a user defined type (UDT) or struct are reset to the default values specified in the type definition. These in general also follow the rules above.
![]() |
---|
Unintended equipment operation
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
|
The function block only leaves the detected error state after a new rising edge on “i_xEnable” is detected, and if the condition that led the function block to enter the detected error state has been cleared.