8.3
Receiving an Interrupt with SFB 54 "RALRM"
Note
The SFB52 "RALRM" interface is identical to the FB "RALRM" defined in the standard "PROFIBUS Guideline PROFIBUS Communication and Proxy Function Blocks according to IEC 61131-3"
Description
The SFB "RALRM" receives an interrupt with all corresponding information from an I/O module (centralized structure) or from a DP slave or PROFINET IO device component. It supplies this information to its output parameters.
The information in the output parameters contains the start information of the called OB as well as information on the interrupt source.
Call the SFB54 only within the interrupt OB started by the CPU operating system in order to examine the I/O interrupt.
Note
If you call SFB54 "RALRM" in an OB for which the start event was not triggered by I/Os, the SFB supplies correspondingly reduced information on its outputs.
Make sure to use different instance DBs when you call SFB 54 "RALRM" in different OBs. If you want to evaluate data that are the result of an SFB54 call outside of the associated interrupt OB you should moreover use a separate instance DB per OB start event.
8.3 Receiving an Interrupt with SFB 54 "RALRM"
System Software for S7-300/400 System and Standard Functions Volume 1/2
170 Reference Manual, 05/2010, A5E02789976-01
Call of the SFB 54
You can call the SFB54 "RALRM" in three operating modes (MODE). They are explained in the table below.
MODE The SFB54 ...
0 ... shows the component that triggered the interrupt in the output parameter ID and sets the output parameter NEW to TRUE.
1 ... describes all output parameters, independent on the interrupt triggering component.
2 ... checks whether the component specified in input parameter F_ID has triggered the interrupt. • If not, NEW = FALSE
• If yes, NEW = TRUE, and all other outputs parameters are described
Parameters Declaration Data type Memory Area Description
MODE INPUT INT I, Q, M, D, L, constant Operating mode
F_ID INPUT DWORD I, Q, M, D, L, constant Logical start address of the component (module) from which interrupts are to be received
MLEN INPUT INT I, Q, M, D, L, constant maximum length in bytes of the data interrupt information to be received NEW OUTPUT BOOL I, Q, M, D, L A new interrupt was received. STATUS OUTPUT DWORD I, Q, M, D, L Error code of the SFB or DP Master ID OUTPUT DWORD I, Q, M, D, L Logical start address of the component
(module) from which an interrupt was received.
Bit 15 contains the I/O ID: 0 for an input address; 1 for and output address LEN OUTPUT INT I, Q, M, D, L Length of the received interrupt
information TINFO IN_OUT ANY I, Q, M, D, L (task information)
Target range for OB start and management information AINFO IN_OUT ANY I, Q, M, D, L (interrupt information)
Target area for header information and additional interrupt information
For AINFO you should provide a length of at least MLEN bytes.
Caution
If you select a target area TINFO or AINFO that is too short the SFB54 cannot enter the full information.
8.3 Receiving an Interrupt with SFB 54 "RALRM"
Data structure of the target area TINFO
Byte Meaning
0 to 19 Start information of the OB in which SFB54 was currently called:
• Byte 0 to 11: structured like the parameter TOP_SI in SFC 6 "RD_SINFO"
• Byte 12 to 19: date and time the OB was requested 20 and 21 Address, for exact description, see below
22 to 31 Management information, for exact description, see below
Structure of the address (bytes 20 and 21)
The address contains:
• In a central configuration, the rack number (0-31).
• In a distributed configuration with PROFIBUS DP
- The DP master system ID (1-32) - The station number (0-127).
• In a distributed configuration with PROFINET IO:
- The last two position in the PROFINET IO system ID (0-15). To obtain the complete PROFINET IO system ID, you must add 100 (decimal) to it.
- The station number (0-2047).
8.3 Receiving an Interrupt with SFB 54 "RALRM"
System Software for S7-300/400 System and Standard Functions Volume 1/2
172 Reference Manual, 05/2010, A5E02789976-01
Structure of the Management Information for Bytes 20 to 25
Byte no. for TINFO
Data type Meaning
central: 0
PROFIBUS DP: DP master system ID (possible values 1 to 32) PROFINET IO: see above
20 BYTE distributed:
central: Module rack number (possible values: 0 to 31 Number of the DP station (possible values: 0 to 127
PROFINET IO: see above 21 BYTE
distributed:
central: • 0 record 0 or record 1 • Bit 0 to 3: Slave type 0000: 0001: 0010: 0011: 0100 – 0111: 1000: as of 1001: DP (record 0 structure 0) DPS7 (record 0 or record 1 structure 1) DPS7 V1 (record 0 or record 1 structure 1) DPV1 (structure acc. To PROFIBUS DP standard) reserved
PROFINET IO (structure acc. To PROFINET IO Standard) reserved 22 BYTE • distributed: • Bit 4 to 7: Profile type reserved central: • 0
0000: Transparent, which is always the case for PROFINET IO (interrupt originates from a configured distributed module) 0001: Dummy
(interrupt originates from a non-DPV1 slave/non IO device or a slot that is not configured)
0010: Generated
(interrupt generated in the CPU) • Bit 0 to 3: Interrupt info type as of 0011: reserved 23 BYTE distributed: • Bit 4 to 7: Structure version 0000: as of 0001: Initial reserved
8.3 Receiving an Interrupt with SFB 54 "RALRM"
Byte no. for TINFO
Data type Meaning
central: 0
Flags of the PROFIBUS DP master interface module/PROFINET IO controller master interface module
• Bit 0 = 0:
Interrupt originating from an integrated DP interface PROFINET IO or PROFIBUS DP)
• Bit 0 = 1:
Interrupt originating from an external DP interface module (PROFINET IO or PROFIBUS DP) 24 BYTE distributed: • Bit 1 to 7: reserved central: 0
Flags of the PROFIBUS DP slave interface module
• Bit 0: EXT_DIAG_FLAG bit of the diagnostic message frame, or 0 if this bit does not exist in the interrupt
The bit is 1 if the DP slave is faulty. • Bit 1
to 7:
reserved •
• Flags of the PROFINET IO controller interface module
• Bit 0: APDU.datastatus.failure bit of the interrupt message frame or 0 if there is no information in the interrupt
The bit is 1 if the IO device is faulty. 25 BYTE
distributed:
• Bit 1 to 7:
reserved
Structure of the Management Information for Bytes 26 to 27 with PROFIBUS and a Central Configuration
Byte no. for TINFO
Data type Meaning
WORD central: 0
26 and 27
WORD distributed: PROFIBUS ID number as unique identifier of the PROFIBUS DP slave
28 and 29 WORD 0 (Bytes 28 and 29 can be omitted) 30 and 31 WORD 0 (Bytes 30 and 31 can be omitted)
This is the end of the management information for the TINFO target area with PROFIBUS and a central configuration.
8.3 Receiving an Interrupt with SFB 54 "RALRM"
System Software for S7-300/400 System and Standard Functions Volume 1/2
174 Reference Manual, 05/2010, A5E02789976-01
Structure of the Management Information for Bytes 26 to 31 with PROFINET IO
Byte no. for TINFO
Data type Meaning
26 and 27 WORD distributed: PROFINET IO device ID number as unique identifier of the PROFINET IO device
28 and 29 WORD distributed: Manufacturer ID
30 and 31 WORD distributed: ID number of the instance
Data Structure of the Target Area AINFO with Interrupts from PROFINET DP or Central IO Devices
The information for PROFINET IO are found further below.
Byte Meaning
0 to 3 • Header information, for an exact description, see below
4 to 199 • Additional interrupt information: data for the respective interrupt: Central: ARRAY[0] to ARRAY[195]
Distributed: ARRAY[0] to ARRAY[59]
Structure of the Header Information with Interrupts from PROFINET DP or Central IO Devices
Byte Data type Meaning
Length of the received interrupt information in bytes 0 BYTE central: distributed: 4 to 224 4 to 63 local: reserved
ID for the interrupt type
1: 2: 3: 4: 5: 6: 31 Diagnostic interrupt Hardware interrupt Removal interrupt Insertion interrupt Status interrupt Update Interrupt
Failure of an expansion device, DP master system or DP station
1 BYTE
distributed:
32 to 126 Manufacturer-specific interrupt 2 BYTE Slot number of the interrupt-triggering component
8.3 Receiving an Interrupt with SFB 54 "RALRM"
Byte Data type Meaning
central: reserved Identifier
Bits 0 and 1 0: no further information
1: upcoming event, disrupted slot
2: outgoing event, slot not disrupted anymore 3: outgoing event, slot still disrupted
Bit 2: Add_Ack 3 BYTE
distributed:
Bits 3 to 7: Sequence number
Data Structure of the Target Area AINFO with Interrupts from PROFINET IO
Byte Meaning
0 to 25 Header information, for an exact description, see below
26 to 1431 Additional interrupt information: standardized diagnostic data for each interrupt: ARRAY[0] to ARRAY[1405]
8.3 Receiving an Interrupt with SFB 54 "RALRM"
System Software for S7-300/400 System and Standard Functions Volume 1/2
176 Reference Manual, 05/2010, A5E02789976-01
Structure of the Header Information with Interrupts from PROFINET IO
Byte Data type Meaning
0 and 1 WORD • Bits 0 to 7: block type • Bits 8 to 15: reserved 2 and 3 WORD Block length
4 and 5 WORD Version:
• Bits 0 to 7: low byte • Bits 8 to 15: high byte 6 and 7 WORD Identifier for the interrupt type:
• 1: Diagnostic interrupt (incoming) • 2: Hardware interrupt • 3: Removal interrupt • 4: Insertion interrupt • 5: Status interrupt • 6: Update interrupt • 7: Redundancy interrupt • 8: Controlled by supervisor • 9: Released by supervisor
• 10: Configured module not inserted • 11: Return of submodule
• 12: Diagnostic interrupt (exiting state)
• 13: Direct data exchange connection message • 14: Neighborhood change message
• 15: Clock synchronization message (from bus) • 16: Clock synchronization message (from device) • 17: Network component message
• 18: Time synchronization message (from bus) • 19 to 31: Reserved
• 32 to 127: Vendor-specific interrupt • 128 to 65535: Reserved
8 to 11 DWORD API (Application Process Identifier)
12 to 13 WORD Slot number of the component triggering the interrupt (range of values 0 to 65535) 14 to 15 WORD Interface module slot number of the component triggering the interrupt (range of
values 0 to 65535)
16 to 19 DWORD Submodule identification; specific information on the source of the interrupt 20 to 23 DWORD Interface module identification; specific information on the source of the interrupt
8.3 Receiving an Interrupt with SFB 54 "RALRM"
Byte Data type Meaning
24 to 25 WORD Interrupt specifier:
• Bits 0 to 10: Sequence number (range of values: 0 to 2047) • Bit 11: Channel diagnostics:
0: No channel diagnostics available 1: Channel diagnostics available
• Bit 12: Status of manufacturer-specific diagnostics : 0: No manufacturer-specific status information available 1: Manufacturer-specific status information available • Bit 13: Status of diagnostics for interface module:
0: No status information available; all errors corrected
1: Diagnostics for at least one channel and/or status information available • Bit 14: Reserved
• Bit 15: Application Relationship Diagnosis State
- 0: None of the configured modules within this AR is reporting a diagnosis - 1: At least one of the configured modules within this AR is reporting a
diagnosis
Structure of Additional Interrupt Information with Interrupts from PROFINET IO
The additional interrupt information for PROFINET IO depends on the format identifier. It can comprise several blocks of data with the same or different format ID. The following format identifiers are
available:
W#16#0000 to W#16#7FFF: Manufacturer-specific diagnostics.
Byte Data type Meaning
0 to 1 WORD Format identifier for the structure of the following data serving as additional interrupt information
W#16#0000 to W#16#7FFF: manufacturer-specific diagnostics 2 to n BYTE See manufacturer's manual
8.3 Receiving an Interrupt with SFB 54 "RALRM"
System Software for S7-300/400 System and Standard Functions Volume 1/2
178 Reference Manual, 05/2010, A5E02789976-01
• W#16#800o: Channel diagnostics
Channel diagnostics is output in blocks of 6 bytes each. The additional interrupt information (without format identifier) is only output for disrupted channels.
Byte Data type Meaning
0 to 1 WORD Format identifier for the structure of the following data serving as additional interrupt information
W#16#8000: Channel diagnostics
2 to 3 WORD Channel number of the component triggering the interrupt (range of values: 0 to 65535):
• W#16#0000 to W#16#7FFF: Channel number of the interface module/submodule
• W#16#8000: The generic substitute for the whole interface module • W#16#8001 to W#16#FFFF: Reserved
Bits 0 to 2 Reserved Bits 3 to 4 Type of error:
• 0: reserved • 1: incoming error • 2: outgoing error
• 3: outgoing error, other errors present 4 BYTE
Bits 5 to 7: Type of channel: • 0: reserved • 1: input channel • 2: output channel • 3: input/output channel
5 BYTE Data format:
• B#16#00: free data format • B#16#01: bit • B#16#02: 2 bits • B#16#03: 4 bits • B#16#04: byte • B#16#05: word • B#16#06: double word • B#16#07: 2 double words B#16#08 to B#16#FF: reserved
8.3 Receiving an Interrupt with SFB 54 "RALRM"
Byte Data type Meaning
6 to 7 WORD Type of error:
• W#16#0000: reserved • W#16#0001: short circuit • W#16#0002: undervoltage • W#16#0003: overload • W#16#0004: overload • W#16#0005: excessive temperature • W#16#0006: line break
• W#16#0007: upper limit value overshot • W#16#0008: lower limit value undershot • W#16#0009: error
• W#16#000A to W#16#000F: reserved
• W#16#0010 to W#16#001F: manufacturer-specific • W#16#0020 to W#16#00FF: reserved
• W#16#0100 to W#16#7FFF: manufacturer-specific • W#16#8000: device diagnosis available
• W#16#8001 to W#16#FFFF: reserved
Not all channels support every error type. For detailed information, refer to the description of the diagnostic data for the specific device.
Note
8.3 Receiving an Interrupt with SFB 54 "RALRM"
System Software for S7-300/400 System and Standard Functions Volume 1/2
180 Reference Manual, 05/2010, A5E02789976-01
• W#16#8001: MULTIPLE (different types of diagnostic information are transmitted). In this case, the additional interrupt information is transmitted as blocks of variable length.
Byte Data type Meaning
0 to 1 WORD Format identifier for the structure of the following data serving as additional interrupt information
W#16#8001: Manufacturer-specific diagnostics and/or channel diagnostics 2 to 3 WORD Block type
4 to 5 WORD Block length 6 BYTE Version: high byte 7 BYTE Version: low byte
8 to 11 DWORD API (only if low byte of version = 1) 12 to 13 WORD Slot number
14 to 15 WORD Subslot number 16 to 17 WORD Channel number 18 to 19 WORD Channel properties 20 o 21 WORD Format identifier:
• W#16#0000 to W#16#7FFF: manufacturer-specific diagnostics • W#16#8000: channel diagnostics
• W#16#8002: extended channel diagnostics
• W#16#8003: stepped extended channel diagnostics • W#16#8004 to W#16#80FF: reserved
22 to n BYTE Data depend on the format identifier
Note
The section starting from "block type" can occur from 0 to n times. • W#16#8002: Extended channel diagnostics
Byte Meaning
0 to 1 Format ID W#16#8002 2 to 3 Channel number 4 to 5 Channel properties 6 to 7 Error type
8 to 9 Additional error value 10 to 13 Additional error information
8.3 Receiving an Interrupt with SFB 54 "RALRM" • W#16#8003: Stepped extended channel diagnostics
Byte Meaning
0 to 1 Format ID W#16#8003 2 to 3 Channel number 4 to 5 Channel properties 6 to 7 Error type
8 to 9 Additional error value 10 to 13 Additional error information 14 to 17 Qualified Channel Qualifier
• W#16#8100: Maintenance information Byte Meaning 0 to 1 Format ID W#16#8100 2 to 3 Block type 4 to 5 Block length 6 to 7 Block version 8 to 9 Reserved 10 to 13 Maintenance status Note
You can find more detailed information about configuring the additional alarm information in the
Programming Manual SIMATIC PROFINET IO from PROFIBUS DP to PROFINET IO and the current
8.3 Receiving an Interrupt with SFB 54 "RALRM"
System Software for S7-300/400 System and Standard Functions Volume 1/2
182 Reference Manual, 05/2010, A5E02789976-01
Target Area TINFO and AINFO
Dependent on the respective OB in which SFB54 is called, the target areas TINFO and AINFO are only partially written. Refer to the table below for information on which info is entered respectively.
Interrupt type OB TINFO OB status information TINFO management information AINFO header information AINFO additional interrupt information Hardware interrupt
4x Yes Yes Yes central: No
distributed: as delivered by the PROFIBUS DP slave/PROFINET IO device
Status interrupt 55 Yes Yes Yes Yes Yes
Update Interrupt 56 Yes Yes Yes Yes Yes
manufacturer specific interrupt
57 Yes Yes Yes Yes Yes
I/O
redundancy error
70 Yes Yes No No No
Diagnostic interrupt
82 Yes Yes Yes central: Data record 1
distributed: As delivered by the PROFIBUS DP slave/PROFINET IO device
Removal/ Insertion interrupt
83 Yes Yes Yes central: No
distributed: as supplied by PROFIBUS DP slave/PROFINET IO device Special form of the removal interrupt: Controlled by supervisor
83 Yes Yes Yes Only PROFINET IO
Special form of the insertion interrupt: Controlled by supervisor
83 Yes Yes Yes Only PROFINET IO
Unconfigured module inserted
83 Yes Yes Yes Only PROFINET IO
Module rack/ Station failure
86 Yes Yes No No
...
all other OBs
8.3 Receiving an Interrupt with SFB 54 "RALRM"
Error Information
The output parameter STATUS contains information. It is interpreted as ARRAY[1...4] OF BYTE the error information has the following structure:
Field element Name: Meaning
STATUS[1] Function_Num • B#16#00, if no error
• Function ID from DPV1-PDU: If an error occurs reading a data record B#16#DE, if an error occurs writing a data record B#16#DF. If no DPV1 protocol element is used: B#16#C0.
STATUS[2] Error_Decode Location of the error ID
STATUS[3] Error_Code_1 Error ID
STATUS[4] Error_Code_2 Manufacturer specific error ID expansion
STATUS[2] can have the following values:
Error_Decode (B#16#...)
Source Meaning
00 to 7F CPU No error or no warning
80 DPV1 Error according to IEC 61158-6
81 to 8F CPU B#16#8x shows an error in the nth call parameter of the SFB. FE, FF DP Profile Profile-specific error
STATUS[3] can have the following values:
Error_Decode (B#16#...) Error_Code_1 (B#16#...) Explanation according to DVP1 Meaning 00 00 no error, no warning
00 reserved, reject initial call; no active data record transfer 01 reserved, reject initial call; data record transfer has started 70
8.3 Receiving an Interrupt with SFB 54 "RALRM"
System Software for S7-300/400 System and Standard Functions Volume 1/2
184 Reference Manual, 05/2010, A5E02789976-01
Error_Decode (B#16#...) Error_Code_1 (B#16#...) Explanation according to DVP1 Meaning
90 reserved, pass invalid logical start address 92 reserved, pass illegal type for ANY pointer
93 reserved, pass The DP component addressed via ID or F_ID is not configured.
95 Error in the H system when fetching additional interrupt information (when fetching additional interrupt
information at the local or distributed I/O via an external DP interface, this error is output as "group error".) Note: When connecting or updating the additional interrupt information may not be available temporarily. 96 A master-reserve switchover has occurred in an H
system, and the previous master CPU has gone into STOP mode. At that time, an OB was being processed. SFB 54 cannot supply the OB start information, management information, header information or additional interrupt information.
You can read out the OB start information with SFC 6 "RD_SINFO". In addition, you can use SFC 13 "DPNRM_DG" to synchronously read the current diagnostic frame of the affected DP slave for OBs 4x, 55, 56, 57, 82 and 83 (Address information from the OB start information).
A0 read error Negative acknowledgement while reading the module. A1 write error negative acknowledgement while writing the module A2 module failure DP protocol error at layer 2 (e.g. slave failure or bus
problems)
A3 reserved, pass • PROFIBUS DP: DP protocol error with
Direct-Data-Link-Mapper or User-Interface/User • PROFINET IO: General CM error
A4 reserved, pass Bus communication disrupted
A5 reserved, pass –
A7 reserved, pass DP slave or modules is occupied (temporary error
A8 version conflict DP slave or modules reports non-compatible versions
A9 feature not
supported
Feature not supported by DP slave or module
AA to AF user specific DP slave or module reports a manufacturer-specific error in its application. Please check the documentation from the manufacturer of the DP slave or module.
B0 invalid index Data record not known in module Illegal data record number ≥256
B1 write length error Wrong length specified in parameter RECORD; with SFB54: length error in AINFO
with SFB52 and 53: length error in MLEN B2 invalid slot Configured slot not occupied.
80
8.3 Receiving an Interrupt with SFB 54 "RALRM" Error_Decode (B#16#...) Error_Code_1 (B#16#...) Explanation according to DVP1 Meaning
B4 invalid area DP slave or module reports access to an invalid area B5 status conflict DP slave or module not ready
B6 access denied DP slave or module denies access
B7 invalid range DP slave or module reports an invalid range for a parameter or value
B8 invalid parameter DP slave or module reports an invalid parameter B9 invalid type DP slave or module reports an invalid type
With SFB52: buffer too small (reading subsets is not possible)
With SFB53: buffer too small (writing subsets is not possible)
BA to BF user specific DP slave or module reports a manufacturer-specific error when accessing. Please check the documentation from the manufacturer of the DP slave or module.
C0 read constrain
conflict
With SFB 53 "WRREC": The data can only be written when the CPU is in STOP mode. Note: This means that data cannot be written by the user program. You can only write the data online with a PG/PC.
With SFB 52 "RDREC": The module has the data record but there is either no data available or the data can only be read when the CPU is in STOP mode. Note: If data can only be read when the CPU is in STOP mode, no evaluation by the user program is possible. In this case, you can only read the data online with a PG/PC.
C1 write constrain
conflict
The data of the previous write request to the module for the same data record have not yet been processed by