pb_fdl-sda_s7_s5

41
SIMATIC NET Quick Start Profibus Communication: S7-CP342-5 S5-CP5431 1 1 About this Document This document provides you with information on the samples of Profibus communication between a SIMATIC S7 station and a SIMATIC S5 station using the FDL service (Fieldbus Data Link) with free layer 2 access. For a brief overview of this sample, refer to Chapter 2. For detailed information, refer to Chapter 3 and the chapters following. 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

Upload: luisht79

Post on 21-Apr-2015

360 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP54311

1 About this Document

This document provides you with information on the samples of Profibuscommunication between a SIMATIC S7 station and a SIMATIC S5 station usingthe FDL service (Fieldbus Data Link) with free layer 2 access.

For a brief overview of this sample, refer to Chapter 2.

For detailed information, refer to Chapter 3 and the chapters following.

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

Page 2: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP54312

2 Overview of the Sample

Schematic of the System

Checking the Functionality of the Sample

The variable table of the active S7 station allows you to determine if the sample isfunctioning correctly. The variable table is contained in the Blocks folder of theSTEP 7 project.Data being sent and received has continuously changing values (see also"Operator Control and Monitoring").

PG/PC with STEP7/STEP 5/NCM

as

MPI interfacePG interface onCPU and CP

S7-300 Station S7 135 Station

Local Profibusnetwork

Page 3: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP54313

Function Diagram

The following diagram illustrates how the sample works:

Data Exchange

6 bytes of data are exchanged cyclically by the stations involved in communication.These consist of 4 bytes of header to specify the partner station and 2 bytes of userdata.

S7/S5 Partner

The S7 partner initiates connection establishment and the sending of new data. TheS5 partner returns the received data to the S7 end. Return means that received data issent back to the S7 end after it has been completely received.

Send data (2 bytes of user data)

Send data (2 bytes ofuser data)

SIMATIC S7-300 Station SIMATIC S5 Station

Receive data and copyit to the send buffer

Prepare datafor sending

Save receiveddata

Run startup

Page 4: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP54314

Program

Description of the S7 end:

� An "AG_SEND" FC is called every cycle tosend 2 bytes of user data.

� Parallel to the send job an "AG_RECV" FC iscalled to fetch received data from the CP.The data is saved once it has beencompletely received.

� Once the RECEIVE job has been processedwithout error, the data to send is incrementedby 1 and the send/receive cycle begins again.

Description of the S5 end:

� A "RECEIVE" FB is triggered in every cycle.

� When the "RECEIVE" FB signals newlyreceived data, the "SEND" FB is triggeredwith the newly received data to send thereceived data back.

OB1

FC AG_RECV

FC AG_SEND

MY_RECEIVE_CALL

MY_SEND_CALL

OB1

FC40

FC41

S5 EndS7 End

SEND>SDA

FB40

RECEIVE

SEND

FB41

OB1

REC<-SDA

FC5

FC6 FB120

FB121

FB111

STARTUP

FB125OB20/OB21/OB22

Page 5: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP54315

Operator Control and Monitoring

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 andModifying 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 sent and received from the active(S7) station is changing continuously .

Page 6: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP54316

3 System Structure

This chapter lists the hardware and software required to run the sample.

Page 7: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP54317

Note

Scope of Application of this DocumentThe content of this document assumes a specific configuration.This documentation can, however, be used for all FDL samples of communicationbetween a SIMATIC S7 PLC and SIMATIC S5 stations.

General Structure

Bus system PROFIBUS

Communications protocol SDA (Send Data with Acknowledge)

Active end SIMATIC S7

Passive end SIMATIC S5

Communications processors CP 342-5,CP 5431

Services FDL (free layer 2 access)

The sample uses the FDL protocol. Using this protocol and the SDA services, thereis a data exchange between a SIMATIC S7 station and a a SIMATIC S5 station. Ascommunications processors, a CP 342-5 is used at the active SIMATIC S7-300 endand a CP 5431 at the passive SIMATIC S5 end.

Page 8: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP54318

Hardware Required for the Active End

location Module Order Number

1 PS307 10A 6ES7 307-1KA00-0AA0

2 CPU314 6ES7 314-1AE02-0AB0

4 CP 342-5 6GK7 342-5DA00-0XE0

Hardware Required for the Passive (S5) End

Slot Module Order Number

1 S5-135U/155U (CPU 928) 6ES5 928-3UA12

