pb_fms_s7_s5_rw
TRANSCRIPT
-
8/2/2019 pb_fms_s7_s5_rw
1/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 1
$ERXWWKLV'RFXPHQW
This document contains information on the samples for PROFIBUS FMScommunication between a SIMATIC S7 and a SIMATIC S5 station using theREAD/WRITE services.
)RUDEULHIRYHUYLHZRIWKLVVDPSOHUHIHUWR&KDSWHU
)RUGHWDLOHGLQIRUPDWLRQUHIHUWR&KDSWHUDQGWKHFKDSWHUV
IROORZLQJ
The document covers the following topics:
System structure
Introduction to the required blocks and their communication structure
Program structures and extracts of code
Operator control and monitoring
Troubleshooting
-
8/2/2019 pb_fms_s7_s5_rw
2/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 2
2YHUYLHZRIWKH6DPSOH
6FKHPDWLFRIWKH6\VWHP
&KHFNLQJWKH)XQFWLRQDOLW\RIWKH6DPSOH
You can check that the sample is working correctly based on the variable table ofthe client. The variable table is contained in the Blocks folder of the STEP 7 project.Data being sent and received has continuously changing values (see also"Operator Control and Monitoring").
PG/PC with STEP 7
as
PROFIBUS
H Q D Q B v r s h p r
)06&OLHQW66WDWLRQ
)066HUYHU66WDWLRQ
-
8/2/2019 pb_fms_s7_s5_rw
3/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 3
)XQFWLRQ'LDJUDP
The following diagram illustrates how the sample works:
'DWD([FKDQJH
2 bytes of data are exchanged cyclically by the stations involved in communication.
&OLHQW6HUYHU
The client initiates the reading/writing of data. The server only reacts to the services ofthe client and, for example, makes data available for a read job from the client.
3UHSDUHGDWDIRUVHQGLQJ
6DYHUHFHLYHGGDWD
$FFHSWMRE
Write data (2 bytes)
Read data (2 bytes)
SIMATIC 400 Station Client SIMATIC S5 Station Server
-
8/2/2019 pb_fms_s7_s5_rw
4/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 4
3URJUDP
'HVFULSWLRQRIWKHFOLHQW The WRITE function block is called. Using the WRITE
job, 2 bytes of data (the memory word 4 of the client)is written to the memory area of the server (also
memory (flag) word 4).
After the WRITE job has been executed without errorthe READ function block is called.Using the READ job, 2 bytes of data (flag word 4 ofthe server) is read from the server. The client storesthe data read in memory word 8.
Once the READ job has been processed without error,
the data to write is incremented by 1 and thewrite/read cycle begins again.
'HVFULSWLRQRIWKHVHUYHU At the server, it is only
necessary to call the handlingblock for the communications
processor.
At the server, the data to beused for the communication isspecified in the symbol table,marked as a communicationvariable and assigned an index.
OB1
FB READ
FB WRITE
MY_READ_CALL
MY_WRITE_CALL
DI
DI
MW 8
MW 4
OB1
FC36
FC33
Acceptvariable
withindex 100
Sendvariable
with index
100
Variablewith index
100 =DB100
SymbolTable
Server SIMATIC S5Client S7-400
-
8/2/2019 pb_fms_s7_s5_rw
5/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 5
1RWHDERXW&OLHQW,QGH['%It is not possible to directly enter the index or name of the variable to be used inthe communication in the FMS blocks for READ/WRITE. The auxiliary data block,
"Index DB", is required. In the sample, this is data block 5 (DB5). It has thefollowing structure:
1RWHDERXW&OLHQW,QLWLDOL]DWLRQRI)%:5,7(Before the WRITE function block can be used for communication, it must first be
initialized.This is done by calling it once with the parameter value 5(4.In the sample this is done in OB100 (Startup OB)!
1RWHDERXW&OLHQW7URXEOHVKRRWLQJIf an FMS block recognizes an error in communication (error bit = 1), the FMSblock must be reset before the next trigger (5(4). This is done by calling theFMS block with 5(4. Calling the FMS block again with 5(4 does notchange the block parameter "67$786".
-
8/2/2019 pb_fms_s7_s5_rw
6/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 6
2SHUDWRU&RQWURODQG0RQLWRULQJ
An operator control and monitoring function is available using the supplied variabletable.The following conditions must be met to allow you to use the "Monitoring and
Modifying Variables" program:
There must be an online connection to the CPU.
"Monitor variables" must be activated.
The values to be modified must be marked as valid.
If the conditions listed above are met, you can determine whether the sample isfunctioning correctly by observing that the data being written and read are changingcontinuously.
-
8/2/2019 pb_fms_s7_s5_rw
7/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 7
6\VWHP6WUXFWXUH
This chapter lists the hardware and software required to run the sample.
1RWH
6FRSHRI$SSOLFDWLRQRIWKLV'RFXPHQWThe content of this document assumes a specific configuration (CP 443-5 Basic asFMS client, CP 5431 as FMS server).This documentation can, however, also be used for all FMS READ/WRITEsamples of communication between a SIMATIC S7 station as client and aSIMATIC S5 station with CP 5431 as server.
*HQHUDO6WUXFWXUH
Bus system PROFIBUS
Communications protocol FMS
Platform SIMATIC S7 and SIMATIC S5
Communications processors S7: CP 443-5 Basic, S5: CP 5431
Services READ, WRITE
The sample uses the FMS protocol. Using this protocol and the READ / WRITEservices, there is a data exchange between a SIMATIC S7 and a SIMATIC S5station. The CP 443-5 Basic and CP 5431 are used as communicationsprocessors.
5HTXLUHG+DUGZDUHIRUWKH&OLHQW
6ORW 0RGXOH
1 PS407 10A
3 CPU 414-1
4 CP 443-5 Basic
-
8/2/2019 pb_fms_s7_s5_rw
8/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 8
5HTXLUHG+DUGZDUHIRUWKH6HUYHU
0RGXOHAS 135U / 155U (CPU 928)
CP 5431FMS
1RWHThe S7 CP should have firmware version 2.x.You can determine the version of the CP with NCM S7 PROFIBUS Diagnostics
(6WDUW!6LPDWLF!1&06352),%86!352),%86'LDJQRVWLFV).If your CPs have an earlier version than 2.x it is possible to update their software(download a new version from Internet/Intranet and load it into the CP with theNCM S7 PROFIBUS firmware loader).
! &DXWLRQThe samples relate to specific hardware configurations. These must exist toensure problem-free operation.If you want to use a different configuration, you must make modifications (refer to
the notes below).
1RWH
8VLQJDGLIIHUHQW6&38If you want to use a different S7 CPU for the sample, please read the document"Change_CPU".
1RWH
1RWH8VLQJDGLIIHUHQW6&3If you want to use a different S7 CP for the sample, please read the document"Change_CP".
-
8/2/2019 pb_fms_s7_s5_rw
9/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 9
&DEOHVDQG2WKHU+DUGZDUH5HTXLUHG
MPI cable
PG Cable
PROFIBUS cable with at least two connectors
PG or PC with MPI and AS Interface
5HTXLUHG6RIWZDUH
You require the following software to run the sample:
Microsoft Windows 95 or Windows NT 4.0 as the operating system
For the SIMATIC S7 station:
STEP 7 V4.02
NCM S7 PROFIBUS V4.02
For the SIMATIC S5 station:
STEP 5 V6.65
SINEC NCM COM for CP 5431 V4.09
-
8/2/2019 pb_fms_s7_s5_rw
10/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 10
,QWURGXFWLRQWRWKH5HTXLUHG%ORFNVDQGWKHLU&RPPXQLFDWLRQ6WUXFWXUH
This chapter covers the following topics:
How the sample works
Blocks required for communication and their communication structure
-
8/2/2019 pb_fms_s7_s5_rw
11/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 11
+RZWKH6DPSOH:RUNV
'DWD([FKDQJH2 bytes of data are exchanged cyclically by the stations involved in communication.
&OLHQW6HUYHU
The client initiates the writing/reading of data. The server only reacts to the services ofthe client and, for example, makes data available for a read job from the client.
6WHSE\6WHS([HFXWLRQRIWKH8VHU3URJUDPRQWKH&OLHQW
WRITE:First the client writes data to the memory area of the server by calling the WRITEfunction block (located in MW4).
READ:By calling the READ function block, data is read from the server and stored by theclient in MW8.
Incrementing data:The value of the data to be written is incremented by 1 and the write/read cyclestarts again.
6WHSE\6WHS([HFXWLRQRIWKH8VHU3URJUDPRQWKH6HUYHU
In the PLC program of the server, the handling blocks "SEND ALL" (FB120) and"RECEIVE ALL" (FB121) are required for processing the received FMSREAD/WRITE services.
SEND ALLis executed when the READ service is executed on the client.What is read is the server variable with the index 100, which references the S5address, DB100, 0 (data block 100 word 0).
RECEIVE ALLis executed when the WRITE service is executed on the client.
What is written is the server variable with the index 100, which references the S5address, DB100, 0 (data block 100 word 0).
In other words, the client writes and reads data block 100, word 0 on the server.
-
8/2/2019 pb_fms_s7_s5_rw
12/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 12
%ORFNV5HTXLUHGIRU&RPPXQLFDWLRQDQGWKHLU&RPPXQLFDWLRQ6WUXFWXUH
This chapter describes the WRITE and READ blocks required for FMScommunication at the S7 end in greater detail.
-
8/2/2019 pb_fms_s7_s5_rw
13/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 13
:5,7()XQFWLRQ%ORFN)%
3XUSRVHRIWKH%ORFN
FB WRITE sends data from a specified local data area of the FMS client to a data areaof the communication partner, the FMS Server. The local data area can be a datablock, process image area, input/output area or a bit memory area. The local data areacan be a data block, process image area, input/output area or a bit memory area.
7KHEORFNSDUDPHWHUVDUHGHVFULEHGLQGHWDLOLQ&KDSWHU
&RQILJXUHG&RPPXQLFDWLRQ9DULDEOH5HTXLUHPHQW
The structure of the variables is set by the communication partner (FMS server). Thedescription of the structure is read from the communication partner when the FMSconnection is established. This is then made available on the PROFIBUS CP forconverting data from the S7 format to FMS format.
The structure description of the variables is only read when a connection is establishedusing GET-OD, if under "Read variable description of communication partner": "All" or"Specified variables from the following list" with information about the desired variableshas been selected in the configuration of the FMS connection.
$FFHVV5LJKWV
Note that read/write access rights can be set (this is not the case with the samples).Transmission is then only possible if the appropriate rights have been assigned to theFMS client.
-
8/2/2019 pb_fms_s7_s5_rw
14/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 14
5($')XQFWLRQ%ORFN)%
3XUSRVHRIWKH%ORFN
The READ function block reads data from the data area specified by name or indexon the communication partner depending on the job parameters. The data read bythe client is stored in a data block, a process image area of the I/Os or in a bitmemory area.
7KHEORFNSDUDPHWHUVDUHGHVFULEHGLQGHWDLOLQ&KDSWHU
5HTXLUHPHQWV&RQILJXUHG&RPPXQLFDWLRQ9DULDEOHThe structure of the variable is set on the communication partner (FMS server).The description of the structure is read from the communication partner (FMS
server) when the FMS connection is established. This is then made available on thePROFIBUS CP for converting data into the S7 format.
The structure description of the variables is only read when a connection isestablished using GET-OD, if under "Read variable description of communicationpartner": "All" or "Specified variables from the following list" with information aboutthe desired variables has been selected.
$FFHVV5LJKWV
Note that read/write access rights can be set (this is not the case with the samples).Transmission is then only possible if the appropriate rights have been assigned tothe FMS client.
-
8/2/2019 pb_fms_s7_s5_rw
15/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 15
3URJUDP6WUXFWXUHVDQG([WUDFWVRI&RGH
This chapter introduces you to the structure of the programs for both the server andclient and important sections of code are shown and explained.
-
8/2/2019 pb_fms_s7_s5_rw
16/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 16
5.1 3URJUDP6WUXFWXUHRIWKH&OLHQW
Yes
No
Yes
No
No
No
Yes
No
Yes
Program/cycle start
Call WRITEjob
Increment
variable value
Error occurred inWRITE?
Startup OB is run automatically(OB100),
old data deleted,WRITE called with REQ=0
WRITE jobcompleted?
Call READ job
YesError occurred inREAD?
READ jobcompleted?
Object dictionarynot yet loaded? Save error
number
Save errornumber
-
8/2/2019 pb_fms_s7_s5_rw
17/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 17
([WUDFWVRI&RGHIURPWKH&OLHQW
&OLHQW6\PEROV
6\PERO7DEOH8VHGIRUWKH)066DPSOHV
8VHV
The use of symbols makes the code easier to read. The symbolic name thenappears in the program instead of the address.
Example: You will see "READ_DATA" instead of "MW8" in the code.
-
8/2/2019 pb_fms_s7_s5_rw
18/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 18
&OLHQW2%6WDUWXS2%
3XUSRVH
Fill the used data area with "0" and call the FMS Write service with the parameterREQ = 0.
&DOO
During S7 CPU startup.
1DPH
OB100
&RGH
'HVFULSWLRQ
With the "L" and "T" commands (load, transfer) the data area is filled with 0. TheFMS WRITE service is then called; at this point in time, the REQ parameter of theWRITE block is set to "0".In the last section, the REQ parameter of the WRITE block is set to "1" so that it willbe executed at the next call.
-
8/2/2019 pb_fms_s7_s5_rw
19/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 19
&OLHQW2%
3XUSRVH
OB1 is responsible for cyclic execution of the user program.In this sample program, the blocks for the READ and WRITE FMS functions arecalled.
&DOO
OB1 is called in every CPU cycle.
1DPH
OB1
&RGH
'HVFULSWLRQ
OB1 calls the block named "MY_WRITE_CALL" (call FB WRITE) in every CPUcycle.The block "MY_READ_CALL" (call READ function) is only called if"START_READ_CALL" has the value "1", otherwise OB1 ends immediately."START_READ_CALL" only has the value "1" if the previously started WRITE FMSservice has been completed without error.
-
8/2/2019 pb_fms_s7_s5_rw
20/51
-
8/2/2019 pb_fms_s7_s5_rw
21/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 21
0HDQLQJRIWKH3DUDPHWHUVIRUWKH)066HUYLFH:5,7(&$//:5,7('%
REQ:Edge signal for executing the block.
ID:This identifies the FMS connection (obtained with "CPU -> Connections").
VAR_1:This parameter addresses the remote communication variable to be read are written. Inthe sample, the variable is addressed by the index 100, see Section 4.2.7, Index DB).
SD_1:Address of a local data area from which values are sent.
DONE:Indicates error-free execution of the job.
ERROR:Indicates whether or not an error has occurred.
STATUS:Provides detailed information about states or errors during execution of the job.
'HVFULSWLRQ
&$//:5,7('%The WRITE FMS service is called.
TXHVWLRQDERXWHUURUVHFWLRQ
This queries whether the service has been completed without error. The check iscarried out by evaluating the value of the "ERROR" parameter of the WRITE job.
HUURURFFXUUHGVHFWLRQ
This section is only processed when the WRITE job returns an error. The "error bit"is reset because the block for error handling is called (&$//6$9(B:5,7(B(5525).
QRHUURUVHFWLRQThis section is only processed when the WRITE job is executed without error. TheWRITE parameter "DONE" (Job completed?) is checked. If "DONE" is 0 (job is stillrunning), the program jumps to "UHFHSWLRQRIGDWDQRWFRPSOHWHG", otherwise itjumps to section "UHFHSWLRQRIGDWDFRPSOHWHG".
UHFHSWLRQRIGDWDFRPSOHWHGVHFWLRQIf the WRITE job is executed without error and is completed, the edge signal is
generated to execute the FMS service "READ" (65($'B3$5B5(4) and thememory bit for calling the READ job is set (667$57B5($'B&$//).
UHFHSWLRQRIGDWDQRWFRPSOHWHGVHFWLRQIf the WRITE job is still not completed, the WRITE parameter "REQ is reset toprevent it being executed again.(5:5,7(B3$5B5(4). The "MY_WRITE_CALL" block, however, is executed
again in every OB1 cycle. Consequently, your program checks whether the WRITEjob is completed or not in every cycle.
-
8/2/2019 pb_fms_s7_s5_rw
22/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 22
6XPPDU\
The WRITE FMS service is only called if the previous WRITE service and thecorresponding READ service were successfully completed. In this case, yourprogram checks whether or not the newly started WRITE service has been
executed without error and has been completed. Only then is the READ FMSservice executed, otherwise the system waits for the completion of the WRITEservice or calls the error handling block if an error has occurred.
-
8/2/2019 pb_fms_s7_s5_rw
23/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 23
&OLHQW(UURU+DQGOLQJDIWHUWKH:5,7(-RE
3XUSRVH
Saves errors occurring in the WRITE service.
&DOO
In the "MY_WRITE_CALL" (FC 36) block, when a prior call to the WRITE servicehas returned an error.
1DPH
SAVE_WRITE_ERROR (FC30)
&RGH
'HVFULSWLRQ
7KHVHFWLRQ/:5,7(B3$5B67$786XSWRDQGLQFOXGLQJ-&JRG
This checks the status returned by the WRITE FMS service. If the status has ahexadecimal value of "0601", it means the CP on the client end is still busy loadingthe object dictionary from the server and therefore cannot yet execute the WRITEFMS service. In this case, the code in section "*HW2'VWLOODFWLYHYDULDEOHQRQH[LVWHQW" is executed, otherwise the code in section "*HW2'FRPSOHWHG".
-
8/2/2019 pb_fms_s7_s5_rw
24/51
-
8/2/2019 pb_fms_s7_s5_rw
25/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 25
&OLHQW5($'-RE
3XUSRVH
Two bytes of data are read from the server using the FMS service 5($'.
&DOO
In OB1, when the previous WRITE FMS service was completed without error.
1DPH
MY_READ_CALL (FC33)
&RGH
-
8/2/2019 pb_fms_s7_s5_rw
26/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 26
0HDQLQJRIWKH3DUDPHWHUVIRUWKH)066HUYLFH5($'&$//5($''%
REQ:Edge signal for executing the block.
ID:This identifies the FMS connection (obtained with "CPU -> Connections").
VAR_1:This parameter addresses the remote communication variable to be read are written. Inthe sample, the variable is addressed by the index 100, see Section 4.2.7, Index DB).
SD_1:Address of a local data area to which values should be sent.
NDR:Indicates the error-free reception of data.
ERROR:Indicates whether or not an error has occurred.
STATUS:Provides detailed information about states or errors during execution of the job.
'HVFULSWLRQ
&$//5($''%The READ FMS service is called.
TXHVWLRQDERXWHUURUVHFWLRQ
This asks whether the service has been completed without error. The check iscarried out by evaluating the "ERROR" parameter of the READ job.
HUURURFFXUUHGVHFWLRQ
This section is only processed when an error occurred in the READ job. The "errorbit" is reset because the block for error handling is called (&$//6$9(B5($'B(5525).
QRHUURUVHFWLRQThis section is only processed when the READ job is executed without error. TheREAD parameter "NDR" (data received?) is checked. If "NDR" is 0 (data not yetreceived), the program jumps to "UHFHSWLRQRIGDWDQRWFRPSOHWHG", otherwise itjumps to section "UHFHSWLRQRIGDWDFRPSOHWHG".
UHFHSWLRQRIGDWDFRPSOHWHGVHFWLRQIf the READ job is executed without error and is completed, the edge signal is
generated to execute the FMS service "WRITE" (6:5,7(B3$5B5(4) and thememory bit for calling the next READ job is reset (567$57B5($'B&$//).
The value of data to send is incremented by 1.
-
8/2/2019 pb_fms_s7_s5_rw
27/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 27
UHFHSWLRQRIGDWDQRWFRPSOHWHGVHFWLRQIf the READ job is still not completed, the READ parameter "REQ is reset toprevent it being executed again.(55($'B3$5B5(4). The "MY_READ_CALL" block, however, is executed
again in every OB1 cycle. Consequently, the program checks whether the READjob is completed or not in every cycle.
6XPPDU\
The READ FMS service is only called if the previous READ service and thecorresponding WRITE service were successfully completed. After it is called, theprogram then checks whether the activated READ job was executed without errorand if data was received. In this case the next WRITE FMS service is triggered.Otherwise the system waits to receive the data or, if an error has occurred, to callthe appropriate block.
-
8/2/2019 pb_fms_s7_s5_rw
28/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 28
&OLHQW(UURU+DQGOLQJDIWHUWKH5($'-RE
3XUSRVH
Saves errors occurring in the READ service.
&DOO
In the "MY_READ_CALL" (FC 33) block, when a prior call to the READ service hasreturned an error.
1DPH
SAVE_READ_ERROR (FC35)
&RGH
'HVFULSWLRQ
The status (error source) of the previous READ service is saved in data block 2,data word 2, and the parameter "5(4" of the READ FMS service is set to "1" (65($'B3$5B5(4"), which results in repeating the previously failed READ FMS
service.
6XPPDU\
If an error occurred in the last WRITE FMS service, the WRITE job is repeated.
the source of the error (error number) is saved.
Exception: As long as the CP on the client is reading the object dictionary, no errornumber is saved and the job is triggered again.
-
8/2/2019 pb_fms_s7_s5_rw
29/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 29
&OLHQW,QGH['%'DWD%ORFN'%
3XUSRVH
This data block is used to specify which FMS index is set as the variable forcommunication. The sample uses a variable with the index 100. Physically, variable100 is located on the server.In the sample index 100 is actually MW4 (see Section 3.1).
1RWHIn FMS, every variable used for communication must be assigned an index. Thevariable can then be uniquely identified with this index.
The variable with this index is physically located on the server!
3XUSRVH
This data block is transfered as the value of "VAR_1" in the FMS services WRITEand READ.
1DPH
Index_DB (DB5)
&RGH
'HVFULSWLRQ
Creates a variable of the data type "STRING[10]" which is given the name"Index100". This parameter contains the variable value "".The "" angled brackets are very important because they indicate that this
is an FMS index. The FMS services WRITE and READ get this value from theblock to be able to address the variable on the server.
-
8/2/2019 pb_fms_s7_s5_rw
30/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 30
3URJUDP6WUXFWXUHRQWKH6HUYHU
Program/cycle start
CallSEND ALL
handling block
(FB120)
OB startup is executedautomatically.
Synchronize CP 5431
CallRECEIVE ALLhandling block
(FB121)
-
8/2/2019 pb_fms_s7_s5_rw
31/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 31
([WUDFWVRI&RGHIURPWKH6HUYHU
6HUYHU)069DULDEOH
8VHV
At the server the data to be used for the communication must be specified as acommunication variable with the NCM software and assigned an index.
,OOXVWUDWLRQRIWKH6RIWZDUH6,1(&1&0&20IRU&39
In the sample, an FMS variable of the type INT 16 ("IN 16") with the index 100 iscreated. Physically this variable corresponds to data block 100, word 0 (S5address: DB 100 0).
-
8/2/2019 pb_fms_s7_s5_rw
32/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 32
6HUYHU2%
3XUSRVH
OB20 calls FB125 which is responsible for the synchronization of the CP 5431.
&DOO
At the startup of the S5 CPU.
1DPH
OB20
&RGH
:JU FB 125NAME:SYNCHRONSSNR:KY 0,0BLGR:KY 0,0PAFE:FY 255:BE
'HVFULSWLRQ
The block FB125 is called and given parameter values.
1RWHRefer to the appropriate manuals for the meaning of the block parameters.
-
8/2/2019 pb_fms_s7_s5_rw
33/51
-
8/2/2019 pb_fms_s7_s5_rw
34/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 34
6HUYHU)%
3XUSRVH
FB231 calls the handling blocks SEND ALL (FB120) and RECEIVE ALL (FB121).SEND ALL is required to forward data requested from the client through READ.RECEIVE ALL is required to accept the data written from the client through WRITE.
&DOO
OB1 is called in every CPU cycle.
1DPH
FB231
&RGH3DUW&DOO6(1'$//
-
8/2/2019 pb_fms_s7_s5_rw
35/51
-
8/2/2019 pb_fms_s7_s5_rw
36/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 36
6WDUWLQJ8S2SHUDWRU&RQWURO0RQLWRULQJ
This chapter covers the following topics: Special notes about starting up the samples
Operator control and monitoring
-
8/2/2019 pb_fms_s7_s5_rw
37/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 37
6WDUWLQJ8S
6WDUWLQJWKH6HUYHUDQG&OLHQW
6WHS 'HVFULSWLRQ
1 Follow the steps described for starting up an SIMATIC S7 PLC and a PC ascontained in the documents "S7 Installation" and "PC Installation".
2 First start the server.
3 Then start the client program from the instal lation folder.
4 Double-click on the file located there with the extension, .exe.
5 Select the menu item "Write / Read" -> "Start".
1RWH
The server must be started first because it provides the services for the client.
-
8/2/2019 pb_fms_s7_s5_rw
38/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 38
2SHUDWRU&RQWURODQG0RQLWRULQJ
1RWHIf problems occur during operator control and monitoring, please read Chapter 7,Troubleshooting.
0RQLWRULQJRQWKH&OLHQW
It is possible to monitor on the client using the variable table provided in the sample.The following table explains how to use the variable table.
6WHS 'HVFULSWLRQ
1 Select "Blocks" in the project window of the SIMATIC Manager under the "Cli-ent".
2 Double-click "VAT1".
3 In the program "Monitoring and Modifying Variables", select 3/&!&RQQHFW7R!&RQILJXUHG&38
4 To monitor the specified variable, select "9DULDEOH!0RQLWRU
1RWHThe monitor function is active when "Online" is displayed in the status bar in the"Monitoring and Modifying Variables" program and you can see a continuouslychanging progress bar.
-
8/2/2019 pb_fms_s7_s5_rw
39/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 39
When you have completed the steps listed above, you will see the followingvariable table (the values actually displayed may differ!):
:5,7(3DUDPHWHUIn the upper part ("WRITE-Parameter") you can see the parameters of the FMSservice WRITE and most recent WRITE error.,IWKHVDPSOHLVZRUNLQJFRUUHFWO\$PRQJVWRWKHUWKLQJVWKHSDUDPHWHU'21(:5,7(MREFRPSOHWHGFKDQJHVLWVVWDWHFRQWLQXRXVO\IURP!SRVVLEO\WRRTXLFNO\WRREVHUYH
5($'3DUDPHWHU
In the "READ-Parameter" part you can see the same for the FMS service READ.,IWKHVDPSOHLVZRUNLQJFRUUHFWO\$PRQJVWRWKHUWKLQJVWKHSDUDPHWHU1'5UHFHLYHGDWDFKDQJHVLWVVWDWHFRQWLQXRXVO\IURP!
-
8/2/2019 pb_fms_s7_s5_rw
40/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 40
'$7$In the "DATA" section you can see data being written to and read from the server.
,IWKHVDPSOHLVZRUNLQJFRUUHFWO\'XHWRWKHXSGDWHF\FOHRIWKHYDULDEOHWDEOHWKHZULWWHQDQGUHDGGDWDVKRXOGEHGLIIHUHQWE\DYDOXHRI,IWKHVDPSOHLVIXQFWLRQLQJFRUUHFWO\WKHVHYDOXHVVKRXOGEHFRQWLQXRXVO\LQFUHDVLQJE\
1RWHThe meaning of the values of the parameters for READ and WRITE is explained indetail in the relevant documentation and in the NCM online help (for example6WDUW!6LPDWLF!1&06352),%86!+HOS)XQFWLRQV)&!(QJOLVK).
1RWHThe sample is functioning correctly when the values of the written and read dataare continuously increasing by "1!.
! Dont forget!The variable table must be online and monitoring must be active for the values tobe updated.
2SHUDWRU&RQWURORQWKH&OLHQW
It is possible to operate from the client using the variable table provided in thesample. How to start and activate it was described above.
1RWHTo call up the functions, the variable table must be "Online" and "Monitor" must beactive so that the values can be updated (see above).
The following table shows you how to change the value of the data sent to (andthen read by) the server.
-
8/2/2019 pb_fms_s7_s5_rw
41/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 41
6WHS 'HVFULSWLRQ
1 Enter a value between 0 and 32767 in the last column ("Modify Value") of theline "MW 4" "WRITE_DATA" in the variable table.
2 Select "Variable" -> "Activate Modify Value"
&RUUHFWIXQFWLRQ
If the value has been successfully modified, then value read should also return avalue deviating by 1.The client wrote the new value to the server and read it back.
([LWLQJ2SHUDWRU&RQWURODQG0RQLWRULQJ
6WHS 'HVFULSWLRQ
1 Select 7DEOH!([LW in the "Monitoring and Modifying Variables" program.
2 Click the "No" button in the subsequent dialog.
-
8/2/2019 pb_fms_s7_s5_rw
42/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 42
7URXEOHVKRRWLQJ
This chapter is intended to help you if you encounter problems installing andstarting up the sample.
-
8/2/2019 pb_fms_s7_s5_rw
43/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 43
3UREOHPVRQWKH&OLHQWWKH6,0$7,&63/&
3UREOHPV'RZQORDGLQJWKH+DUGZDUH&RQILJXUDWLRQWKH&RQQHFWLRQRUWKH%ORFNV
Run the following checks.If your answer is "NO" to a question, go straight to the corresponding steps in"Remedies".
6WHS 'HVFULSWLRQ
1 Is the MPI cable connected to both the PG/PC and the S7 CPU?
2 In the "Setting the PG/PC Interface" program is the correct interface parameterset assigned to the "Access point of application" "S7ONLINE (STEP 7)"? For
example, "MPI-ISA on board (MPI)" if you are using the PG-MPI port?3 Is the hardware configuration in the project (offline configuration) identical in
every way with the actual configuration (online configuration)?
4 Has the CPU been reset?
5HPHGLHV
Correct the problem by working through the steps below if your answer was no toone of the questions above.
$QVZHUWR6WHSZDV12No connection can be established to the S7 CPU, it is not possible to download tothe CPU.
6WHS 'HVFULSWLRQ
1 Insert one end of the MPI cable in the MPI port on your PG or PC.
2 Insert the other end of the MPI cable in the MPI port of your S7 CPU.
-
8/2/2019 pb_fms_s7_s5_rw
44/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 44
$QVZHUWR6WHSZDV12No connection can be established to the S7 CPU, it is not possible to download tothe CPU.
6WHS 'HVFULSWLRQ
1 Start the "Setting the PG/PC Interface" program: "Start" -> "Simatic" -> "STEP7" -> "Setting the PG/PC Interface".
2 Set the module you want to use as the MPI port in "Interface parameter as-signment used".For example, "MPI-ISA on board (MPI)" if you are using the PG-MPI port.
3 Click the "OK" button.
-
8/2/2019 pb_fms_s7_s5_rw
45/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 45
9DULDEOH7DEOH:ULWWHQDQGUHDGGDWDGRQRWFKDQJH
Run the following checks.If your answer is "NO" to a question, go straight to the corresponding steps in"Remedies".
6WHS 'HVFULSWLRQ
1 Is the Profibus cable connected to both the client and the server?
2 Can you see "Online" in the status bar of the variable table?
3 Can you see a continuously changing progress bar in the status bar?
5HPHGLHV
Correct the problem by working through the steps below if your answer was no toone of the questions above.
7KHDQVZHUWRVWHSZDV12No connection can be established between the stations and data exchange is notpossible.
6WHS 'HVFULSWLRQ
1 Connect the end of the PROFIBUS cable to the PROFIBUS port of the clientCP.
2 Connect the end of the PROFIBUS cable to the PROFIBUS port of the server.
3 Switch on the terminating resistor on the connector.
-
8/2/2019 pb_fms_s7_s5_rw
46/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 46
"Monitor" in the "Monitoring and Modifying Variables" pro-gram.
-
8/2/2019 pb_fms_s7_s5_rw
47/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 47
9DULDEOH7DEOH2SHUDWRUFRQWUROLVQRWZRUNLQJ
Run the following checks.If your answer is "NO" to a question, go straight to the corresponding steps in"Remedies".
6WHS 'HVFULSWLRQ
1 Have you activated 9DULDEOH!0RGLI\9DOXH9DOLG in the "Monitoring andModifying Variables" program?
2 Is the value you entered for memory word 4 (MW2) between 0 and 32767?
5HPHGLHVCorrect the problem by working through the steps below if your answer was no toone of the questions above.
-
8/2/2019 pb_fms_s7_s5_rw
48/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 48
3UREOHPVRQWKH6HUYHUWKH6,0$7,&63/&
1RWHFollow the steps described to solve the problem.If your answer is "NO" to a question, go straight to the corresponding steps in"Remedies".
7KHPHVVDJH3/&7LPHRXWDSSHDUV
No connection can be established between the PG/PC and the SIMATIC S5 CPU.
6WHS 'HVFULSWLRQ
1 Is the MPI cable connected to both the PLC interface and the S5 CPU?
2 Is the SIMATIC S5 station switched on?
5HPHGLHV
Correct the problem by working through the steps below if your answer was no toone of the questions above.
-
8/2/2019 pb_fms_s7_s5_rw
49/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 49
-
8/2/2019 pb_fms_s7_s5_rw
50/51
6,0$7,&1(74XLFN6WDUW
PROFIBUS FMS Communication: (S7-S5 with READ/WRITE) 50
5HPHGLHV
Correct the problem by working through the steps below if your answer was no toone of the questions above.
-
8/2/2019 pb_fms_s7_s5_rw
51/51
6,0$7,&1(74XLFN6WDUW
5HPHGLHV
Correct the problem by working through the steps below if your answer was no toone of the questions above.