Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
This document contains information on the samples for Profibus communication between an S7 station and a SIMATIC S5 station using the FDL (Fieldbus Data Link) service.
)RU D EULHI RYHUYLHZ RI WKLV VDPSOH UHIHU WR &KDSWHU )RU GHWDLOHG LQIRUPDWLRQ UHIHU WR &KDSWHU DQG WKH FKDSWHUV 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
HQD
QBvrshpr 8QVhq8Q
as
)XQFWLRQ 'LDJUDP
The following diagram illustrates how the sample works:
SIMATIC S5 Station
3UHSDUH GDWD IRU VHQGLQJ Send data (2 bytes) Receive data and copy it to the send buffer
'DWD ([FKDQJH
2 bytes of data are exchanged cyclically by the stations involved in communication.
66 3DUWQHU
The S7 partner initiates connection establishment and the sending of new data. The S5 partner returns the received data to the S7 end. Return means that received data is sent back to the S7 end after it has been completely received.
3URJUDP
S7 End OB1
MY_SEND_CALL FC-AG_SEND FB RECEIVE
S5 End
REC-T2
FC6 FC41
FB120 CALL
Parallel to the send job, an "AG_RECV" FC is called to fetch received data from the CP. The data is saved once it has been completely received.
If the "FB RECEIVE" signals newly received data, an FB SEND" is triggered with the newly received data to send the received data back.
Once the RECEIVE job has been processed without error, the data to send is incremented by 1 and the send/receive cycle begins again.
6\VWHP 6WUXFWXUH
This chapter lists the hardware and software required to run the sample.
1RWH 6FRSH RI $SSOLFDWLRQ RI WKLV 'RFXPHQW The content of this document assumes a specific configuration. This documentation can, however, be used for all FDL samples of communication between a SIMATIC S7 and a SIMATIC S5 station.
&DXWLRQ The samples relate to specific hardware configurations. These must exist to ensure problem-free operation. If you want to use a different configuration, you must make modifications (refer to the notes below).
*HQHUDO 6WUXFWXUH
Bus system Communications protocol Active End Passive End Communications processors Services PROFIBUS SDA (Send Data with Acknowledge) SIMATIC S7 SIMATIC S5 CP 443-5,CP 5431 FDL
The sample uses the FDL protocol. Using this protocol and the SDA services, there is a data exchange between a SIMATIC S7 station and a a SIMATIC S5 station. A CP 443-5 Basic is used as the communication processor in the active SIMATIC S7-400 . A CP 5431 is used at the passive SIMATIC S5 end.
ORFDWLRQ
1 2 3 PS407 10A
0RGXOH
CPU 414-1
CP 443-5
1RWH 8VLQJ D GLIIHUHQW &38 If you want to use a different CPU for the sample, please read the document "Change_CPU".
1RWH 8VLQJ D GLIIHUHQW &3 If you want to use a different CP for the sample, please read the document "Change_CP".
6ORW
1 2 3 4 CPU
0RGXOH
CP 5431
Power supply Rack
MPI cable
PROFIBUS Cable 2 Profibus connectors PG or PC with MPI port
5HTXLUHG 6RIWZDUH
You require the following software to run the sample: Microsoft Windows 95 or Windows NT 4.0 as the operating system STEP 7 V4.02 (See also "1RWH") NCM S7 PROFIBUS V4.02 + Service Pack 1 STEP 5 V6.65 NCM 5431
10
11
12
13
14
This chapter introduces you to the structure of the program for both the active and passive ends and important sections of code are shown and explained.
15
Call AG_SEND
Yes
No
Call AG_RECV
Yes
Yes
16
8VHV
The use of symbols makes the code easier to read. The symbolic name then appears in the program instead of the address. Example: Instead of "MW50" you see "RECEIVE_DATA" in the code.
17
&DOO
OB1 is called in every CPU cycle.
1DPH
OB1
&RGH
'HVFULSWLRQ
OB1 calls the blocks named "MY_SEND_CALL" (call AG_SEND) and "MY_RECEIVE_CALL" (call FC AG_RECV) in every cycle.
18
&DOO
Called within OB1.
1DPH
MY_SEND_CALL (FC40)
&RGH
19
'HVFULSWLRQ
&$// $*B6(1' The S/R service "send data" is called. Depending on the "SEND_ERROR" bit, the status word is saved or the function is exited using a conditional block end (BEC).
6XPPDU\
The send block is signaled in every cycle to send data from the send buffer (DB40). When an error occurs during sending, the returned status value is saved in a data block (DB43).
20
&DOO
Called within OB1.
1DPH
MY_RECEIVE_CALL (FC41)
&RGH
21
'HVFULSWLRQ
&$// $*B5(&9 The S/R service "receive data" is called. Depending on the "RECV_ERROR" bit, the status value is saved. Otherwise the received data length is accepted and if received correctly the data word is incremented.
6XPPDU\
The receive block is triggered in every cycle to receive data and write it to the receive buffer (DB41). When an error occurs during sending, the returned status value is saved in a data block (DB43). If no error occurs in reception the data is incremented.
22
Call RECEIVE
Yes
Yes
No
23
&DOO
OB1 is called in every CPU cycle.
1DPH
OB1
&RGH
OB1
Segment 1 : : JU FB 1 Name : TRIGGER ANST : F : : JU FB 2 Name : SEND-T2 ANST : F : : JU FB 102 Name : REC-T2 : :BE 2.0 2.0
'HVFULSWLRQ
OB1 calls the blocks named "MY_SEND_CALL" (call AG_SEND) and "MY_RECEIVE_CALL" (call FC AG_RECV) in every cycle.
24
&DOO
Called within OB1.
25
&RGH
FB 2 Segment 1 Name : SEND-T2 : JU FB 123 Name : CONTROL SSNR : A-NR : ANZW : PAFE : KY 0,0 KY 0,2 FW 10 FY 14
: A F 11.2 : AN F 17.0 : = F 17.1 : A F 11.2 : = F 17.0 : A F 17.1 : AN F 15.0 : RB =TRIGGER : A =TRIGGER : AN F 11.1 : R F 17.0 : JC FB 120 Name : SEND SSNR : A-NR : ANZW : QTYP : DBNR : QANF : QLAE : PAFE : :BE KY 0,0 KY 0,2 FW 10 KS DB KY 0,41 KF +0 KF +1 FY 15
26
'HVFULSWLRQ
The S/R service "Send Data" is called. Depending on the "Data_transfer" and "PAFE" bytes, the send bit is reset and the block is closed.
6XPPDU\
The send block is triggered in every cycle to transfer data.
27
&DOO
Called within OB1.
&RGH
FB 41
Segment 1 Name : REC-T2 : : JU FB 123 Name : CONTROL SSNR : KY 0,0 A-NR : KY 0,102 ANZW : FW 110 PAFE : FY 114 : : AN F 111.0 : BEB : : JC FB 121 Name : RECEIVE SSNR : KY 0,0 A-NR : KY 0,102 ANZW : FW 110 ZTYP : KC DB DBNR : KY 0,41 ZANF : KF +0 ZLAE : KF -1 PAFE : FY 115 : : O F 115.0 : O F 111.3 : BEB : : : :BE
28
'HVFULSWLRQ
The S/R service "Receive Data" is called. When the "receive end" bit "PAFE" bits have been successfully passed the block is closed and the send job bit is set.
6XPPDU\
The receive block is triggered in every cycle to receive data and, after successful reception, to trigger the send job.
29
This chapter covers the following topic: Operator control and monitoring
30
0RQLWRULQJ
You can monitor the functions using the variable table provided with the sample. The following table explains how to use the variable table.
6WHS 1 2 3 4 5
'HVFULSWLRQ Insert this end of the MPI cable in the MPI port of the S7 CPU in the active station Select "Blocks" in the project window of the SIMATIC Manager under the active station. Double-click "VAT1". In the "Monitoring and Modifying Variables" program, select 3/& ! &RQQHFW WR ! &RQILJXUHG &38 To monitor the specified variables, select "9DULDEOH ! 0RQLWRU
1RWH The monitor function is active when "Online" is displayed in the status bar in the "Monitoring and Modifying Variables" program and you can see a continuously changing progress bar.
31
When you have completed the steps listed above, you will see the following variable table (value deviations are possible!):
6(1' 3DUDPHWHU In the upper part, "SEND", you can see the parameters of the AG_SEND Send/Receive service. ,I WKH VDPSOH LV ZRUNLQJ FRUUHFWO\ $PRQJVW RWKHU WKLQJV WKH SDUDPHWHU 6(1'B'21( $*B6(1' MRE FRPSOHWHG FKDQJHV LWV VWDWH FRQWLQXRXVO\ IURP ! 5(&(,9( 3DUDPHWHU In the "RECEIVE" section you will see the same but for the Send/Receive service AG_RECV. ,I WKH VDPSOH LV ZRUNLQJ FRUUHFWO\ $PRQJVW RWKHU WKLQJV WKH SDUDPHWHU 5(&9B1'5 GDWD UHFHLYHG VKRXOG VKRZ D FRQWLQXRXVO\ FKDQJLQJ VWDWXV RI ! If the error output is set, you will see the status messages of the blocks in "last error in program". ,I WKH VDPSOH LV ZRUNLQJ FRUUHFWO\ 'XH WR WKH XSGDWH F\FOH RI WKH YDULDEOH WDEOH WKH ZULWWHQ DQG UHDG GDWD VKRXOG EH GLIIHUHQW ,I WKH VDPSOH LV IXQFWLRQLQJ FRUUHFWO\ WKH GDWD VKRXOG EH FRQWLQXRXVO\ FKDQJLQJ
32
1RWH The meaning of the values of the parameters for AG_SEND and AG_RECV is explained in detail in the relevant documentation and in the NCM online help (for example 6WDUW ! 6LPDWLF ! 1&0 6 352),%86 ! +HOS )XQFWLRQV )& ! (QJOLVK ).
1RWH The sample is functioning correctly when the value of the data read and written changes continuously. ! Dont forget! The variable table must be online and monitoring must be active for the values to be updated.
2SHUDWRU &RQWURO
You can call the functions using the variable table provided with the sample. How to start and activate it was described above.
1RWH To call up the functions, the variable table must be "Online" and "Monitor" must be active so that the values can be updated (see above).
The following table shows you how to change the value of the data sent to (and then read by) the passive end.
6WHS 1 2
'HVFULSWLRQ Enter a value between 0 and 32767 in the last column ("Modify Value") of the line "MW 52" "SEND_DATA" in the variable table. Select "Variable" -> "Activate Modify Value"
&RUUHFW IXQFWLRQ If the value has been successfully modified, the value read should also return a new value.
33
34
7URXEOHVKRRWLQJ
This chapter is intended to help you if you encounter problems installing and starting up the sample.
35
6WHS 1 2
'HVFULSWLRQ Is the MPI cable connected to both the PG/PC and the S7 CPU? In the "Setting the PG/PC Interface" program is the correct interface parameter set 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? Is the hardware configuration in the project (offline configuration) identical in every way with the actual configuration (online configuration)? Has the CPU been reset?
3 4
5HPHGLHV
Correct the problem by working through the steps below if your answer was no to one of the questions above. $QVZHU WR 6WHS ZDV 12 No connection can be established to the S7 CPU, it is not possible to download to the CPU.
6WHS 1 2
'HVFULSWLRQ Insert one end of the MPI cable in the MPI port on your PG or PC. Insert the other end of the MPI cable in the MPI port of your S7 CPU.
36
$QVZHU WR 6WHS ZDV 12 No connection can be established to the S7 CPU, it is not possible to download to the CPU.
6WHS 1 2
'HVFULSWLRQ Start the "Setting the PG/PC Interface" program: "Start" -> "Simatic" -> "STEP 7" -> "Setting the PG/PC Interface". Set the module you want to use as the MPI port in "Interface parameter assignment used". For example, "MPI-ISA on board (MPI)" if you are using the PG-MPI port. Click the "OK" button.
6WHS 1
'HVFULSWLRQ Adapt the actual hardware configuration to that of the project or read the documentation "Change_CPU" or "Change_CP" if you want to use a different CPU or CP than the one used in the sample.
'HVFULSWLRQ
37
6WHS 1 2 3
'HVFULSWLRQ Is the Profibus cable connected to both the active and passive stations? Can you see "Online" in the status bar of the variable table? 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 to one of the questions above. 7KH DQVZHU WR VWHS ZDV 12 No connection can be established between the stations and data exchange is not possible.
6WHS 1 2
'HVFULSWLRQ Connect the end of the PROFIBUS cable to the CP port of the station. Repeat steps 1 and 2 for the passive station.
38
<RXU DQVZHU WR 6WHS ZDV 12 No connection was established to the S7 CPU and monitoring was not possible.
6WHS 1
'HVFULSWLRQ In the program "Monitoring and Modifying Variables", select 3/& ! &RQQHFW 7R ! &RQILJXUHG &38
6WHS 1
'HVFULSWLRQ Select 9DULDEOH ! 0RQLWRU in the "Monitoring and Modifying Variables" program.
39
6WHS 1 2
'HVFULSWLRQ Have you activated 9DULDEOH ! 0RGLI\ 9DOXH 9DOLG in the "Monitoring and Modifying Variables" program? Is the value you entered for memory word 52 (MW52) between 0 and 32767?
5HPHGLHV
Correct the problem by working through the steps below if your answer was no to one of the questions above. <RXU DQVZHU WR VWHS ZDV 12
6WHS 1
'HVFULSWLRQ Select 9DULDEOH ! 0RGLI\ 9DOXH 9DOLG in the "Monitoring and Modifying Variables" program.
6WHS 1
'HVFULSWLRQ Enter a value between 0 and 32767 in the last column ("Modify Value") of the line "MW 52" "SEND_DATA" in the variable table.
1RWH If you do not find the solution to your problem in this chapter, reinstall the sample.
40