2 CP 5431 6GK1543-1AA01

Suitability for other Hardware Configurations

! Caution

The samples relate to specific hardware configurations. These must exist toensure problem-free operation.

If you want to use a different configuration, adaptations will be necessary.

Note

Using a different CPU

If you want to use a different CPU for the sample, please read the document"Change_CPU".

Page 9: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP54319

Note

Using a different CP

If you want to use a different CP for the sample, please read the document"Change_CP".

Cables and Other Hardware Required

MPI cable

PROFIBUS Cable

2 Profibus connectors

PG or PC with MPI port

Required Software

You require the following software to run the sample:

� Microsoft Windows 95, Windows 98 or Windows NT 4.0 as the operating system

� STEP 7 V5.03

� NCM S7 Profibus V5.03

� STEP 5 V6.65

� COM 5431 V

Page 10: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543110

4 Introduction to the Required Blocks and theirCommunication Structure

This chapter covers the following topics:

� How the sample works

� Blocks required for communication and their communication structure

Page 11: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543111

4.1 How the Sample Works

Data Exchange

Two bytes of user data is exchanged cyclically via Profibus between the stationsinvolved in communication. Here, we are using the FDL (SDA) service of the free layer2 access.

Active / Passive End

The initiative for sending data is taken by the active SIMATIC S7 PLC. When itreceives a data field, the passive SIMATIC S5 end sends it back to the active SIMATICS7 end.Profibus is used as the network medium.

Step-by-Step Execution of the User Program at the Active End (SIMATIC S7)

� Specify the DESTINATION:The destination of the data to be sent is specified for every send job in the userprogram with a 4 byte long job header, since the FDL service is used with freelayer 2 access.

� SEND:A data block of 2 bytes is sent to the passive partner in every cycle.

� RECEIVE:A receive job is triggered in every cycle and, depending on the return value, thereceived data is written to the receive buffer. The received data contain a 4 bytelong job header to specify the sender.

� Increment data:The value of the data to be sent is incremented by 1 and the send/receive cyclestarts again.

Step-by-Step Execution of the User Program at the Passive End (SIMATIC S5)

� SEND:A receive job is triggered at the passive end every cycle. When new data arereceived, these are entered in the common receive/send buffer and the SEND istriggered.

� RECEIVE:A send job is triggered when new data is received.

Page 12: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543112

4.2 Blocks Required for Communication and theirCommunication Structure

This chapter provides a detailed description of the AG_SEND and AG_RECV andthe FB SEND and FB RECEIVE required for SEND / RECEIVE communication.

Page 13: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543113

4.2.1 S7 Function AG_SEND (FC5)

Purpose of the Block

The AG_SEND function (FC) transfers data from the specified send buffer of theSimatic S7 to the programmed partner station. The send buffer pointer can point to aprocess image area, a bit memory area, or a data block area. The connection ID isgenerated by the configuration software when an "unspecified FDL connection" isconfigured.

The Profibus address and SAP no. of the partner must be specified in the userprogram using a 4-byte job header. This specifies the destination of the send job.

The block parameters are described in detail in Chapter 5.

4.2.2 S5 Function SEND (FB120)

Purpose of the Block

The function block transfers data from the specified send area of the SIMATIC S5 tothe partner station. The send buffer pointer can point to a process image area, a bitmemory area, or a data block area. The job number used is generated by the NCMconfiguration software when an "FDL connection" is configured.The Profibus address and SAP no. of the partner must be specified in the userprogram using an 8-byte job header. This specifies the destination of the send job.

The block parameters are described in detail in Chapter 5.

Page 14: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543114

4.2.3 S7 Function AG_RECV (FC6)

Purpose of the Block

The AG_RECV function sends the data received from the specified partner station tothe specified receive buffer of the Simatic S7. The receive buffer can point to aprocess image area, a memory bit area or a data block area. The receive buffer mustbe at least as long as the longest data field that can be expected.

The connection ID is generated by the configuration software when an "unspecifiedFDL connection" is configured.

The address and SAP no. of the partner station is supplied with the data in a 4-byte jobheader.

The block parameters are described in detail in Chapter 5.

4.2.4 S5 Function RECEIVE (FB121)

Purpose of the Block

