Diagnostics with function blocks
The TwinCAT automation software from Beckhoff provides various function blocks (FBs) for diagnostic purposes.
Lightbus-specific function blocks
|
| Carries out a break point test in the Lightbus optical fiber ring, in order to locate any break points. |
| Reads the parity error counter of the Lightbus modules (e.g. BK2000). |
IOF_LB_ParityCheckWithReset | Reads the parity error counter of the Lightbus modules (e.g. BK2000) and resets the error counters. |
General function blocks
|
| Counts the number of I/O boxes (box = slave, module, station) of an I/O device (e.g. a fieldbus card). |
| Determines the physical box number in the optical fiber ring through the box identifier and the device ID (no. of the fieldbus card). |
| Determines the box identifier via the physical box number in the optical fiber ring and the device ID (no. of the fieldbus card). |
The function blocks IOF_LB_BreakLocationTest and IOF_GetBoxCount are described as examples below. Detailed documentation about these and further function blocks can be found in the Beckhoff Information System, which is supplied with the TwinCAT automation software and is also included on the Products & Solutions CD from Beckhoff.
IOF_LB_BreakLocationTest
Function block IOF_LB_BreakLocationTest
The function block IOF_LB_BreakLocationTest carries out a break point test in the Lightbus optical fiber ring in order to locate any break points. If no break location is detected during the test, the output variable BOXNO returns the current number of Lightbus modules in the ring. If a break location is detected before the nth module in front of the receiver input, the BREAK flag is set and the module number is provided via the output variable BOXNO. If the BOXNO variable returns a value of 0xFF the break location is situated immediately in front of the receiver input, and can not be located.
Input variables
| This can be used to transfer the AmsNetId of the computer on which the FB is to be executed. If an empty string is transferred, the FB is executed on the local computer. |
| This device ID specifies the device (e.g. the fieldbus card) on which the function is to be executed. The device IDs are specified by the TwinCAT System Manager during hardware configuration. |
| A rising edge at the START input activates the FB. |
| Used to specify the length of the timeout that may not be exceeded during execution of the ADS command. |
Output variables
| When activated, the FB sets the output BUSY. The output remains set as long as the FB is active. |
| If an ADS error occurs during the transfer of the command, the function block resets the BUSY output and sets the ERR output. |
| In the event of an error, the ERRID output returns the ADS error number. |
| This flag is set if a break location is detected in the optical fiber ring. |
| The module number before the receiver input in front of which the break location has been detected. |
Further information for the use of this function block can be found in the Beckhoff Information System.
IOF_GetBoxCount
The function block IOF_GetBoxCount can be used to determine the number of configured and active I/O boxes (modules) of an I/O device (fieldbus card).
Function block IOF_GetBox_Count
Input variables
| This can be used to transfer the AmsNetId of the computer on which the FB is to be executed. If an empty string is transferred, the FB is executed on the local computer. |
| This device ID specifies the device (e.g. the fieldbus card) on which the function is to be executed. The device Ids are specified by the TwinCAT System Manager during the hardware configuration. |
| A rising edge at the START input activates the FB. |
| Used to specify the length of the timeout that may not be exceeded during execution of the ADS command. |
Output variables
| When activated, the FB sets the output BUSY. The output remains set as long as the FB is active. |
| If an ADS error occurs during the transfer of the command, the function block resets the BUSY output and sets the ERR output. |
| In the event of an error, the ERRID output returns the ADS error number. |
| After successful execution of the function block, the output BOXCOUNT returns the number of I/O modules (boxes) found. |
Further information for the use of this function block can be found in the Beckhoff Information System.