Extended instructions
9.7 Diagnostics (PROFINET or PROFIBUS)
S7-1200 Programmable controller
468 System Manual, V4.2, 09/2016, A5E02486680-AK
You can use the DeviceStates instruction to return the states of all distributed I/O slave
devices connected to a specified distributed I/O Master.
Table 9- 156 DeviceStates instruction
laddr:=_word_in_,
mode:=_uint_in_,
state:=_variant_inout_);
DeviceStates retrieves the I/O device opera-
tional states of an I/O subsystem. After execu-
tion, the STATE parameter contains the error
state of each I/O device in a bit list (for the
assigned LADDR and MODE). This information
corresponds with the device status seen in the
STEP 7 diagnostics view.
The LADDR input of DeviceStates uses the
hardware identifier of a distributed I/O interface.
In the TIA portal, the hardware identifiers for a
PLC can be found by looking for
"HW_IOSYSTEM" data types in the system
constants tab in the PLC tag table.
Table 9- 157 Data types for the parameters
Logical address: (Identifier for the I/O system)
MODE IN UInt Supports five modes of operation. The MODE input determines
which data will be returned to the location specified for STATE
information. The modes are as follows:
• 1: Device configuration active
• 2: Device defective
• 3: Device disabled
• 4: Device exists
• 5: Problem in Device
STATE
1
InOut Variant Buffer that receives the error status of each device: The data type
that you choose for the STATE parameter can be any bit type
(Bool, Byte, Word, or DWord) or an array of a bit type
• Bit 0 of the first byte of the returned STATE data is a summary
bit. When it is set to TRUE, it indicates that other data is avail-
able.
• The data returned by the STATE parameter shows a one-to-
one correlation between a bit location and a distributed I/O ad-
dress. This device addressing is TRUE for PROFIBUS and
PROFINET. For example, Bit 4 in the first Byte correlates to
PROFIBUS address 4 or PROFINET device number 4.
1
For PROFIBUS-DP, the length of the status information is 128 bits. For PROFINET I/O, the length is 1024 bits.