The function block receives the data sent by the partner station. The receive areapointer can point to a process image area, a bit memory area, or a data block area.The job number used is generated by the NCM configuration software when an "FDLconnection" is configured.The Profibus address and SAP no. of the partner is indicated in an 8-byte job header.This is a reference to the source of the received data.

The block parameters are described in detail in Chapter 5.

Page 15: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543115

5 Program Structures and Extracts of Code

This chapter introduces you to the structure of the program for both the active andpassive ends and important sections of code are shown and explained.

Page 16: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543116

5.1 Program Structure of the Active Partner

Incrementvariable value

Yes

No

Program/cycle start

CallAG_SEND

Error occurredwith

AG_SEND?

Save errornumber

Yes

Yes

No

CallAG_RECV

Error occurredwith

AG_RECV?

AG_RECV jobcomplete?

Save errornumber

Yes

No

Fill send job header

Received dataheader :

Partner addr =

No

Page 17: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543117

5.2 Extracts of Code for the Active Partner

5.2.1 Active End: Symbols

Symbol Table Used for the Send / Receive Samples

Use of Symbolic Constants

Through the use of symbolic constants, the code is more readable and it is easierto make program changes.

Example: Instead of "MW42" you then see "SEND_STATUS" in the code.

If you want to use the variable "MW 42" instead of "MW44", you simply need tomodify the symbol table. You do not need to make changes in the actual program.

Page 18: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543118

5.2.2 Active End: OB1

Purpose

OB1 is responsible for cyclic execution of the user program.In this sample program, the blocks that implement the send / receive functionality(AG_SEND and AG_RECV) are called.

Call

OB1 is called in every CPU cycle.

Name

OB1

Code

//

// example for send/receive with 2 bytes of data

//

CALL “MY_SEND_CALL"

//

CALL “MY_RECEIVE_CALL"

//

Description

OB1 calls the blocks named "MY_SEND_CALL" (call AG_SEND) and"MY_RECEIVE_CALL" (call FC AG_RECV) in every cycle.

Page 19: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543119

5.2.3 Active End: AG_SEND Job

Purpose

Two bytes of data are sent to the configured partner using the Send / Receiveservice AG_SEND.

Call

Called within OB1.

Name

MY_SEND_CALL (FC40)

Code

// L 4 // job header: PB address of destination station T DB40.DBB 2 L 3 // job header: LSAP of destination station T DB40.DBB 3 L B#16#0 //job header: Service (SDA = 00h) T DB40.DBB4// CALL "AG_SEND" ACT := TRUE ID := 1 LADDR := W#16#100 SEND := P#DB40.DBX2.0 BYTE 6 LEN := 6 DONE := “SEND_DONE" ERROR := “SEND_ERROR" STATUS := “SEND_STATUS"// AN "SEND_ERROR" BEC// L "SEND_STATUS" T "PARAMETER_ERROR_DB".send_error_status

Page 20: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543120

Meaning of the Parameters for FC "AG_SEND"

� ACT:Edge signal for executing the block.

� ID:This identifier identifies the S/R connection (obtained with "CPU ->Connections").

� LADDR:This parameter provides the address of the local CP (assigned in "HW Config"and can also be read out using "Netpro")

� SEND:Address of a local data area from which values are sent (send area).

� LEN:Length of the data area to be 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.

Assignment of the Send Area:

PB Address LSAP Byte 0,1

Service unused Byte 2,3

Data byte 0 Data byte 1 Byte 4,5

Description

CALL "AG_SEND":The "Send data" FC is called. Depending on the "SEND_ERROR" bit, the statusword is saved or the function is exited using a conditional block end (BEC).

Summary

The job header of the send job is filled to specify the destination station for the datato be sent. The actual user data transferred start in byte 4 of the send area.

The send block is triggered in every cycle to send data from the send buffer(DB40). When an error occurs during sending, the returned status value is saved ina data block (DB43).

Job header

Page 21: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543121

5.2.4 Active End: AG_RECV Job

Purpose

Using FC AG_RECV, 2 bytes of data received from the partner are entered in thespecified receive area.

Call

Called within OB1.

Name

MY_RECEIVE_CALL (FC41)

Code

