FC200x – PCI cards for Lightbus

Diagnostics with function blocks

The TwinCAT automation software from Beckhoff provides various function blocks (FBs) for diagnostic purposes.

Lightbus-specific function blocks

Function block
Description
IOF_LB_BreakLocationTest
Carries out a break point test in the Lightbus optical fiber ring, in order to locate any break points.
IOF_LB_ParityCheck
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

Function block
Description
IOF_GetBoxCount
Counts the number of I/O boxes (box = slave, module, station) of an I/O device (e.g. a fieldbus card).
IOF_GetBoxAddrByName
Determines the physical box number in the optical fiber ring through the box identifier and the device ID (no. of the fieldbus card).
IOF_GetBoxNameByAddr
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

NETID
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.
DEVICEID
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.
START
A rising edge at the START input activates the FB.
TMOUT
Used to specify the length of the timeout that may not be exceeded during execution of the ADS command.

Output variables

BUSY
When activated, the FB sets the output BUSY. The output remains set as long as the FB is active.
ERR
If an ADS error occurs during the transfer of the command, the function block resets the BUSY output and sets the ERR output.
ERRID
In the event of an error, the ERRID output returns the ADS error number.
BREAK
This flag is set if a break location is detected in the optical fiber ring.
BOXNO
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

NETID
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.
DEVICEID
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.
START
A rising edge at the START input activates the FB.
TMOUT
Used to specify the length of the timeout that may not be exceeded during execution of the ADS command.

Output variables

BUSY
When activated, the FB sets the output BUSY. The output remains set as long as the FB is active.
ERR
If an ADS error occurs during the transfer of the command, the function block resets the BUSY output and sets the ERR output.
ERRID
In the event of an error, the ERRID output returns the ADS error number.
BOXCOUNT
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.