+ All Categories
Home > Documents > 20987910 BaseComm Islaves DOKU v10 e

20987910 BaseComm Islaves DOKU v10 e

Date post: 04-Apr-2018
Category:
Upload: arif-miftahur-rohman
View: 219 times
Download: 0 times
Share this document with a friend

of 32

Transcript
  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    1/32

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    2/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 2/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Warranty, Liability and Support

    We do not accept any liability for the information contained in thisdocument.

    Any claims against us - based on whatever legal reason - resulting from theuse of the examples, information, programs, engineering and performancedata etc., described in this document shall be excluded. Such an exclusionshall not apply in the case of mandatory liability, e.g. under the GermanProduct Liability Act (Produkthaftungsgesetz), in case of intent, grossnegligence, or injury of life, body or health, guarantee for the quality of aproduct, fraudulent concealment of a deficiency or breach of a conditionwhich goes to the root of the contract (wesentliche Vertragspflichten).However, claims arising from a breach of a condition which goes to the rootof the contract shall be limited to the foreseeable damage which is intrinsicto the contract, unless caused by intent or gross negligence or based onmandatory liability for injury of life, body or health. The above provisionsdoes not imply a change in the burden of proof to your detriment.

    The Application Examples are not binding and do not claim to be completeregarding the circuits shown, equipping and any eventuality. They do notrepresent customer-specific solutions. They are only intended to providesupport for typical applications. You are responsible in ensuring that thedescribed products are correctly used.

    These Application Examples do not relieve you of the responsibility insafely and professionally using, installing, operating and servicingequipment. When using these Application Examples, you recognize thatSiemens cannot be made liable for any damage/claims beyond the liabilityclause described above. We reserve the right to make changes to theseApplication Examples at any time without prior notice. If there are anydeviations between the recommendations provided in these ApplicationExamples and other Siemens publications - e.g. Catalogs - then thecontents of the other documents have priority.

    Copyright 2004 Siemens A&D. It is not permissible to transfer orcopy these Application Examples or excerpts of them without firsthaving prior authorization from Siemens A&D in writing.

    For questions about this document please use the followinge-mail-address:

    [email protected]

    mailto:[email protected]:[email protected]:[email protected]
  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    3/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 3/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Table of contents

    1 Task Specification...................................................................................... 42 Principle of the Automation Solution....................................................... 62.1 Overview ...................................................................................................... 62.2 Required components.................................................................................. 63 Function Mechanisms and Project Descriptions.................................... 83.1 Main properties of the S7 basic communication .......................................... 83.2 Structure and function of the S7 project..................................................... 123.3 Server interface.......................................................................................... 163.4 Client user program.................................................................................... 164 Commissioning ........................................................................................ 214.1 Configuring the hardware and loading the S7 project ................................ 214.2 Bus cabling................................................................................................. 234.3 Operator control and monitoring ................................................................ 244.4 Integrating a further (I) slave ...................................................................... 29

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    4/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 4/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    1 Task Specification

    Technological task / overview

    A CPU, as master, is connected to several intelligent stations (I Slaves) viaa Profibus interface.

    Fig. 1-1

    Small data sets shall be transferred from the slave to the master using theS7 basic communication.

    Note

    The S7 basic communication technology has been selected as it is supported byall todays (not highly available) CPUs of the 300 and 400 series.

    The configuration of an active S7 connection, as it would be required for an S7communication (PUT/ GET), is only possible using at least CPU 317 or anadditional Profibus CP as an interface.

    Application requirements

    The application shall illustrate methods of bi-directional data transfer tointelligent Profibus stations.

    In the case of the S7 basic communication, I_PUT/ I_GET enables you toexchange data with intelligent DP slaves without an additional Profibus CP.The slaves are servers which provide small data sets. The master CPU asclient collects the data of several servers.

    In spite of its passive server interface, the trigger for data transfer comesfrom the slaves.

    Furthermore, it should be possible to transfer data sets which exceed themaximum user data size of the S7 basic communication (76 bytes).

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    5/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 5/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    This application shows how the corresponding user interface should looklike at both the server and client sides.

    An I slave can actively send the pre-processed data sets to the DP master.

    The DP master

    receives the data packets and stores them in separate receive buffers.

    A simple disposal and acknowledgement routine should be provided at theclient site for this purpose.

    Note

    This mechanism is generally applicable to all communication types, where the

    CPU provides only a mere server interface (e.g. X_PUT/X_GET, PUT/GET).

    The PUT/GET topic is described in detail in the Client Server Communicationbetween WinAC Basis and S7-200 Stations via S7 Communication (PUT/GET)Application.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    6/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 6/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    2 Principle of the Automation Solution

    2.1 Overview

    The following figure shows the entire hardware configuration.

    Fig. 2-1

    The computer (PG/PC) is used for configuration, as well as for operator

    control and monitoring of the sample application.

    Intelligent slaves have their own CPU which are able to process I/O signalson site. The S7 basic communication enables you to exchange databetween slave and master stations using a Profibus connection.

    2.2 Required components

    Hardware

    Table 2-1

    Component MLFB / Order number Note

    Simatic Field/Power PG 6ES7711-XXXXX-XXXX

    On Board CP 5611 -- Part of PG hardware

    PS 307 5A 6ES7 307-1EA00-0AA0 Or similar PS

    CPU 315-2 DP 6ES7 315-2AG10-0AB0 Support of S7 basiccommunication (seeFAQ 506934)

    IM151-7 CPU ET200S 6ES7 151-7 AA10-0AB0

    Micro Memory Card 6ES7 953-8LF00-0AA0 64k (as an example)

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    7/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 7/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Software

    The following software is required for commissioning:

    Table 2-2

    Component MLFB / Order number Note

    STEP7 V5.2 6ES7810-4CC06-0YX0

    NCM S7 Profibus -- Part of STEP7

    Example project

    This Application consists of the present documentation and a STEP7example project. The example project includes the hardware configuration

    for both stations as well as an executable STL user program for eachstation.

    Table 2-3

    Component Note

    20987910_BaseComm_Islaves_DOKU_v10_d.pdf Documentation, German

    20987910_BaseComm_Islaves_DOKU_v10_e.pdf Documentation, English

    20987910_BaseComm_Islaves_CODE_v10.zip STEP7 example project

    Installation notes are available in Chapter 4 Commissioning.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    8/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 8/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    3 Function Mechanisms and Project Descriptions

    3.1 Main properties of the S7 basic communication

    All todays (not highly available) S7/M7 300/400 (incl. WinAC Slot 41x) andC7-600-CPUs have simple functions (SFCs) for transmission of small datavolumes via S7 connections. The connections are not configured butexplicitly established during the SFC call.

    The maximum amount of transferable user data per communication job is76 bytes at all CPUs as a standard.

    Physical connection of communication partners

    The S7 basic communication is realized through the following networks: MPI Profibus

    Position in the ISO/OSI reference model

    Like the S7 communication, the S7 basic communication also uses the S7protocol for data transfer.

    Fig. 3-1

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    9/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 9/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    The S7 protocol is located on level 7 in the ISO/OSI reference model(application layer) as the used system interface is purely based onapplication data.

    Classification of services of the S7 basic communication

    The S7 basic communication supports the following services:

    I_GET/ I_PUT X_ SEND/ X_RCV X_GET/ X_PUTTable 3-1 contains an overview of the respective performance data. ThisApplication is focused on the service which is coloured in the table below.

    Table 3-1

    Services/Features

    I_GET/ I_PUT X_ SEND/ X_RCV X_GET/ X_PUT

    Address areas E, A, M, D E, A, M, D E, A, M, D

    Dataconsistency

    8 bytes for 300 CPUs

    76 bytes for 400 CPUs

    8 bytes for 300 CPUs

    76 bytes for 400 CPUs

    8 bytes for 300 CPUs

    76 bytes for 400 CPUs

    Principles Internal (Client / Server) External (Client /Server)

    External (Client / Server)

    Max. number ofconnections

    See CPU specification See CPU specification See CPU specification

    Block types SFC 72 I_GETSFC 73 I_PUT

    SFC 74 I_ABORT

    SFC 65 X_SENDSFB 66 X_RCV

    SFC 67 X_GETSFC 68 X_PUT

    SFC 69 X_ABORT

    Stationaddressing

    Logical address =diagnostic address

    Via its MPI address Via its MPI address

    In contrast to external services (with X in front), communication partnersof internal services (with I in front) must be in the same S7 station (slavestations are integrated into the hardware configuration of the master stationin this example).

    User interface I_PUT/ I_GET

    This service enables you to exchange data with all communication partnerswhich can be addressed via E/A addresses of a station (e.g. DP systems).Since this functionality is provided by the operating system of the partner,no SFC is needed to be placed there.

    The number of communication partners which can be successivelyaccessed is not limited (if the disconnection has been configured after thejob execution; see parameters CONT in Table 3-2 and Table 3-3). Yet,the data exchange is considerably quicker if the connection remainsestablished. For more information on possible resource problems see -

    Chapter 4.4 Integrating a further (I) slave.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    10/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 10/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Sending with SFC 73 I_PUT

    The figure below shows the SFC 73 input and output parameters.

    Fig. 3-2

    The individual parameters are defined as follows:

    Table 3-2

    Parameter Decl. DescriptionREQ IN The inactive system function is activated at High

    status.

    CONT IN CONT=0: Once the data transfer is complete, theconnection is disconnected. The usedconnection resource is released again.

    CONT=1: After completion of the data transfer, theconnection remains established. Due tothis, the next job can be executed faster.

    IOID IN Identifier of the address range of the partner module:

    B#16#54 = Peripheral input (PI)

    B#16#54 = Peripheral output (PO)

    LADDR IN Diagnostic address of the partner module configuredin the HW configuration.

    VAR_ADDR IN Pointer to the areas on the partner module to whichthe data will be written.

    SD IN Data area to be sent. SD must be the same length asthe VAR_ADDR parameter at the communicationpartner. Moreover, the data types of SD andVAR_ADDR must also match.

    RET_VAL OUT Error code, if an error occurs while the function isbeing executed.

    BUSY OUT High, sending is not yet completed.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    11/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 11/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Receiving with SFC 72 I_GET

    The figure below shows the SFC 72 input and output parameters.

    Fig. 3-3

    The individual parameters are defined as follows:

    Table 3-3

    Parameter Decl. Description

    REQ IN The inactive system function is activated at High status.

    CONT IN CONT=0: Once the data transfer is complete, the connection isdisconnected. The used connection resource is releasedagain.

    CONT=1: After completion of the data transfer, the connection remainsestablished. Due to this, the next job can be executed faster.

    IOID IN Identifier of the address range of the partner module:

    B#16#54 = Peripheral input (PI)

    B#16#54 = Peripheral output (PO)

    LADDR IN Diagnostic address of the partner module configured in the HWconfiguration.

    VAR_ADDR IN Pointer to the areas on the partner module from which the data will be

    read.RET_VAL OUT Error code if an error occurs while the function is being executed.

    BUSY OUT High, read job is not yet completed.

    RD OUT The receiving area where the data is stored. RD must be the same lengthas the VAR_ADDR parameter of the communication partner. Moreover,the data types of RD and VAR_ADDR must also match.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    12/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 12/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    3.2 Structure and function of the S7 project

    Operating principle

    The S7 project consists of a server (DP slave) and a client (DP master)station.

    The server CPU provides fictitious data in a data block (source area). Bysetting a special trigger bit, the client is prompted to fetch the data. In spiteof its passive server interface, the DP slave logically functions as master.

    The user program of the client CPU cyclically polls the trigger bit of theserver CPU. If the High status is detected, the data is transmitted into alocal data block (target area). Finally, the trigger bit of the server is reset by

    the client.

    Note

    As described in Table 3-2 and Table 3-3, the CONT parameter affects theconnection establishment and disconnection of the communication between thecommunication partners at I_PUT and I_GET. In the present S7 project,CONT was always parameterized with TRUE which causes that the usedconnection remains established after completion of the job.

    This reduces the access time for data transmission, however, it also occupiesconnection resources permanently. The limit of the maximum number ofconnection resources, as well as the number of communication partners involved,

    must thereby be taken into consideration (see Chapter 4.4 "Integrating a further (I)slave.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    13/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 13/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Data flow model

    The components involved in the communication are illustrated in the figurebelow as an example for one connection.

    Fig. 3-4

    According to an ID from the declaration section of the source area, the datais stored in one of the 5 receive buffers created for the slave stations.Besides the net data, a time stamp specifying the trigger time is additionallytransferred and saved.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    14/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 14/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Program structure

    The S7 project has the following structure.

    Fig. 3-5

    The function of the individual blocks is described in the section below.

    Note

    OBs 82 and 86 are also located at the server site in the block container, but theyare not described in this document in detail as they have not been changed. Theyare used for error control in slave operation.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    15/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 15/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Description of program components

    Table 3-4

    Component Function

    OB100 COMPLETERESTART

    When restarting the CPU, the Acknbit is set to 0. Whenacknowledging, this value is assigned to the start bit of thecommunication partner.

    OB1 FB1 is called for each communication partner (data server) withone instance DB per partner. The diagnostic address of thesemodules (source address) as well as the number of a furtherdata block (target area) is transferred.

    OB35 CYC_INT5 Every 100 ms a polling trigger bit is set which fulfils the startingcondition for I_GET calls for polling communication partners in

    OB1.FB1 CLIENT FB1 includes a sequence chart. In the first step, the server is

    polled for a new job (polling). If a new job exists, the data isrequested in the following steps and the receipt finallyacknowledged on the server by resetting the corresponding bit.

    FC1 DYN_ANY FC1 is called by FB1 to dynamically generate the ANY Pointerrequired for the I_GET call (data transfer) using the polledinformation (data set length and -ID).

    DB1Instance of FB1 Instance DB of FB1. As FBI is called for each slave with aseparate instance DB, communication procedures can runcompletely in parallel.

    DB3 SLAVE3 Target area for the configured DP slave. The data block includes

    5 receive buffers of type UDT1 DATA of 108 bytes each.

    Client

    UDT1 DATA 8 bytes are reserved for a time stamp and 100 bytes for net data.

    OB1 Only FC1 is called.

    FC1 SERVER The bit signalling the client that new data is ready to be fetchedis polled in DB1. When a positive edge is identified, the systemtime is read in and filed in DB1 as a time stamp.

    DB1 DATA_RECORD The source area includes a declaration section:

    Start (1 bit),

    Length (1 byte),

    Record_ID (1 byte),

    a time stamp (8 bytes) and maximum 100 bytes of the data typeUDT1 DATA for net data.

    Server

    UDT1 DATA 100 bytes are reserved for net data.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    16/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 16/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    3.3 Server interface

    Note

    The user program of the server is limited to updating the time stamp in DB1 afterthe start bit was set there, as already mentioned in Table 3-4. The comments in theAWL code are sufficient for understanding the procedures involved.

    The DB1 DATA_RECORD memory area, the actual interface of theserver, has the following structure:

    Table 3-5

    Symbolic Name Start address Explanation

    Start 0.0 Signals the client that a new data set is available.

    Length 1.0 Specified length of net data. 100 bytes are definedas the maximum value.

    Record_ID 2.0 A value between 1 and 5 specifying the receivebuffer where the data is to be stored in therespective client DB.

    Time_Stamp 4.0 It is automatically updated by the S7 program.Specifies the time when the start bit was set.

    Data_record From 12.0 Maximum 100 bytes of net data.

    3.4 Client user program

    Program sequence

    The following table describes the FB1 CLIENT program sequence. It isrealized as a simple sequence chart.

    Note

    For an understanding of FC1 DYN_ANY for dynamic generation of ANY pointers,

    comments in the AWL code are sufficient.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    17/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 17/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Table 3-6

    Flowchart Explanation

    Network 1

    to Network 2

    STEP 1 (first step of the sequence chart)

    STEP 1 is activated after the first call of FB1 aswell as at the end of the sequence chart.

    An I_GET call (SFC 72) which polls the first 3bytes from the source DB is started by OB35 oneach trigger as long as STEP1 is active.

    The received start bit is checked after eachcomplete I_GET call.

    Depending on the received data set length, thestart conditions for either one or two I_GETcalls are activated. Furthermore, lengthspecifications required for the pointers arecalculated.

    Network 2

    to Network 3

    STEP2

    Based on the polled information, FC1 generatesANY pointers required for I_GET as a sourceand target address.

    The time stamp and (the first) net data areloaded.

    If a further I_GET call is required to transfer allthe data, STEP2_a is activated. Otherwise theacknowledgment takes place in STEP3.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    18/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 18/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Flowchart Explanation

    Network 3

    to Network 4

    STEP2_a

    Based on the polled information, FC1 generatesANY pointers required for I_GET as a sourceand target address. They point to the secondpacket of the data set.

    The second packet of the net data is loaded.

    Network 4

    to the block end

    STEP3

    The successful receipt of data is acknowledgedon the server by resetting the start bit.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    19/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 19/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Code excerpt FB1 CLIENT Poll

    The SFC72 I_GET call for polling a server (DP slave) is depicted below.The functions of individual parameters have already been described inTable 3-3.

    Fig. 3-6

    The ANY pointer to the source area (VAR_ADDR) is directly specified here.The target area parameter (RD), however, point to a byte array in theinstance DB.

    The first 3 bytes of the source DB are polled. The start bit, data set lengthand -ID are contained there. The 3 bytes are stored locally. Finally, thearray is evaluated and the following information filtered.

    InstructionFromServer (Start bit)

    Length (byte)

    Record_ID (byte)

    Code excerpt FB1 CLIENT Data receipt

    Dependent on the polled data set length one or two I_GET calls arerequired. Both code elements are only distinguished by their source andtarget addresses which were dynamically generated by FC1 DYN_ANY

    beforehand.The example figure below shows an I_GET call for the first of two possibledata packets.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    20/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 20/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Fig. 3-7

    The ANY pointers to the source and target area are provided here with thereturn values of FC1 DYN_ANY. Besides the addresses, the dynamicpointers also include the number of bytes to be transferred which isspecified by the polled length.

    Code excerpt FB1 CLIENT Acknowledgment

    For write access to the server an I_PUT function is called which resets thestart bit in the source DB.

    Fig. 3-8

    VAR_ADDR directly points to the first bit in DB of the server. The value ofthe local bit memory AcknBit (M2.1) describes the value which is alreadyin the Low status (False cannot be directly transferred to the SDparameter).

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    21/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 21/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    4 Commissioning

    Note

    At this point, we will not go further into the installation of STEP7. The installationtakes place in the familiar Windows environment and is self-explanatory.

    There is a number of methods to load S7 user programs into CPUs, however, justone of them is described in the following. Please use the method you prefer.

    4.1 Configuring the hardware and loading the S7 project

    The components of the hardware configuration can be seen in Chapter 2.2

    Required components

    Table 4-1

    Step Action Description / Picture

    1 Mount the S7-300 with the PSmodule to the rack rail according tothe installation guidelines.

    Master station

    2 Mount the IM151-7 CPU (ET200S) incl. Micro Memory Card toa rail according to the installationguidelines and connect the power

    supply.

    Slave station

    3 During initial commissioning,(delivery status) the CPUs can beaccessed via MPI.

    Open the Run ->SIMATIC ->STEP 7 -> PG/PC-Setting thePG/PC-Interface dialog box.Select MPI as the access point.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    22/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 22/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Step Action Description / Picture

    4 Check the settings in the

    Properties dialog box and closethe two dialog boxes by clickingOK.

    5 Connect the MPI interface of theMaster CPU directly with yourPG/PC using an MPI/ Profibuscable.

    6 If not already done, open theproject in the SIMATIC Managerand select Station1_Master. Loadthe client program into S7-CPUusing PLC -> Download or the

    button.

    Besides the user program, the networkconfiguration already configured in the HWconfiguration is loaded:

    MPI address: 2

    Profibus DP address: 2

    7 Checkmark the PG/PC is the onlymaster on the bus in theProperties dialog box of the PG/PCinterface.

    See Step 3 and Step 4.

    8 Now connect the Profibus interfaceof the ET 200S directly with yourPG/PC.

    9 Select Station2_Slave and load theserver program into the CPU of theET 200S using PLC -> Download

    or the button.

    Besides the user program, the networkconfiguration already configured in the HWconfiguration is loaded:

    Profibus DP address: 3

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    23/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 23/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    4.2 Bus cabling

    By loading the stations, the IM 151-7 CPU has been configured as (I) slaveand the S7-300 CPU as DP master. In the following, the installation of theProfibus communication is completed.

    Table 4-2

    Step Action Description / Picture

    1 Connect the Profibus interface ofthe Master CPU to theMPI/Profibus interface of the ET200S.

    Bus cabling

    2 Connect a further MPI/ Profibus

    cable you connected to your PG/PC alternatively to the Profibusconnector of the master or slave.

    Configuration cable

    3 Open the Start ->SIMATIC ->STEP 7 -> PG/PC-Setting thePG/PC-Interface dialog box.Select Profibus as the accesspoint.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    24/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 24/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Step Action Description / Picture

    4 Check the settings in the

    Properties dialog box and closethe two dialog boxes by clickingOK.

    4.3 Operator control and monitoring

    Introduction

    Variable tables by means of which communication is controlled areincluded in the Master and Slave user programs.

    AT_Master and VAT_Slave can be found in the respective blockcontainer of the two configured stations and opened by a double-click of themouse. To display both open variable tables side by side, we recommendusing the menu item Window Arrange Horizontally.

    Using the button will display the online values in the stations.

    Furthermore, the button can be used for overwriting the values with acontrol value.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    25/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 25/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    VAT_Slave (Server)

    Fig. 4-1

    The memory areas under Declaration, as well as Net data must becontrolled manually. Under Timestamp, however, the user program storesthe time at which the start bit is changed to 1.

    The addresses entered are defined as follows:

    Table 4-3

    Address Symbol Meaning

    DB1.DBX 0.0 DATA_RECORD.Start Start bit: instructs the masterstation to transfer data

    DB1.DBB 1 DATA_RECORD.Length The length of net data to betransferred in bytes

    DB1.DBB 2 DATA_RECORD.Record_ID Specifies the receive buffer in thetarget DB of the master station

    DB1.DBB 4 Year

    DB1.DBB 5 Month

    DB1.DBB 6 Day

    DB1.DBB 7 Hour

    DB1.DBB 8 Minute

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    26/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 26/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Address Symbol Meaning

    DB1.DBB 9 Second

    DB1.DBB 10 Millisecond (digits 1 and 2)DB1.DBB 11 Millisecond (digit 3) and weekday

    DB1.DBB 12 DATA_RECORD.Data_record.Data[1]

    DB1.DBB 13 DATA_RECORD.Data_record.Data[2]

    DB1.DBB 14 DATA_RECORD.Data_record.Data[3]

    ... ...

    DB1.DBB 111 DATA_RECORD.Data_record.Data[100]

    Maximum 100 bytes of net data

    VAT_Master (Client)

    Fig. 4-2

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    27/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 27/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Besides the polled information and 5 receive buffers, some interestingstatus bits for monitoring the program sequence are also displayed underProcess control.

    Note

    If the S7-300 CPU is in RUN, fast status changes of the symbols RET_VAL_getand Busy_get can be seen. This is caused by the cyclic triggering of the I_Getfunction to poll the slave by OB35.

    The symbols entered (memory spaces) are defined as follows:

    Table 4-4

    Address Symbol Meaning

    DB1.DBX 4.4 Instance of FB1.InstructionFromServer

    Start bit

    DB1.DBB 6 Instance of FB1.Length The length of net data to be transferredin bytes

    DB1.DBB 8 Instance of FB1.Record_ID Specifies the receive buffer

    DB1.DBX 4.0 Instance of FB1.STEP1

    DB1.DBX 4.1 Instance of FB1.STEP2

    DB1.DBX 4.2 Instance of FB1.STEP2_a

    DB1.DBX 4.3 Instance of FB1.STEP3

    Status of the sequence chart of FB1

    DB1.DBX 5.0 Instance of FB1.Busy_get Indicates whether an I_GET function isbeing currently executed

    DB1.DBW 10 Instance of FB1.RET_VAL_ get Indicates the status of the I_GETfunction (refer to Help)

    DB1.DBX 5.1 Instance of FB1.Busy_put Indicates whether an I_PUT function isbeing currently executed

    DB1.DBW 12 Instance of FB1.RET_VAL_ put Indicates the status of the I_PUTfunction (refer to Help)

    DB3.DBB 0

    DB3.DBB 1

    DB3.DBB 2

    DB3.DBB 3

    DB3.DBB 4

    DB3.DBB 5

    DB3.DBB 6

    DB3.DBB 7

    DB3.DBB 8 SLAVE3.ID_1.Data[1]

    ... ...

    DB3.DBB 539 SLAVE3.ID_5.Data[100]

    Receive buffers 1 to 5 of the target DBwhich each contain the time stamp andnet data

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    28/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 28/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Control of data transfer

    The following step table shows you how to transfer data from the slave tothe master.

    Set the CPUs into the RUN status, open both variable tables and use the

    button to change to the online mode.

    Table 4-5

    Step Action Description / Picture

    1 Enter any values into the Modifyvalue column of VAT_Slave in theNet data area.

    2 Click the button, to apply controlvalues.

    3 Proceed in the same way with the dataset length (value range 0 to 100) andthe -ID (value range 1 to 5).

    4 If you now set the start bit, the currenttime is entered under Timestamp.

    5 Monitor the start bit. After approx. 1 second the start bit is resetby the master. The transfer of data wassuccessful.

    6 Now have a look at the result inVAT_Master. Your data is in therespective receive buffer of the targetDB.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    29/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 29/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Note

    The following average time values for complete jobs with different data set lenghtshave been determined in a test:

    Entire data packet

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    30/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 30/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Step Action Description / Picture

    4 Open the HW configuration of

    Station1_Master.Move the ET 200S / CPU object fromHardware Catalog Profibus DPET 200S to the DP Master systemusing Drag & Drop. (see figure of

    Step 7)

    The dialog box DP Slave propertiesautomatically opens. Click the"Connect" button.

    5 Assign the master and slaveaddresses to each other in theConfiguration tab using the Editbutton.

    One of the default addressassignments can be removed.

    Close the configuration with "OK".

    6 Note the diagnostic address assignedby the system on the "General" tab(here 2044).

    7 Save and close the hardwareconfiguration.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    31/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Rev. A Final 18.02.2004 31/32

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    S7 programs

    Table 4-7

    Step Action Description / Picture

    1 Copy the contents of the blockcontainer from Station2_Slave(without the system data) toStation3_Slave. When asked if thealready existing OB1 is to beoverwritten, say "Yes".

    2 In the block container ofStation1_Master you now create aDB4 SLAVE4 from DB3 SLAVE3using Copy or Save As.

    The indices in the symbolic namesrefer to the bus addresses.

    3 To be able to monitor a further datatransfer, the variable tableVAT_Master is to be extended by thereceive area of the DB created in

    Step 2.

    Same as receive area of DB3 SLAVE3.

    See Step 6 of Table 4-5.

    4 Open OB1 of Station1_Master inAWL editor and add another FB1CLIENT call with a new instance DB(Call FB1, DB2) under network 2.

    When asked if DB2 is to be created,say Yes.

    Parameterize Source_Addr with the

    slave diagnostic address inhexadecimal format (see Table 4-5,Step 6).

    Enter the number of the data block (inhexadecimal format) created in Step 2behind Destin_DB (here 4 for DB4).

    Save and close OB1.

    5 Now you can directly load theStation1_Master CPU using theexisting Profibus connection.

  • 7/30/2019 20987910 BaseComm Islaves DOKU v10 e

    32/32

    Client / Server Communication with (I) Slaves via S7 Basic Communication

    Copyrig

    ht

    Siemen

    sAG

    Fehler!UnbekannterNamefr

    Dokument-E

    igenschaft.

    Allrig

    htsreserve

    d

    20987910

    _Base

    Comm

    _Islaves

    _DOKU

    _v

    10

    _e

    Step Action Description / Picture

    6 To load the user program ofStation3_Slave, execute the steps ofTables 4-1 and 4-2 relevant forStation2_Slave.

    Maximum configuration

    Connections, once established between master and slave, remainestablished. Therefore it is important to observe the maximum number ofconnection resources of your CPU. The relevant specification can be foundin the HW configuration under the properties of the configured CPU.

    The CPU 315-2 DP, used here as an example, provides a maximum of 12connections for the S7 basic communication.

    Fig. 4-3

    As mentioned in Table 3-2and Table 3-3, the program makes it alsopossible to disconnect the connection after each communication job.


Recommended