// CALL "AG_RECV" ID := 1 // connection ID LADDR := W#16#100 // logic module address SEND := P#DB41.DBX2.0 BYTE 6 // ANY pointer to receivebuffer NDR := “RECV_NDR" DONE := “RECV_DONE" ERROR := “RECV_ERROR" STATUS := “RECV_STATUS" // current function status LEN := “RECV_BUFFERLENGTH"// A "RECV_ERROR" // if function error, jump JC err// L "RECV_BUFFERLENGTH" // save length of receive data T "RECV_DB".receive_bufferlength// A “RECV_NDR" // receive new data? FP “EDGE_MEMORY" JCN m001// L DB41.DBB2 // if partner address = 4, goon L 4 ==I JCN m001// L “SEND_DB".send_data[0] // increment send data + 1 T “SEND_DB".send_data[0]M001: BE//err: L “RECV_STATUS" // save current (error) T “PARAMETER_ERROR_DB".receive_error_status

Page 22: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543122

Meaning of the Parameters of FC “AG_RECV"

� ID:This identifier identifies the S/R connection (obtained with "CPU ->Connections").

� LADDR:This parameter provides the address of the local CP (assigned in "HW Config"and can also be read out using "Netpro")

� RECV:Address of a local data area from which the values are transferred.

� NDR: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.

� LEN:Length of the data area to be sent.

Description

CALL "AG_RECV":The FC for data reception is called. The status value is saved depending on the"RECV_ERROR" bit. Otherwise, the received data length is accepted and the dataword incremented if the data was received correctly (new send data prepared).

Summary

The receive block is triggered in every cycle to receive data and write it to thereceive buffer (DB41). When an error occurs during sending, the returned statusvalue is saved in a data block (DB43). If data is received correctly from the definedpartner station (PB addr = 4), the data is incremented.

Page 23: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543123

5.3 Program Structure for the Passive Partner

Yes

Yes

No

Program/cyclestart

CallRECEIVE

Error occurredwith

AG RECV?

CallSEND

Repeat SEND

Copy I/Odata

Yes

No

Error occurredwith

AG SEND?

Set send bit

Reset sendbit

No

Page 24: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543124

5.4 Extracts of Code for the SIMATIC S5 Passive Partner

5.4.1 Passive End: OB1

Purpose

OB1 is responsible for cyclic execution of the user program.The following sample program calls the blocks for executing the functions SENDand RECEIVE.

Call

OB1 is called in every CPU cycle.

Name

OB1

Code

:JU FB 41 call receive-functionName :REC<-SDA : :JU FB 40 call send functionName :SEND>SDA : :BE

Description

OB1 calls the block with the name REC<-SDA and SEND>SDA in each CPU cycle.

Page 25: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543125

5.4.2 Passive End: OB20-OB22

Purpose

OB20-OB22 are intended for programming with the various possible PLC startuptypes.

Call

The blocks OB20 to OB22 are called depending on the type of startup, for example,warm or cold restart. The calls in the example are identical for all three types ofstartup.

Name

OB20 / OB21 / OB22

Code

OB 20

:JU FB 111 synchron for CP 5431

Name :STARTUP

ERR : F 200.0 synchron error for CP 5431

:

:BE

Description

OB20 calls the "STARTUP" FB during startup to initialize communication.

Page 26: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543126

5.4.3 Passive End: FB111

Purpose

FB111 initializes the communications processor.

Call

FB111 is called during startup by one of the OBs OB20 to OB22.

Name

FB111

Code

:

:JU FB 125

Name :SYNCHRON

SSNR : KY 0,0 SSNR - CP5431

BLGR : KY 0,6

PAFE : FY 255

:

:A F 255.0 PAFE error ?

:= =ERR

:

:BE

Description

In "STARTUP" FB 111, the function block FB125 is called to initialize thecommunications processor.

Page 27: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543127

5.4.4 Passive End: SEND Job

Purpose

Using FB SEND, 2 bytes of data are sent to the configured partner.

Call

Called within OB1.

Name

FB40

Code

Name :SEND>SDA send to remote-station 2 bytes

:A F 45.7 "call-send-bit" :JU FB 120

Name : SENDSSNR : KY 0,0A-NR : KY 0,134 job number (ncm5431)ANZW : FW 56QTYP : KS DB send buffer type is dbDBNR : KY 0,40 send buffer is db40QANF : KF +1 send buffer offset is dw1QLAE : KF +5 send length (5 words/10 bytes)PAFE : FY 54 : :A F 57.2 anzw "job complete without err" :AN F 55.0 := F 55.1 edge flag "data transfer : completed" :A F 57.2 := F 55.0 : :A F 55.1 edge flag "data transfer : completed" :AN F 54.0 no pafe by send :R F 45.7 reset "call-send-bit" : :BE

