2 Configuring Central Racks
STEP 7 V5.3 Service Pack 1
3.10.3 Programming DPV1 Devices
New Interrupt OBs for DPV1 Events
DPV1 Slaves can trigger interrupts. You can use the respective OBs the S7 CPU operating system provides up to now for Diagnostic/System/Extraction/Insertion Interrupts.
New are the OBs for the following interrupts:
DPV1 Interrupt OB Explanation
Status Interrupt OB 55 A Status Interrupt can be triggered by the operating state transition of a module, for example, from RUN to STOP mode.
Refer to the respective DPV1 Slave manufacturer's documentation for detailed information on events that can trigger a Status Interrupt.
Update Interrupt OB 56 An Update Interrupt can be triggered after a slot was reconfigured. For example, this might occur as a result of local or remote access to the parameters.
Refer to the respective DPV1 Slave manufacturer's documentation for detailed information on events that can trigger an Update Interrupt.
Manufacturer Specific Interrupt
OB 57 The event triggering a Manufacturer Specific Interrupt can be specified by the manufacturer of a DPV1 Slave
Configuring the Distributed I/O (DP)
New SFBs and SFCs for Accessing DPV1 Slaves
In order to make the topic more comprehensive, the table below shows - wherever possible - the new interfaces and their functions compared with previous interfaces.
You can find detailed information in the descriptions of the SFBs/SFCs and new OBs. A conversion of existing configurations to the new SFBs/SFCs is not necessarily required. However, you should use the new SFCs/SFBs when you create new projects with a DPV1 configuration to be able to use all DPV1 functions.
Function Previous Interface New Interface (DPV1) Comments
Read Data Record SFC 59 RD_REC SFB 52 RDREC -
Write Data Record SFC 58 WR_REC SFB 53 WRREC -
Receive interrupt from a DP Slave
- SFB 54 RALRM The SFB must be called in the OB that is triggered by the interrupt.
Hinweis
Wenn ein DPV1-Slave über GSD-Datei projektiert ist (GSD ab Rev. 3) und die DP-Schnittstelle des DP-Masters ist auf "S7-kompatibel" eingestellt, dürfen im Anwenderprogramm keine Datensätze mit SFC 58/59 bzw. SFB 53/52 von den E/A-Baugruppen gelesen bzw. beschrieben werden. Der DP-Master adressiert in diesem Fall den falschen Steckplatz (projektierter Steckplatz+3).
Abhilfe: Schnittstelle des DP-Masters auf "DPV1" umstellen.
Checklist for Testing Existing User Programs
The following sections of your existing user program must be checked if you have edited the configuration with STEP 7 V5.1, Service Pack 2 and if you have switched to "DPV1":
Function What is to be checked?
Address conversion
For DP Slaves configured via GSD files you must check the assignments Slot <->
Logic Start Address, if you have used address conversion in the user program (SFC 5, SFC 49, SFC 50). Slot 0 has an additional address.
• DP Slave implemented via GSD File:
Previously the first I/O module of the DP Slave was assigned to slot 4. However, the first I/O module is now assigned to slot (as you can see in the hardware configuration).
• DP Slave integrated in STEP 7 (for example, ET 200M):
the interface module (slot 2) has its own address.
Reading Diagnostics with SFC 13
The originally assigned diagnostic address still functions. STEP 7 assigns this address internally to slot 0.
However, the diagnostic data record of DPV1 Slaves has a different structure (refer to the description of DP Slaves. With ET 200M, for example, also refer to the keyword
"Extended Diagnostics").
Reading/Writing Data Records
If you transfer data records to a DPV1 slave with SFC58 "WR_REC" or if you fetch data records from a DPV1 slave with SFC59 "RD_REC" and if this DPV1 slave operates in DPV1 mode, the DP Master evaluates the error information it received from the Slave as follows: If the error information lies within the range from W#16#8000 to W#16#80FF or W#16#F000 to W#16#FFFF the DP master passes the error information to the SFC. If it lies out of this range, the CPU passes the value W#16#80A2 to the SFC and suspends the slave. For a description of the error information received from DPV1-Slaves, see Receiving an Interrupt from a DP-Slave with SFB 54 "RALRM" STATUS[3].
See also: Jumps to Language Descriptions and Help on Blocks, System Attributes
Configuring the Distributed I/O (DP)
Function What is to be checked?
Reading the System Status List
If you use SFC 51 (RDSYSST), for example, to read out information on module status or module rack/station status, you must take into consideration the changed
significance of the slots and of the additional slot 0 (see above).
Example 1: Evaluating Interrupt Info from OB 40 with SFB 54 "RALRM"
A distributed S7 digital input module (Start address 288) triggers a Hardware Interrupt. The supplementary interrupt information on this module is to be read from OB 40 via call of SFB 54 "DP_ALRM". It is checked whether the first channel has triggered a hardware interrupt.
You could also read out additional interrupt information with S7 modules directly from the start information of OB 40. However, the DPV1 standard generally permits up 59 bytes of additional interrupt information - too much for the OB 40 start information.
For information on the SFB 54 and the structure of additional interrupt information for the various interrupt types please refer to the manual "System Software for S7-300/400 System and Standard functions" or to the corresponding Online Help.
// ...
// ...
//Switch for address that triggered the interrupt (288) L DW#16#120
T "MD10"
CALL "RALRM" , "DB54"
MODE :=1 //function mode: 1 = set all
//output parameters (that is, //F_ID has no effect)
F_ID :="MD10" //start address of the slot from //which an interrupt is
//permitted
MLEN :=8 //max. length of supplementary
//interrupt info in bytes //(for example, for module
//channel status)
NEW :="Alarm_neu" //receive interrupt ? (yes = 1) STATUS:="DP_RALRM_STATUS" //Return value with function
//result/error message
ID :="Slotadresse_Alarm" //start address of the slot from //which an interrupt was
//received LEN :="Laenge_Alarminfo" //length of supplementary
Configuring the Distributed I/O (DP)
Example 2: Evaluation of Diagnostic Data in OB 82 with SFB 54 "RALRM"
The target area for diagnostic data must be large enough to hold standard diagnostics (6 bytes), identifier specific diagnostics (3 bytes for 12 slots) and the evaluation of device-specific diagnostics (module status only, which requires 7 more bytes).
Extended evaluation (channel-specific diagnostics) would require the reservation of additional bytes, provided the DP Slave supports this function.
// ...
//which the diagnosis is to be fetched MLEN :=20 //max. length of diagnostic data in bytes NEW :="neu" //irrelevant
STATUS:="RET_VAL" //function result, error message
ID :="Slotadresse_Alarm" //start address of the slot from which an //interrupt was received
LEN :="Laenge_Alarminfo" //length of the supplementary interrupt //info (4 bytes header info+16 bytes //diagnostic data
TINFO :=P#M 100.0 BYTE 28 //pointer for OB start info + management //info: 28 bytes as of MB 100
AINFO :=P#M 130.0 BYTE 20 //pointer to the target area in which the //diagnostic data is to be stored
// ...
//Structure of the stored diagnostic data:
// MB 130 to MB 133: header info (length, identifier, slot) // MB 134 to MB 139: Standard Diagnostics (6 bytes)
// MB 140 to MB 142: identifier specific diagnostics (3 bytes) // MB 143 to MB 149: module status (7 bytes)
Configuring the Distributed I/O (DP)