This PLC function block reads the diagnosis information from ctrlX SAFETY controller SAFEX-C.1x and monitors the communication.
It exists in two types:
FB-Type1 (original): FB “SAFEX_Diagnosis_1V04“ for firmware/FPGA <= 1.0.1.53/221 with ENG-Version <= 1.8.3.10207 (official version since September 2024)
FB-Type2 (extended): FB “SAFEX_Diagnosis_2V00” for firmware/FPGA >= 1.0.1.65/227 with ENG-Version >= 1.8.7.10917 (new official version since April 2026)
If you use a SAFEX-C.1x as an EtherCAT SubDevice with ctrlX CORE as EtherCAT MainDevice you need the status information from the safety controller. You find this information at the Functional Outputs from SAFEX-C.1x as Input for the PLC:
FB-Type1 and 2: The first five bytes include the Mode (device status), the LiveCounter, the ErrorCode etc. of the SAFEX-C.1x. To make the access to this information easier you can use this function block.
FB-Type2 provides this information too and additional diagnosis information like CRC, FW-version etc.
Make sure that the “Additional diagnostic” is activated in the properties of the SAFEX-C.1x for both FB-Types:
In addition for FB-Type2 the “Add Non-Cyclic Data” must be activated as well.
The functionality and how to enable the new feature is described in the manual (Remark: will be officially released soon, here the preview:)
Note: For elements 4, 5, 6 (CRC_PMT-), "0" is supplied (not used).
For better use of real names, a user type (ENUM) is used for FB-Type2 for the Non-cyclic Data:
Note: There is nothing to program in the SAFEX-C1.x; but in the ctrlX PLC project only.
How to program it within user’s PLC program?
Step 1: Import the attached function block* for either FB-Type1 (SAFEX_Diagnosis_1V04.export) or FB-Type2 (SAFEX_Diagnosis_2V00.export)
Note: After downloading unzip the attached *.zip-file before import the *.export-file.
Note: *The import-file for FB-Type2 contains not only the function block itself, but also an easy program example for the implementation (optional proposal), see below Step 2b.
Step 2a for FB-Type1: Call an instance of this function block
You need the start address (pointer) of the FunctionalOutput as an Input, in this example ADR(%IW40) (see screenshot above).
With FieldbusType you distinguish between EtherCAT (FALSE, default) or PROFINET (TRUE).
The function block gives you as Outputs:
Mode: Device status: 1 = Init, 2 = Self-test, 3 = BusInit, 4 = Run, 5 = Stop, 8 = RunIntern; 6 = Fatal Error, 7 = Alarm
Device status as BOOL-signals: FatalError, Alarm, RunIntern, Run
LiveCounter: As long the value counts the communication is OK
ErrorCode: Includes the ErrorCode in case Warning or Alarm is activeCommunicationOK: If this bit is TRUE, then the communication is OK
Step 2b for FB-Type2 only: Call an instance of this function block
The function block is also embedded in an easy program example:
In addition for FB-Type2 (compared to FB-Type1), the function block has two further inputs and outputs:
FunctionalInput: start address (pointer) of the FunctionalInput as an Output, in this example ADR(%QB48) (see screenshot above)
NonCyclicCommand: ENUM (integer), Command/Request for the non-cyclic data to be read
NonCyclicResult: ENUM (integer), Result of the non-cyclic data (such as an acknowledgment when reading)
NonCyclicData: Value of the read non-cyclic data
In the example program, all Non-Cyclic Data are stored in an array:
PS: How-to created by Dias (FB-Type1); extension (FB-Type2) and current contact: Thoomas