Page 28: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543128

Meaning of the Parameters of the "SEND" FB (FB120)

� SSNR: Interface number of CP.

� A-NR:The job number identifies the S/R connection of the CP.

� ANZW:Display word

� QTYP:Type of buffer area.

� DBNR:The DB number for data blocks.

� QANF:Offset within the buffer area.

� QLAE:Length of the area to send in WORD.

� PAFE:Error byte of the block.

Description

FB "SEND" is called. Depending on the "Data_transfer" and "PAFE" bytes, the sendbit is reset and the block is closed.

Summary

The send block is triggered in every cycle to transfer data.

Page 29: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543129

5.4.5 Passive End: RECEIVE Job

Purpose

Using FB RECEIVE, 2 bytes of data received from the partner are accepted.

Call

Called within OB1.

Name

FB41

Code

FB41Name :REC<-SDA receive data from remote-station :O F 0.0 :ON F 0.0 :JU FB 121 call receive dataName :RECEIVESSNR : KY 0,0A-NR : KY 0,134 job number (ncm5431)ANZW : FW 46ZTYP : KS DB receive buffer type is dbDBNR : KY 0,41 dB number is 41ZANF : KF +1 receive buffer offset is dw1ZLAE : KF -1 receivel ength is jokerPAFE : FY 44 : :A F 47.2 anzw "job complete without err" :AN F 45.0 := F 45.1 edge flag "data acceptance complete" :A F 47.2 := F 45.0 : :A F 45.1 edge flag "data acceptance complete" :AN F 44.0 no pafe error :S F 45.7 set "call send bit" : :C DB 41 data transfer :L DW 5 receive :C DB 40 to :T DW 5 send : :BE

Page 30: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543130

Meaning of the Parameters of FB "RECEIVE"

� SSNR:Interface number of CP.

� A-NR:This parameter shows the job number for the connection of the localcommunication CP.

� ANZW:Display word

� ZTYP:ID for type of receive buffer.

� DBNR:Number of the data block.

� ZANF:Offset of the receive buffer.

� ZLAE:Length of the data area to send. If "–1" is set, the length of the data is obtainedwhen the data is received.

� PAFE:Process image error in executing the receive block.

Description

FB "RECEIVE" is called. When the "receive end" bit "PAFE" bits have beensuccessfully passed the block is closed and the send job bit is set.

Summary

The receive block is triggered in every cycle to receive data and, after successfulreception, to trigger the send job.

Page 31: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543131

6 Operator Control and Monitoring

This chapter covers the following topics:

� Monitoring Variables at the SIMATIC S7 End

� Operation at the SIMATIC S7 End

Page 32: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543132

6.1 Operator Control and Monitoring

Note

If problems occur during operator control and monitoring, please read Chapter 7,Troubleshooting.

Monitoring

You can monitor the functions using the variable table provided with the sample.The following table explains how to use the variable table.

Step Description

1 Insert this end of the MPI cable in the MPI port of the S7 CPU in the activestation

2 Select "Blocks" in the project window of the SIMATIC Manager under the activestation.

3 Double-click "VAT1".

4 In the "Monitoring and Modifying Variables" program, select "PLC" ->"Connect to " -> "Configured CPU"

5 To monitor the specified variables, select "Variable" -> "Monitor"

Note

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 continuouslychanging progress bar.

Page 33: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543133

Display when Monitoring

When you have completed the steps listed above, you will see the followingvariable table (other values are possible!):

Explanation of the Parameters

SEND ParametersIn the upper part, "SEND", you can see the parameters of the AG_SENDSend/Receive service.If the sample is functioning correctly:Amongst other things, the parameter "SEND_DONE" (AG_SEND job complete)should change its state constantly from "0" -> "1" and back again .

RECEIVE ParametersIn the lower part, "RECEIVE", you should observe the same for the AG_LRECVservice.If the sample is functioning correctly:Amongst other things, the parameter "RECV_NDR" (receive data) should changeits state continuously from "0" -> "1 " and back again.

If the error output is set, you will see the status messages of the blocks in "last errorin program".

If the sample is working correctly:Due to the update cycle of the variable table, the written and read data should bedifferent.If the sample is functioning correctly, the data should be continuously changing!

Page 34: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543134

Note

The sample is functioning correctly when the value of the data read and writtenchanges continuously.

