Special Hardware Requirements:
- One S7-200 CPU with a EM277 DP Module
- One S7-300 PLC, consisting of a PS 307 2A power supply unit, a CPU 315-2 DP, and an SM 374 digital input/output simulator module
- One PC/PPI cable for programming the S7-200
- One PROFIBUS cable (The cable should be terminated on both ends by means of the matching resistor integrated in the connector. The switch on each connector should be in the ON position.)
- One MPI cable for programming the S7-300
- One PC with MPI card (and the STEP 7 programming software, Version 3.1, as well as STEP 7-Micro/WIN Version 2.0)
PROFIBUS-DP (or DP Standard) is a remote I/O communication protocol defined by the European Standard EN 50 170. Devices that adhere to this standard are compatible even though they are manufactured by different companies. The name PROFIBUS stands for “Process Field Bus.” “DP” stands for “distributed peripherals,” that is, remote I/O.
|
|
The CPU 315-2 DP is the master station. The S7-200 CPU and EM 277 are used exclusively as a slave device. You must configure the CPU 315-2 DP master to communicate with the EM 277. You use the STEP 7 programming software (Version 4.02 or greater) to make the settings and to initialize the master as explained in detail below. For the configuration on the EM 277, you need only to set the slave address.
The sample program for the S7-200 demonstrates how to transfer S7-300 inputs to the outputs of the S7-200, and how to transfer S7-200 inputs to an output module of the S7-300.
How to Set the Address of the DP Slave (EM 277 PROFIBUS-DP)
- Remove power from the S7-200 CPU and the EM 277.
- Set the rotary switches on the front of the EM 277 to the desired address. The top switch (marked X10) sets the most significant digit of the address (the tens digit). The lower switch (marked X1) sets the least significant digit of the address (the ones digit). For this example, set the X1 switch to 5 and the X10 switch to 0 to select address 5 for the EM 277.
- Apply power to the S7-200 CPU and the EM 277.
Note: The address switches of the EM 277 are only read when the EM 277 is powered on. Changing the address switches of the EM 277 with power applied has no effect until the next power cycle.
How to Configure the DP Master (CPU 315-2 DP) with STEP 7
You use the STEP 7 programming software to configure the CPU 315-2 DP as a DP master device. The following steps refer to Version 4.02 of STEP 7. There may be deviations with respect to previous or later versions.
Steps for Initializing the CPU 315-2 DP:
Start the STEP 7 SIMATIC Manager (Version used is 4.02)
1. How to Set Up a New Project
In the SIMATIC Manager, from the File menu, select New….
Enter a project name, for example, DP_Connect.
Click OK.
2. How to Select the Components
a. Insert the station
From the Insert menu, select Station and then SIMATIC 300 Station.»» The icon for the SIMATIC S7-300 station is inserted into the current directory and displayed.
b. Insert the connection between the S7-300 and the S7-200
Click the project name (DP_Connect) in the left-hand pane of the window.
From the Insert menu, select Subnet and then PROFIBUS.»» The icon for the PROFIBUS Subnet is inserted into the current directory and displayed.
3. How to Configure the S7-300 Hardware
a. Start the program for the Hardware Configuration
Double-click the icon named SIMATIC 300 Station(1).»» The directory of the SIMATIC 300 station opens. An icon with the name Hardware is displayed.
Double-click the icon for Hardware.
»» The program for the hardware configuration named HW Config starts. In addition, a window with a Hardware Catalog opens.
b. Configure the S7-300 hardware with HW Config
You use the HW Config of the software to specify the S7-300 hardware (hardware used: CPU, input and output modules).Install EM 277 PROFIBUS DP
Open the PROFIBUS catalog by selecting the PLUS SIGN in front of the entry PROFIBUS–DP.
»» The PROFIBUS–DP folder opens. Different sub-items are displayed.
Open the SIMATIC catalog by selecting the PLUS SIGN in front of the entry SIMATIC.
»» The SIMATIC folder opens. Different DP devices are displayed.
If there is a listing for the EM 277 PROFIBUS‑DP, go to the next section and insert the rack. If there is no listing for the EM 277, you will have to install the GSD file. The GSD files are available for download from http://www.ad.siemens.de/csi_e/gsd. Select PROFIBUS GSD files: SIMATIC. Locate the Station type: EM277 PROFIBUS-DP section. Download the EM 277 GSD file (siem089d.gsd) and the associated bit map files (em_277_n.bmp and em_277_s.bmp).
Open the Options menu and select the Install New DDB Files… entry.
»» The Install New DDB File window opens.
Change the "Files of type:" entry to the All Files selection.
Find the .GSD and .BMP files you downloaded and select all three.
Click Open to install the EM 277 files.
Open the Options menuagain and select the Update Catalog entry. This updates the catalog to add the EM 277.
Open the Additional Field Devices catalog by selecting the PLUS SIGN in front of that entry.
»» The Additional Field Devices folder opens. Different sub-items are displayed.
Open the SIMATIC catalog by selecting the PLUS SIGN in front of the SIMATIC entry.
»» The SIMATIC folder opens. The EM 277 PROFIBUS-DP should be displayed
Insert the RACK
Open the SIMATIC 300 catalog by selecting the PLUS SIGN in front of the entry SIMATIC 300.
»» The SIMATIC 300 folder opens. Different sub-items are displayed.
Open the item RACK 300 and double-click RAIL.
»» The selected S7-300 RACK is inserted in the window for the hardware configuration in the form of a table.
Insert the RACK Components
Select the Hardware Configuration window (where the table for the RACK is located). If the window or the table is too small, you can make it larger or smaller by sizing it with the mouse and adjusting it as desired.
To insert a component in the rack, click the first row of the RACK table.
»» When you select the table row, it has a blue background.
Now insert the hardware components, one after the other, into the slots (rows) of the rack.
Insert the Power Supply (not absolutely necessary for configuration)
In the Hardware Catalog, open PS-300, and select the power supply that you want to use.
»» In this example, the hardware is equipped with the PS 307 2A power supply module. Double-click it. The PS-307 module is placed in the first position in the rack (the name of the power supply is indicated in the first row of the table).
Insert the CPU 315 DP (needs two slots!)
Select slot two (row two of the table).
In the Hardware Catalog, open the CPU 300 folder.
Select the correct CPU 315 DP. Select the CPU with the order number that matches your CPU
»» Select the CPU 315 DP with the order number (for example) 6ES7 315-2AF00-0AB0 (Important: this number must be the same as the number on the CPU!)
Double-click the correct CPU 315 DP. A dialog appears in which you have to specify the PROFIBUS parameters. Set the desired PROFIBUS address (for example, 2) and the other PROFIBUS parameters or use the default values. After you have selected a PROFIBUS subnet (highlight the PROFIBUS subnet name in the PROFIBUS list box), and all parameters for the PROFIBUS have been set, click OK.
»» The CPU, including the PROFIBUS subnet, is inserted into the table under the power supply.
Insert the Input/Output Modules
Open the SM 300 folder. Select the I/O modules under SM 300.»» For this example you want to insert two digital I/O modules. The first module is configured as a digital input module (16 bits) and the second as a digital output module (16 bits).
How to Select the Digital Input Module
Open the DI-300 folder.
Double-click the module that is listed as SM321 DI16xDC24V (Input 16DI 24V, grouping 16) with the order number 6ES7-321-1BH01-0AA0.
»» Insert the module in the fourth slot. The start address of the input module is specified as 0 by the system.
How to Select the Digital Output Module
Open the DO-300 folder.
Double-click the module listed as SM322 D016xDC24V (Output 16D0 24V/0,5A, grouping 8) with the order number 6ES7 322-1BH01-0AA0.
»» Insert the module in the fifth slot. The start address of the output module is specified as 4 by the system.
The hardware configuration for the S7-300 is almost complete; the only task remaining is to set the different addresses.
4. How to Set the Different Addresses
a. The CPU 315-2 DP was inserted in the second row of the table in the Hardware Configuration window. Click this second row with the right mouse button. A pop-up menu appears.
Select the item Object Properties. A dialog window with the name Properties CPU 315-2-DP appears. You can set the MPI address in this dialog.
In the Nodes area of the dialog box, click the MPI… button.»» For this example, set the MPI address to 2 (this is probably the default).
Close the settings and the dialog by clicking OK.
b. Set the PROFIBUS address for communication between S7-300 and S7-200:
The CPU 315-2 DP was inserted in the second and third rows of the table in the Hardware Configuration window. Click the third row (numbered 2.1, DP master) with the right mouse button. A pop-up menu appears. Select the item Object Properties and a dialog window named Properties DP Master appears. You can set the PROFIBUS address in this dialog. For this example, set the PROFIBUS address to 2 (this is probably the default).
Close the settings and the dialog by clicking OK.
5. How to Check the Addresses of the Digital I/O Modules
Select the row with the I/O module in the Hardware Configuration window.
Click this row with the right mouse button.»» A pop-up menu appears.
After you select the item Object Properties, the Properties DI16xDC24V or DO16xDC24V dialog window appears.
Click the Address tab to read the preset address of the input and output modules.
»» this example, the address of the input module is set to 0. The address of the output module is set to 4.
Close the settings and the dialog by clicking OK.
6. How to Insert the EM 277 PROFIBUS-DP in the Subnet
Click the PROFIBUS network icon (dashed line under DP Master System 1) in the Hardware Configuration window.
Open the PROFIBUS-DP catalog by selecting the PLUS SIGN in front of the entry PROFIBUS-DP»» The entry PROFIBUS opens, displaying different sub-items.
If the EM 277 was already installed in STEP 7, open the item SIMATIC and double-click the EM 277 PROFIBUS-DP. If you had to install the EM 277 yourself, open the Additional Field Devices folder and then the SIMATIC folder. Double-click the EM 277 PROFIBUS-DP to add it to the network.
The Properties PROFIBUS Nodes SIMATIC S7-200 opens. Set the Address field to 5 for this example and click OK.
»» The selected EM 277 is inserted in the window for the hardware configuration as an icon. A new table, EM 277 PROFIBUS-DP, is added under the window.
7. How to Specify the Communication Parameters for the EM 277 PROFIBUS-DP
After the table for the EM 277 PROFIBUS-DP is added to the PROFIBUS network, select the first line of the new table (slave).
In the hardware catalog, under EM 277 PROFIBUS-DP, select the size and consistency of the data transfer. For this example, select a transfer of 1 word each way with word consistency. See the discussion at the end of this tip for more information on consistency.»» Double-click the "1 Word Out/1 Word In" selection.
This completes the setup of the communication between the CPU 315-2 DP and the EM 277. The default I/O area is specified for address 256.
8. How to Download the Hardware Configuration to the CPU 315 DP
After all settings mentioned above have been made, you can download the hardware configuration into the CPU. Make sure that the PLC is in the STOP mode by setting the mode switch to STOP.
From the PLC menu, select Download…, or use the Download button.
Communication Addresses (PROFIBUS, MPI, PPI)
For this example, the following addresses must be set:
PROFIBUS: | Master | address (CPU 315-2 DP) = 2 |
| Slave | address (EM 277 PROFIBUS‑DP) = 5 |
|
|
|
MPI: | PC | address (MPI card) = 1 |
| Master | address (CPU 315-2 DP, Port 0) = 2 |
|
|
|
PPI: | PC | address (PC) = 1 |
| Slave | address (S7-200 CPU) = 2 |
Sample Program for the DP Master (CPU 315-2 DP)
With STEP 7 (Version 4.02 or greater):
This sample program for the DP master should be placed in organization block 1 (OB1).
The program is very simple and only contains one network.
Network 1:
// Transfer inputs of master (CPU 315-2 DP) to slave (S7‑200 CPU)
L PIW 0 // Get the I/O input word of the input module.
T PQW 256 // Transfer it to address area 256
// (the Send mailbox of the master, or I/O output area).
// Transfer inputs of slave (S7‑200 CPU) to master (CPU 315-2 DP).
L PIW 256 // Get the I/O input word 256 (the inputs of the slave).
T PQW 4 // Transfer it to the outputs of the output module.
BE // End of block
The master station initiates the data transfer by reading the input module and storing the input data in the I/O output area (starting with address PQ 256). The master station sends this stored input word to the slave station. The S7-300 input module status will be displayed on the outputs of the S7-200 CPU.
The inputs from the slave are returned to the master in the I/O input area (starting with address PI 256). The program then stores the input data in the physical outputs of an output module. The inputs of the S7-200 CPU are now displayed on the outputs of the S7-300 output module.
Memory Model DP Master and DP Slave
The purpose of a PROFIBUS DP connection is the exchange of data. A master device writes output data to a slave device. The slave device responds to the write request with input data to be returned to the master.
The master transfers data from an I/O output area to the slave's output buffer (Receive mailbox). The master reads data from the slave's input buffer (Send mailbox) and stores it in an I/O input area. The output and input buffers are located in the S7-200 CPU's variable memory (V Memory) area. The figure below shows the memory model for a transfer of 16 output bytes and 16 input bytes.
PROFIBUS DP always describes data transfers with respect to the master. Data that is transferred from the master to the slave is always referred to as output data. Data that is transferred from the slave to the master is always referred to as input data. In the slave, data values that come from the master are still referred to as outputs, even though they are inputs to the slave. In the same manner, data values that are returned to the master are still referred to as inputs, even though they are outputs from the slave.
The master tells the slave the start address of the output buffer (Receive mailbox). The master sends the V memory offset of the output buffer to the slave as part of the parameter assignment of the slave. If this offset is zero, the slave places the output buffer at VB0. If the offset is 5000, the slave places the output buffer at VB5000.
The master also tells the slave the size of the output buffer (Receive mailbox). You configure the master to write some number of bytes of data to the slave. The master sends this information to the slave as part of the configuration of the slave. The slave uses this information to set the size of the output buffer. If the master tells the slave that there are 16 output bytes, the slave will set the size of the output buffer to 16 bytes. If the output buffer starts at VB5000, output data from the master will be written to locations VB5000 through VB5015.
The input buffer (Send mailbox, or data to be returned to the master) follows the output buffer immediately. You also configure the master for the amount of data to be returned by the slave. This value is written to the slave as part of the slave configuration. The slave uses this information to set the size of the input buffer. Continuing with the example above, if the master places the output buffer at VB5000 and sets the size to 16 bytes, the input buffer will begin at VB5016, directly after the output buffer. If the size of the input buffer is also 16 bytes, the input buffer will be placed at VB5016 through VB5031.
Data Exchange
As soon as the master determines that the slave is present on the network, it sets the configuration of the slave to the number of inputs and outputs configured in the master. The master will also write the V memory offset of the output buffer in the CPU. If the setup is successful, the master enters the data exchange mode with the slave. In this mode, the master sends output data to the EM 277. The data is then transferred to the V memory of the CPU. The EM 277 responds to the master with input data read from the V memory of the CPU.
You must know the start address of the output and input buffers and their lengths at the time you create the program for the S7-200 CPU. The output data from the master station must be moved by the S7-200 CPU program from the output buffer to the various locations for use. Likewise, the input data must be moved from various locations to the input buffer for transfer to the master. The locations of the output buffer and the sizes of the output and input buffers are available in the special memory (SM) of the S7-200 CPU. See the S7-200 Programmable Controller System Manual (order number 6ES7 298-8FA21-8BH0) Appendix A for more details about the EM 277 PROFIBUS-DP module. The STEP 7 – Micro/WIN program for this tip also illustrates the interface between the EM 277 and the CPU.
Data Consistency
The I/O selection that you define also selects the data consistency. The data consistency selection tells both the master and slave how much data to transfer between the network and memory without interruption. PROFIBUS supports three types of consistency: byte, word, and buffer.
- Byte consistency ensures that bytes are transferred as whole units. Byte consistency should be used if all of the bytes within the DP data are independent data items.
- Word consistency ensures that word transfers cannot be interrupted by other processes. Word consistency should be used when the DP data contains integer (two-byte) values. Word consistency forces the master and/or slave to move both bytes of each word between memory and the DP network as a unit which cannot be interrupted or modified by any other process in the CPU.
- Buffer consistency ensures that the entire buffer of data is transferred as a single unit, uninterrupted by any other process. Buffer consistency forces the master and/or slave to move the entire buffer of DP data (all inputs/outputs) between memory and the network without interruption. Buffer consistency should be used when transferring double word values, floating point values, or a group of data values which must be acted upon as one unit.
The EM 277 transfers the DP data to/from V memory after the user program section of the scan cycle. This ensures that all DP data accessed by the main user program and its subroutines will have consistent data.
The transfer of the DP data between the EM 277 and the V memory of the CPU can be interrupted by user interrupt routines. In this case, the data will have the consistency specified by the I/O configuration of the master: byte, word, or buffer. If the protection offered by the I/O configuration is not sufficient, the user program can ensure the consistency of the DP data by not accessing the DP data from user interrupt routines. This provides the user program with the equivalent of buffer consistency.
Download Project Example:

















