Siemens TIA Portal software provides the DeviceStates and ModuleStates instructions for diagnosing the state of remote I/O modules. This article uses the Siemens 1212C V4.5 PLC communicating with the PROFINET Protocol Coupler XB6S-PN2002 as an example for illustration.

Create a new program and successfully communicate with the coupler XB6S-PN2002. Preparation is complete.

I. Read the status of the coupler XB6S-PN2002 in the network via the DeviceStates instruction
1. Create a global data block and create a Device array to view the module status

2. Call the program block and add the array

Click LADDR to select the system to be diagnosed. In this example, the PN network system is checked. The MODE parameter is shown in the figure; this case uses 2 for illustration. Add the Device array created above to STATE.

3. Test function
Download the program and monitor the Device array.

Check the communication status of the module according to the device number. When device 1 fails to communicate, has a fault, or has poor cable wiring, Device[1] is TRUE.

II. Read the status of the coupler and submodules via the ModuleStates instruction
1. Create a global data block and create a Module array to monitor the status of the coupler and submodules

2. Call the program block and add the array

Click LADDR to select the coupler to be monitored. In this case, select the coupler with the device name "pnio". The MODE parameter is shown in the figure; this case uses 5 for illustration. Add the Module array created above to STATE.

3. Test function
Download the program and monitor the Module array.

The current module and submodules are normal. If a module fails to communicate, or a submodule generates alarm information such as maintenance required, this can be viewed by monitoring the array.

Example
An I/O system contains 5 modules, located in slots 1 to 5 respectively. Among them, the modules in slot 1 and slot 3 have alarms requiring maintenance. For an I/O system with MODE = 5 (maintenance required or recommended/inaccessible/unavailable/faulty), execute the "ModuleStates" instruction.
The following bits are set in the STATE parameter —
Bit 0 = 1: At least one module has a fault.
Bit 1 = 0: Slot number 0 (used by the IO device)
Bit 2 = 1: the module in slot number 1 has an alarm.
Bit 3 = 0: no fault has occurred in the module in slot number 2.
Bit 4 = 1: the module in slot number 3 has an alarm.
Bit 5 = 0: no fault has occurred in the module in slot number 4.
Bit 6 = 0: no fault has occurred in the module in slot number 5.
Bit 7 = 0: not relevant
The above is the method for the Shidian Technology remote I/O module XB6S PROFINET Protocol coupler to read module status via in-program variables. Thank you for watching!