Don't forget!The variable table must be online and monitoring must be active for the values tobe updated.

Operator Control

You can call the functions using the variable table provided with the sample. How tostart and activate it was described above.

Note

To 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 passive end.

Step Description

1 Enter a value between 0 and 32767 in the last column ("Modify Value") of theline "MW 52" "SEND_DATA" in the variable table.

2 Select "Variable" -> "Activate Modify Value"

Correct function:If the value has been successfully modified, the value read should also return anew value.

Page 35: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543135

Exiting Operator Control and Monitoring

Step Description

1 In the "Monitoring and Modifying Variables" program select "Table" -> "Exit"

2 Click the "No" button in the subsequent dialog.

Page 36: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543136

7 Troubleshooting

This chapter is intended to help you if you encounter problems installing andstarting up the sample.

Page 37: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543137

Problems Downloading the Hardware Configuration, the Connection, or theBlocks

Run the following checks.If your answer is "NO" to a question, go straight to the corresponding steps in"Remedies".

Step Description

1 Is the MPI cable connected to both the PG/PC and the S7 CPU?

2 In the "Set PG/PC Interface" program is the correct interface parameter setassigned to the "Access point of application" "S7ONLINE (STEP 7)"? Forexample,"MPI-ISA on board (MPI)" if you are using the PG-MPI port.

3 Is the hardware configuration in the project (offline configuration) identical inevery way with the actual configuration (online configuration)?

4 Has the CPU been reset?

Remedies

Correct the problem by working through the steps below if your answer was no toone of the questions above.

Answer to Step 1 was "NO"No connection can be established to the S7 CPU, it is not possible to download tothe CPU.

Step Description

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.

Page 38: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543138

Answer to Step 2 was "NO"No connection can be established to the S7 CPU, it is not possible to download tothe CPU.

Step Description

1 Start the "Set PG/PC Interface" program: "Start" -> "Simatic" -> "SIMATICNET" -> "Set PG/PC Interface" .

2 Set the module you want to use as the MPI port in "Interface parameter setused".For example, "MPI-ISA on board (MPI)" if you are using the PG-MPI port.

3 Click the "OK" button.

Your answer to step 3 was "NO"

Step Description

1 Adapt the actual hardware configuration to that of the project or read thedocumentation "Change_CPU" or "Change_CP" if you want to use a differentCPU or CP than the one used in the sample.

Your answer to step 4 was "NO"

Step Description

1 Reset the CPU.

Page 39: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543139

Variable Table: Written and read data do not change.

Run the following checks.If your answer is "NO" to a question, go straight to the corresponding steps in"Remedies".

Step Description

1 Is the Profibus cable connected to both the active and passive stations?

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?

Remedies

Correct the problem by working through the steps below if your answer was no toone of the questions above.

The answer to step 1 was "NO"No connection can be established between the stations and data exchange is notpossible.

Step Description

1 Connect the end of the PROFIBUS cable to the CP port of the station.

2 Repeat step 1 for the passive station.

Page 40: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543140

Your answer to Step 2 was "NO"No connection was established to the S7 CPU and monitoring was not possible.

Step Description

1 In the program "Monitoring and Modifying Variables", select "PLC" ->"Connect To" -> "Configured CPU".

Your answer to step 3 was "NO"The monitoring function is not activated.

Step Description

1 In the "Monitoring and Modifying Variables" program, select "Variable" ->"Monitor".

Page 41: pb_fdl-sda_s7_s5

SIMATIC NET Quick Start

Profibus Communication: S7-CP342-5 S5-CP543141

Variable Table: Operator control is not working.

Run the following checks.If your answer is "NO" to a question, go straight to the corresponding steps in"Remedies".

Step Description

1 Have you activated "Variable" -> "Modify Value Valid" in the "Monitoring andModifying Variables" program?

2 Is the value you entered for memory word 52 (MW52) between 0 and 32767?

Remedies

Correct the problem by working through the steps below if your answer was no toone of the questions above.

Your answer to step 1 was "NO"

Step Description

1 Select "Variable" -> "Modify Value Valid" in the "Monitoring and ModifyingVariables" program.

Your answer to step 2 was "NO"

Step Description

1 Enter a value between 0 and 32767 in the last column ("Modify Value") of theline "MW 52" "SEND_DATA" in the variable table.

Note

If you do not find the solution to your problem in this chapter, reinstall the sample.