Siemens SIMATIC S7-300 Manual

Siemens SIMATIC S7-300 Manual

Sending and receiving sms messages via serial cps and the md720-3 gprs/gsm modem
Hide thumbs Also See for SIMATIC S7-300:
Table of Contents

Advertisement

Quick Links

Cover
Sending and Receiving SMS Messages
via serial CPs and the MD720-3
GPRS/GSM Modem
SIMATIC S7-300/400/ET 200S, SINAUT MD 720-3
Application Description February 2013
Applications & Tools
Answers for industry.

Advertisement

Table of Contents
loading

Summary of Contents for Siemens SIMATIC S7-300

  • Page 1 Cover Sending and Receiving SMS Messages via serial CPs and the MD720-3 GPRS/GSM Modem SIMATIC S7-300/400/ET 200S, SINAUT MD 720-3 Application Description February 2013 Applications & Tools Answers for industry.
  • Page 2 Industry Automation and Drive Technologies Service & Support Portal This document is taken from the Service Portal of Siemens AG, Industry Automa- tion and Drive Technologies. The following link takes you directly to the download page of this document. http://support.automation.siemens.com/WW/view/en/25545680...
  • Page 3 Problem Solution Functional Mechanisms of this Application Installation SIMATIC Commissioning of the Application Sending and Receiving SMS Mes- sages with MD720-3 Operation of the Applica- tion Further Information References History Sending and Receiving SMS Messages with MD720-3 V 2.1, ID Number: 25545680...
  • Page 4: Warranty And Liability

    If there are any deviations between the recommendations provided in these application examples and other Siemens publications – e.g. Catalogs – then the contents of the other documents have priority. We do not accept any liability for the information contained in this document.
  • Page 5: Table Of Contents

    Table of Contents Table of Contents Warranty and Liability ....................4 Problem....................... 7 Overview of the automation problem ........... 7 Description of the automation problem ..........7 Solution....................... 8 Overview of the overall solution ............8 Description of the core functionality ........... 10 2.2.1 Scenario: “Generating and sending an SMS message”...
  • Page 6 Table of Contents Operation of the Application ................43 Sending an SMS message (scenario 1/scenario 2) ......43 6.1.1 Generating and sending an SMS message ........43 6.1.2 Sending an SMS message with attached coefficient ......45 Receiving an SMS message (scenario 3/scenario 4) ......46 6.2.1 Receiving and evaluating an SMS message........
  • Page 7: Problem

    1 Problem 1.1 Overview of the automation problem Problem Introduction In this application, we will show you how you can implement a simple system for wireless signaling and switching based on SMS messaging. Overview of the automation problem The figure below provides an overview of the automation problem. Figure 1-1 Mobiler Service Prozess...
  • Page 8: Solution

    2 Solution 2.1 Overview of the overall solution Solution Overview of the overall solution Diagrammatic representation The figure below shows the most important components of the solution with an S7- 300 CPU (alternatively, the solution can be implemented with an S7-400 or a CPU of the ET 200S distributed I/O system with SI module –...
  • Page 9 2 Solution 2.1 Overview of the overall solution Table 2-2 Software components Block Function Comment FB “SMS_Meld” Individual user block in Generation of an SMS mes- sage according to a prede- fined logic Send/receive management with SMS library block Evaluation of a receive SMS message FB “SMS_sr_CPxxx”...
  • Page 10: Description Of The Core Functionality

    2 Solution 2.2 Description of the core functionality Description of the core functionality In this example, the required scenarios are implemented with a user block pro- grammed in SCL (FB “SMS_Meld”) and with the aid of a universal SMS library block (FB “SMS_sr_CPxxx”).
  • Page 11: Scenario: "Sending An Sms Message With Attached Coefficient

    2 Solution 2.2 Description of the core functionality 2.2.2 Scenario: “Sending an SMS message with attached coefficient” Figure 2-3 Generating an SMS message with attached coefficient and sending it to configurable recipients Recipients SMS Generator SMS_Meld Message_No Event in the process Value Texte Tel.
  • Page 12: Scenario: "Receiving A Remote Query Of A Value

    2 Solution 2.2 Description of the core functionality 2.2.4 Scenario: “Receiving a remote query of a value” Figure 2-5 Remote query via SMS Send query SMS Interpreter FC50 “SMS_MNG” Order_No SMS_Meld ‘?Temp1’ Message_No:5 Value: 125 celsius Orders Send feedback message “?Temp1”...
  • Page 13: Hardware And Software Components Used

    2 Solution 2.3 Hardware and software components used Hardware and software components used The application was created with the following components: 2.3.1 Hardware for the SIMATIC station Necessary hardware for the S7-300 station The following components are necessary if you want to set up the example with an S7-300 station.
  • Page 14: Gsm Components

    2 Solution 2.3 Hardware and software components used Alternative hardware for the ET200S solution The following components are necessary if you want to set up the example with an ET 200S station with SI module. Table 2-5 Component Qty. Order number Note PS307 5A 6ES7307-1EA00-0AA0...
  • Page 15: Performance Data

    2 Solution 2.4 Performance data Sample files and projects The following table contains all files and projects that are used in this example. Table 2-8 Component Note SMS_SR_Library.zip This zip file contains the library blocks. SMS_Example.zip This zip file contains the user program.
  • Page 16 2 Solution 2.4 Performance data Application software The following table shows the performance data of the FB “SMS_Meld” user block. Table 2-11 Criterion Performance Note data Transmission rate with ASCII 9600 bps Can be changed in the block. driver Number of message texts Can be changed in the block.
  • Page 17: Functional Mechanisms Of This Application

    3 Functional Mechanisms of this Application 3.1 Program overview Functional Mechanisms of this Application Introduction The following sections provide detailed explanations of the functionalities of the dif- ferent scenarios Generating and sending an SMS message Sending an SMS message with attached coefficient Receiving and evaluating SMS orders and Receiving a remote query of a value.
  • Page 18 3 Functional Mechanisms of this Application 3.1 Program overview Call of SMS_Meld in OB1 The following figure and table show the call interface of the core user block FB “SMS_Meld” in OB1. Figure 3-2 Table 3-1 Symbol Data Explanation type Message_No Contains the number of the SMS message to be generat- Send_msg...
  • Page 19: Scenario: "Generating And Sending An Sms Message

    3 Functional Mechanisms of this Application 3.2 Scenario: “Generating and sending an SMS message” Scenario: “Generating and sending an SMS message” Via an internal data array, the FB “SMS_Meld” function block generates a configu- rable text message using the Message_No input variable and sends it to a recipi- ent that is assigned to this variable.
  • Page 20: Program Details For The "Generating And Sending An Sms Message" Scenario

    3 Functional Mechanisms of this Application 3.2 Scenario: “Generating and sending an SMS message” 3.2.2 Program details for the “Generating and sending an SMS message” scenario In this section, we show you the most important code fragments of this function from the documented source code of this example.
  • Page 21 3 Functional Mechanisms of this Application 3.2 Scenario: “Generating and sending an SMS message” Message assignment code fragment The following code lines illustrate how Message_No is assigned to SMS text and telephone number in SCL. Figure 3-6 Call of SMS_sr_CPxxx To send the SMS message, the FB “SMS_Meld”...
  • Page 22: Scenario: "Sending An Sms Message With Attached Coefficient

    3 Functional Mechanisms of this Application 3.3 Scenario: “Sending an SMS message with attached coefficient” Scenario: “Sending an SMS message with attached coefficient” This scenario works like the “Generating and sending an SMS message” scenario. The only difference is that the message text can be sent with an attached coeffi- cient.
  • Page 23: Program Details For The "Sending An Sms Message With Attached Coefficient" Scenario

    3 Functional Mechanisms of this Application 3.3 Scenario: “Sending an SMS message with attached coefficient” 3.3.2 Program details for the “Sending an SMS message with attached coef- ficient” scenario In this section, we show you the most important code fragments of this function from the documented source code of this example.
  • Page 24: Scenario: "Receiving And Evaluating Sms Orders

    3 Functional Mechanisms of this Application 3.4 Scenario: “Receiving and evaluating SMS orders” Scenario: “Receiving and evaluating SMS orders” The FB “SMS_Meld” function block checks all incoming SMS messages for spe- cial “keywords”. When checking the received text with the keyword is positive, the respective order number will be output on the “Order-No”...
  • Page 25: Program Details For The "Evaluating Sms Orders" Scenario

    3 Functional Mechanisms of this Application 3.4 Scenario: “Receiving and evaluating SMS orders” 3.4.2 Program details for the “Evaluating SMS orders” scenario Variables for order allocation The following code fragment shows the “keywords” for which an SMS message is checked in this example. You can enter any special “keywords” in the FB “SMS_Meld”...
  • Page 26: Scenario: "Receiving A Remote Query Of A Value

    3 Functional Mechanisms of this Application 3.5 Scenario: “Receiving a remote query of a value” Scenario: “Receiving a remote query of a value” Using the FB “SMS_Meld” block, SMS messages for querying a value (e.g., the analog value of a temperature) can be interpreted. An automatic feedback mes- sage is sent with the aid of the FC “SMS_MNG”...
  • Page 27: Program Details For The "Receiving A Remote Query Of A Value" Scenario

    3 Functional Mechanisms of this Application 3.5 Scenario: “Receiving a remote query of a value” 3.5.2 Program details for the “Receiving a remote query of a value” scenar- The figure below shows the functionality of FC “SMS_MNG”. To implement this scenario, the block is called in OB1. Figure 3-15 Message_No and Value are then used in the SCL source to generate the feedback message.
  • Page 28: Installation

    4 Installation 4.1 Hardware configuration of the S7 station Installation Hardware configuration of the S7 station Overview This application example includes the following S7 project variants: Table 4-1 Station Variants/program name S7-300 station CP_340 HW Config and S7 program for variant with CP 340 CP_341 HW Config and S7 program for variant with CP 341 ET 200S _1SI...
  • Page 29: S7-300 Station With Cp 341

    4 Installation 4.1 Hardware configuration of the S7 station Table 4-2 Action Remark Attach the individual modules to a suitable rack. List of components Table 2-3 Use a backplane bus connector to connect CPU and Connect all respective components to a 24 V direct Ensure that the polarity is correct.
  • Page 30: S7-300 Station With Et 200S With 1Si Module

    4 Installation 4.1 Hardware configuration of the S7 station 4.1.3 S7-300 station with ET 200S with 1SI module The figure below shows the configuration of the S7-300/ET 200S station. Figure 4-3 Antenna PS307 5A CPU 315-2 PN/DP SIM card 230V Serial MD720-3 ET 200S IM 151-3 PN...
  • Page 31: S7-400 Station With Cp 441-2

    4 Installation 4.1 Hardware configuration of the S7 station 4.1.4 S7-400 station with CP 441-2 The figure below shows the hardware configuration of the project variant with CP441-2. Figure 4-4 Antenna 230V MD720-3 SIM card Serial Table 4-4 Action Remark Attach the individual modules to a suitable rack.
  • Page 32: Md720-3 Hardware Configuration

    4 Installation 4.2 MD720-3 hardware configuration MD720-3 hardware configuration Table 4-5 Action Remark Open the casing of the MD720-3 and insert the SIM card. MD720-3 manual Follow the Close the MD720-3. Connect the antenna to the respective socket. Connect the MD720-3 to a 24 V direct current source. You can also use the PS307 or the PS407 of the S7 station.
  • Page 33: Commissioning Of The Application

    5 Commissioning of the Application 5.1 General preparations Commissioning of the Application General preparations 5.1.1 Installing the application software The following table lists the steps necessary to install the sample code. Table 5-1 Step Procedure The project is available on the HTML page from which you downloaded this docu- ment.
  • Page 34 5 Commissioning of the Application 5.1 General preparations Step Procedure Select the respective COM interface. Set character format and baud rate to the same values as the serial interface of the MD720-3. The factory settings of the MD720-3 are as follows: Baud rate: 19200 bps Character format: 8N1.
  • Page 35: Setting The Modem Parameters

    5 Commissioning of the Application 5.1 General preparations 5.1.3 Setting the modem parameters Before you can send and receive SMS messages, you have to store the following information for the initialization of the MD720-3 modem: PIN of the SIM card in the modem. Number of the short message service center (see library description “25545680_Library_SMS_MD720_DOKU_V2.0_e.pdf”, table 4-1 “SMS_SCA”).
  • Page 36 5 Commissioning of the Application 5.1 General preparations Procedure In the Telefonnumber array, enter the possible recipient numbers to which the SMS messages are to be sent. Make sure that you replace only the telephone number (+49xxxxxxxxxx). The “$R” control char- acter must NOT be deleted! For the cp_adr parameter, enter the logical address of the CP.
  • Page 37: Configuring The Serial Cps

    5 Commissioning of the Application 5.1 General preparations 5.1.4 Configuring the serial CPs Configuration for CP 340 and CP 341 In this example, the serial CP uses the ASCII driver for the interface. This allows sending or receiving AT commands and mere text code to or from a communica- tions partner via the interface.
  • Page 38 5 Commissioning of the Application 5.1 General preparations Action Remark Confirm all dialog boxes with OK. Then recompile the hardware configuration. “Station > Save and Compile” Parameterization and configuration for CP 441-2 Table 5-5 Action Remark CP_441-2 has the RS232 module at interface 1 Communication with a serial CP requires that a and no module at interface 2.
  • Page 39 5 Commissioning of the Application 5.1 General preparations Action Remark For Connection Partner, select Unspecified and for Connection Type, select Point-to-point connection. Close the dialog box with OK. In the following dialog box, you can define the properties. In Local ID, select 1000. This ID is used by the BSEND and BRCV. In Interface, select your interface with the RS232 module and the ASCII driver.
  • Page 40 5 Commissioning of the Application 5.1 General preparations Parameterization and configuration for ET 200S 1SI The following table shows the necessary settings for the ASCII driver of the ET 200S 1SI ASCII serial interface module. Table 5-6 Action In the hardware configuration, double-click on 1 SI ASCII. The Properties dialog box of the module opens.
  • Page 41: Downloading The Step 7 Project

    5 Commissioning of the Application 5.2 Downloading the STEP 7 project Downloading the STEP 7 project Variant for the CP 340/ CP 341/ CP 441-2 communications modules Table 5-7 Action Remark In the SIMATIC MANAGER, set the PC inter- face to MPI. “Options >...
  • Page 42 5 Commissioning of the Application 5.2 Downloading the STEP 7 project Action Remark If you are using an S7-400 station, select the CP_441-2 S7 station and download the entire project to your CPU. “PLC > Download” Double-click on the CPU and then click on Connections.
  • Page 43: Operation Of The Application

    6 Operation of the Application 6.1 Sending an SMS message (scenario 1/scenario 2) Operation of the Application This chapter shows you how to operate the described scenarios of this application. All necessary variables can be found in the “VAT_MELD” variable table. Note For information on errors that may occur when operating the application, please refer to the library description...
  • Page 44 6 Operation of the Application 6.1 Sending an SMS message (scenario 1/scenario 2) Procedure In the “VAT_MELD” variable table, check whether the “Meld.SMS.READY” variable is set. If this is not the case, enable “Init” and reinitialize the modem. The “Message_Number” variable contains the message number that is necessary to generate an SMS message.
  • Page 45: Sending An Sms Message With Attached Coefficient

    6 Operation of the Application 6.1 Sending an SMS message (scenario 1/scenario 2) 6.1.2 Sending an SMS message with attached coefficient The table below lists instructions for sending an SMS message with an attached coefficient. Table 6-2 Procedure Generate a new SMS message as described in steps 4, 5 of table 6.1. In MW 14 “Value”, enter any coefficient as an integer value and enable the val- Send the new SMS message as described in steps 6, 7 of table 6.1.
  • Page 46: Receiving An Sms Message (Scenario 3/Scenario 4)

    6 Operation of the Application 6.2 Receiving an SMS message (scenario 3/scenario 4) Receiving an SMS message (scenario 3/scenario 4) The prerequisites for receiving a new SMS message are as follows: The modem was initialized. The polling timer has elapsed. Do not send an SMS message containing the key word ‘ERROR’...
  • Page 47: Remote Query Of A Value

    6 Operation of the Application 6.2 Receiving an SMS message (scenario 3/scenario 4) Action Remark An individual logic for the Order_No parameter may look as follows: Set and reset flag. If the Order_No of the received message, is, for example, ‘1’ ‘OnM50.1’, the M50.1 flag will be set.
  • Page 48 6 Operation of the Application 6.2 Receiving an SMS message (scenario 3/scenario 4) Table 6-4 Action First open the “VAT_MELD” variable table and enable MW16 with the current temperature value. Open the FC50 “SMS_MNG” function and specify Message_No: 5. Save and download the function. Call the FC “SMS_MNG”...
  • Page 49 6 Operation of the Application 6.2 Receiving an SMS message (scenario 3/scenario 4) Action Write an SMS message which consists of ”?Temp1” and send it to the S7 station. Once the message is received, the receive text is evaluated. If the SMS message has an ‘Order’ as content, the assigned Order_No (e.g., no.
  • Page 50: Further Information

    7 Further Information Further Information RS 232 sniffer Communications processor (CP) and MD720-3 are directly connected to one an- other via a serial cable (RS232 cable). Communication is full duplex, i.e. data can be simultaneously sent and received. For this 1:1 communication, it is not possible to track the data traffic between the terminal units using a normal serial cable.
  • Page 51 7 Further Information Connection diagram The figure below shows the connection diagram for a full duplex RS232 sniffer. Port 1 taps the data of the receive line and port 2 taps the data of the send line. Figure 7-1 If your PC has two serial interfaces, you can display the data traffic in both direc- tions on a screen using a terminal program, e.g.
  • Page 52: References

    8 References References Table 8-1 Topic Link Reference to the document http://support.automation.siemens.com/WW/view/en/25545680 Siemens Industry Customer https://support.automation.siemens.com Support MD720-3 manual 5http://support.automation.siemens.com/WW/view/en/23117745 CP 340 manual http://support.automation.siemens.com/WW/view/en/1137332 First steps with the CP 340 http://support.automation.siemens.com/WW/view/en/12108826 CP 341 manual http://support.automation.siemens.com/WW/view/en/1117397 First steps with the CP 341 http://support.automation.siemens.com/WW/view/en/1188622...
  • Page 53: History

    9 History History Table 9-1 Version Date Modification V2.2 11/2014 Adaptions receive-sms scenarios V2.1 02/2013 The screenshot in table 5-3, point 2 has been changed V2.1 10/2011 The screenshot in table 5-3, point 5 has been changed V2.0 07/2011 Total revision of V1.0 V1.0 16/07/2007 First edition...

This manual is also suitable for:

Simatic 400Sinaut md 720-3Simatic et 200s

Table of Contents