0% found this document useful (0 votes)
86 views32 pages

SMS Messaging with SCALANCE M874/876

This document discusses sending and receiving SMS messages via a SCALANCE M router. It provides an overview of the library functions and describes configuring a SCALANCE M874/M876 router, including entering the SMS service center.

Uploaded by

Bob Rhem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views32 pages

SMS Messaging with SCALANCE M874/876

This document discusses sending and receiving SMS messages via a SCALANCE M router. It provides an overview of the library functions and describes configuring a SCALANCE M874/M876 router, including entering the SMS service center.

Uploaded by

Bob Rhem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Sending and

Receiving SMS
Messages via a
SCALANCE M Router

SCALANCE M874/ M876, S7-300/ S7-400/ IM151-8


Siemens
PN CPU/ STEP 7 V5.6/ V1.0 Industry
Online
https://support.industry.siemens.com/cs/ww/en/view/54361177 Support
Legal information

Legal information
Use of application examples
Application examples illustrate the solution of automation tasks through an interaction of several
components in the form of text, graphics and/or software modules. The application examples are
a free service by Siemens AG and/or a subsidiary of Siemens AG ("Siemens"). They are
non-binding and make no claim to completeness or functionality regarding configuration and
equipment. The application examples merely offer help with typical tasks; they do not constitute
customer-specific solutions. You yourself are responsible for the proper and safe operation of the
products in accordance with applicable regulations and must also check the function of the
respective application example and customize it for your system.
Siemens grants you the non-exclusive, non-sublicensable and non-transferable right to have the
application examples used by technically trained personnel. Any change to the application
examples is your responsibility. Sharing the application examples with third parties or copying the
application examples or excerpts thereof is permitted only in combination with your own products.
The application examples are not required to undergo the customary tests and quality inspections
of a chargeable product; they may have functional and performance defects as well as errors. It is
your responsibility to use them in such a manner that any malfunctions that may occur do not
result in property damage or injury to persons.

Disclaimer of liability
Siemens shall not assume any liability, for any legal reason whatsoever, including, without
limitation, liability for the usability, availability, completeness and freedom from defects of the
application examples as well as for related information, configuration and performance data and
any damage caused thereby. This shall not apply in cases of mandatory liability, for example
under the German Product Liability Act, or in cases of intent, gross negligence, or culpable loss of
life, bodily injury or damage to health, non-compliance with a guarantee, fraudulent
non-disclosure of a defect, or culpable breach of material contractual obligations. Claims for
damages arising from a breach of material contractual obligations shall however be limited to the
© Siemens AG 2019 All rights reserved

foreseeable damage typical of the type of agreement, unless liability arises from intent or gross
negligence or is based on loss of life, bodily injury or damage to health. The foregoing provisions
do not imply any change in the burden of proof to your detriment. You shall indemnify Siemens
against existing or future claims of third parties in this connection except where Siemens is
mandatorily liable.
By using the application examples you acknowledge that Siemens cannot be held liable for any
damage beyond the liability provisions described.

Other information
Siemens reserves the right to make changes to the application examples at any time without
notice. In case of discrepancies between the suggestions in the application examples and other
Siemens publications such as catalogs, the content of the other documentation shall have
precedence.
The Siemens terms of use (https://support.industry.siemens.com) shall also apply.

Security information
Siemens provides products and solutions with Industrial Security functions that support the secure
operation of plants, systems, machines and networks.
In order to protect plants, systems, machines and networks against cyber threats, it is necessary
to implement – and continuously maintain – a holistic, state-of-the-art industrial security concept.
Siemens’ products and solutions constitute one element of such a concept.
Customers are responsible for preventing unauthorized access to their plants, systems, machines
and networks. Such systems, machines and components should only be connected to an
enterprise network or the Internet if and to the extent such a connection is necessary and only
when appropriate security measures (e.g. firewalls and/or network segmentation) are in place.
For additional information on industrial security measures that may be implemented, please visit
https://www.siemens.com/industrialsecurity.
Siemens’ products and solutions undergo continuous development to make them more secure.
Siemens strongly recommends that product updates are applied as soon as they are available
and that the latest product versions are used. Use of product versions that are no longer
supported, and failure to apply the latest updates may increase customer’s exposure to cyber
threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed
at: https://www.siemens.com/industrialsecurity.

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 2
Table of contents

Table of contents
Legal information ......................................................................................................... 2
1 Library Overview ................................................................................................ 4
1.1 General information .............................................................................. 5
1.2 Functions .............................................................................................. 6
1.3 Hardware and software requirements .................................................. 8
2 SCALANCE M874/M876 Configuration ............................................................ 9
2.1 Entering the SMS service center .......................................................... 9
2.2 Configuring the access details for the cellular network ...................... 10
2.3 Configuring SMS Relay (Outgoing) .................................................... 12
2.4 Configuring SMS Relay (Incoming) .................................................... 13
3 Function Blocks of the "LSmsSR" Library ................................................... 15
3.1 The "LSmsSR_SndSms" library block ............................................... 15
3.1.1 Call and parameter interface .............................................................. 15
3.1.2 Format of an SMS message to the SCALANCE M router ................. 16
3.1.3 Description of the "Send SMS message" function ............................. 18
3.1.4 UDT1 "LSmsSR_typeSmsSnd" .......................................................... 19
3.2 The "LSmsSR_RcvSms" library block ................................................ 21
3.2.1 Call and parameter interface .............................................................. 21
3.2.2 Format of an SMS message to the SCALANCE M router ................. 22
3.2.3 Description of the "Receive SMS message" function ........................ 24
© Siemens AG 2019 All rights reserved

3.2.4 UDT2 "LSmsSR_typeSmsRcv" .......................................................... 25


3.3 Status and error displays.................................................................... 26
4 Working with the Library................................................................................. 27
4.1 Integrating the library into STEP 7 ..................................................... 27
4.2 Integrating the library block into STEP 7 ............................................ 27
4.3 Updating the "LSmsSR" library .......................................................... 30
5 Appendix .......................................................................................................... 31
5.1 Service and support ........................................................................... 31
5.2 Links and literature ............................................................................. 32
5.3 Change documentation ...................................................................... 32

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 3
1 Library Overview

1 Library Overview
This document describes the "LSmsSR" block library for sending and receiving an
SMS message to/ from SIMATIC S7-300/ S7-400 und IM151-8 PN CPUs using the
SCALANCE M874/M876 router.
The block library provides you with tested code with clearly defined interfaces.
They can be used as a basis for the task you want to implement.

The main focus of this document is to describe


• the use of the SMS blocks and
• the functionality implemented.

Furthermore, this documentation shows possible fields of application and helps you
integrate the library into your STEP 7 project using step-by-step instructions

Validity of the library


• SIMATIC S7-300 CPUs
– CPU 31x-2 PN CPUs V3.1 or higher
– CPU 31x-3 PN CPUs V3.2 or higher
• SIMATIC S7-400 CPUs with integrated Ethernet port on CPU
© Siemens AG 2019 All rights reserved

• IM151-8 PN CPUs V3.2 or higher


• SCALANCE M874/ M876 Firmware V4.1.1 or higher
• SIMATIC STEP 7 V5.6 SP1

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 4
1 Library Overview

1.1 General information


The "LSmsSR" library allows you to execute the following functions:
• send customized messages (e.g., messages regarding your plant status) to a
GSM-capable mobile device (SMS Relay Outgoing) via SMS using the
SCALANCE M874/M876 router
• receive an SMS message from a GSM-capable mobile device (SMS Relay
Incoming) using the SCALANCE M874/M876 router
Figure 1-1

"LSmsSR“
Library

Cellular network
© Siemens AG 2019 All rights reserved

S7-400/ S7-300/ SCALANCE Smartphone


IM151-8 PN CPU M874/ M876

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 5
1 Library Overview

1.2 Functions
Overview
The "LSmsSR_SndSms" and "LSmsSR_RcvSms" function blocks of the "LSmsSR"
library are required for data exchange between S7-CPUs and the SCALANCE
M874/M876 router.

Core functions of the function blocks


• Send SMS message ("LSmsSR_SndSms")
Send SMS message to GSM-capable mobile device via SCALANCE
M874/M876.
• Receive SMS message ("LSmsSR_RcvSms")
Receive SMS message from GSM-capable mobile device via SCALANCE
M874/M876.

A temporary TCP/IP connection to the partner is established for each function:


• "Send SMS message": Active connection establishment and termination by S7
CPU
• "Receive SMS message": Active connection establishment and termination by
router.
© Siemens AG 2019 All rights reserved

"Send SMS message" sequences


For the "Send SMS message" function, the S7 CPU is the active partner. To send
the SMS message, it establishes a connection to the router. The S7 CPU sends
the SMS message to the router via this connection.
When the SMS message has been sent, the connection to the router is terminated.
Figure 1-2
S7 CPU SCALANCE M874/M876 Mobile device
Active partner Passive partner
temporary
• IP address TCP/IP connection
connection
• ID
Enable SMS Relay
• Username
• Password Username
• Remote Port must Password
• TelNo match Port Number
• smsText TelNo TelNo
smsText

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 6
1 Library Overview

"Receive SMS message" sequences


For the "Receive SMS message" function, the S7 CPU is the passive partner. It
passively waits for connection establishment by the router. When the router
receives a command SMS message, it establishes a connection to the S7 CPU
and sends the message to the CPU. When the SMS message has been received,
the connection to the S7 CPU is terminated.
Figure 1-3

Mobile device SCALANCE M (active) Recipient


relay connections S7 CPU (passive)

S7 CPU 1
Connection1
IP address of S7 CPU 1 RcvSms Message

Phone no. identification


TCP/IP connection

Connection2
IP address of S7 CPU 2
S7 CPU 2
.
.
TCP/IP connection
ConnectionN
IP address of S7 CPU N
© Siemens AG 2019 All rights reserved

NOTE If a connection between the SCALANCE M router and the S7-CPU cannot be
established, all SMS messages received by the router will be deleted.

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 7
1 Library Overview

1.3 Hardware and software requirements


Requirements for this library
To be able to use the functionality of the library described here, the following
hardware and software requirements must be met:

Hardware
Table 1-1
Component Article number Number Note
SCALANCE M874-3 6GK5874-3AA00-2AA2 1 Alternatively, you can use
any variants of the
SCALANCE M874 and M876
series.
SIMATIC S7-300 6ES7315-2EH14-0AB0 1 Any S7-300 PN-CPU can
CPU 315-2 PN/DP be used.

SIMATIC S7-400 6ES7414-3EM06-0AB0 Any S7-400 PN-CPU can


CPU 414-3 PN/DP be used.

IM151-8 PN/DP CPU 6ES7151-8AB01-0AB0 (see Validity of the library)


ANTENNE ANT794- 6NH9860-1AA00 1 GSM quad-band and
4MR UMTS and LTE (Europe)
© Siemens AG 2019 All rights reserved

SIMATIC Micro 6ES7953-8LP20-0AA0 1 Memory Card for the


Memory Card S7-300 CPU

SIM card 1

Software

Component Article Number


number
STEP 7 Professional V5.6 SP1 1 6ES7810-4CC11-0YA5

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 8
2 SCALANCE M874/M876 Configuration

2 SCALANCE M874/M876 Configuration


In order for the router to send/receive SMS messages, make the following settings
on the device’s Web Based Management page:
• Enter the SMS service center
• Configure the access details for the cellular network
• Configure SMS Relay (Outgoing)
• Configure SMS Relay (Incoming)

NOTE For a more detailed description of how to configure the SCALANCE M874/M876
router using Web Based Management, please refer to the device manual (see
\3\).

2.1 Entering the SMS service center


To enable the router to send an SMS message, enter the short message service
center (SMSC) of your mobile service provider or service provider.
With the router’s WBM page ("System > SMS> General"), you can replace the
default SMS service center call number by another one. This depends on your
© Siemens AG 2019 All rights reserved

contract.
Figure 2-1

Note The SMSC number is only required for sending SMS messages. If you only want
to receive SMS messages, this number is irrelevant.

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 9
2 SCALANCE M874/M876 Configuration

2.2 Configuring the access details for the cellular network


Access to the cellular network and the mobile telecommunications services
requires the following access parameters:
• SIM card PIN
• APN access data
To configure the access detail for the cellular network, proceed as follows
1. Open the router’s WBM page.
Note:
In the address bar of the web browser, enter the IP address or the URL of the
device.
2. Enter the name "admin" and the associated password.
Figure 2-2
© Siemens AG 2019 All rights reserved

Note:
When you log in for the first time or after "Restore Factory Defaults and
Restart", enter
– the default name "admin"
– the default password "admin".
The password needs to be changed after the first logon or after a "Restore
Factory Defaults and Restart".
3. Click the "Login" button or confirm your entries with "Enter".
4. In the "SIM" tab of the WBM page of the SCALANCE M874/M876, enable the
mobile network interface, "Interfaces > Mobile > SIM".
Figure 2-3

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 10
2 SCALANCE M874/M876 Configuration

5. Enter the SIM card PIN.


Figure 2-4

Note:
The PIN can be obtained from your mobile service provider.
6. Open the "Operator” tab: "Interfaces > Mobile > Operator". In "APN" enter the
name of the mobile network operator. Check the "Manual APN" check box.
Figure 2-5
© Siemens AG 2019 All rights reserved

Note:
When the "Manual APN” check box is unchecked, the device automatically
selects the appropriate access parameters from the list of mobile network
operators. By factory default, the access details of four mobile network
operators are set and activated. The manually configured APN will be ignored.

NOTE These access parameters can be obtained from your mobile network operator.

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 11
2 SCALANCE M874/M876 Configuration

2.3 Configuring SMS Relay (Outgoing)


To enable the router to send an SMS message, make the following settings on the
router’s WBM page:
1. On the WBM page of the SCALANCE M874/M876, open the " System > SMS"
menu.
2. Open the "SMS Relay (Outgoing)") tab.
3. Enable the sending of SMS messages from the local network.
Figure 2-6

4. Enter the user name and password that must be included before the text is
sent by SMS.
© Siemens AG 2019 All rights reserved

Note:
The user and password must match the values entered in the "username" and
"password" "LSmsSR_typeSmsSnd"- parameters.
5. Enter the port on which the SCALANCE M receives the SMS message.
Figure 2-7

Note:
This port number must match the port address entered in the "remotePort"
"LSmsSR_typeSmsSnd"- parameter (here: 26864).

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 12
2 SCALANCE M874/M876 Configuration

NOTE At a given time, only one S7 CPU can establish a connection to the SCALANCE
M router and send the SMS message.
If multiple CPUs attempt to establish a connection to the SCALANCE M router at
a given time, the escalation block is terminated with error:
16#000180A1:The specified connection or the port is already being used
(Chapter 3.3).

2.4 Configuring SMS Relay (Incoming)


To enable the router to receive an SMS message and send it to the application,
make the following settings on the router’s WBM page:
1. On the WBM page of the SCALANCE M, open the "System > SMS" menu.
2. Open the "SMS Command" tab.
3. Enable the function "Enable Command SMS".
4. Enter all phone numbers from which the router should receive a command
SMS message.
Figure 2-8
© Siemens AG 2019 All rights reserved

+4917123456789

For these phone numbers, check "Relay".


5. Open the "SMS Relay (Incoming)" tab "System > SMS > SMS Relay
(Incoming)". Create a relay connection with
– a unique name for the relay connection (Connection Name),
– the recipient’s IP address (IP address of the S7-CPU),
– the port Number.
Figure 2-9

Note:
– The connection name is entered in the command SMS message on the
cellular device: RLY Connection Name smsText. In this way, you define
to which recipient (CPU) the message will be relayed.
– The port number must match the port address entered in the "localPort"
"LSmsSR_typeRcvSnd"- parameter (here: 26864).

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 13
2 SCALANCE M874/M876 Configuration

6. Enter the username to check the reception of the message. The username is
entered in the frame.
Figure 2-10

7. Enter the password associated with the username.


Figure 2-11

8. Repeat the password to confirm it.


Figure 2-12
© Siemens AG 2019 All rights reserved

9. Use "Create" to create the new relay connection.


Figure 2-13

NOTE For a more detailed description of how to configure the SCALANCE M874/M876
router using Web Based Management, please refer to the device manual (see
\3\).

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 14
3 Function Blocks of the "LSmsSR" Library

3 Function Blocks of the "LSmsSR" Library


3.1 The "LSmsSR_SndSms" library block
Introduction
The "LSmsSR_SndSms" FB is used for sending an SMS message via the
SCALANCE M routers.

3.1.1 Call and parameter interface

The following figure shows the call interface of the "LSmsSR_SndSms" library
block.
Figure 3-1
© Siemens AG 2019 All rights reserved

Table 3-1
Name Data type Description
sndSms Bool Starts the send process.
Input

Reacts only to a positive edge.

smsParam "LSmsSR_typeSmsSnd" Parameters required for sending an SMS


InOut

UDT1 message (see Chapter 3.1.4).

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 15
3 Function Blocks of the "LSmsSR" Library

done Bool Set when sending has successfully


completed.
Only valid for one cycle.
Default value: FALSE.
busy Bool If the "LSmsSR_SndSms" block is busy
sending, busy=TRUE.
busy is set to FALSE as soon as the above
sending has completed successfully or
Output

with an error.
error Bool Provides feedback if an error occurs while
executing a routine.
Only valid for one cycle.
Default value: FALSE
status Dword When error = TRUE: Returns the status to
narrow down the cause of the error (see
Chapter 3.3).
Only valid for one cycle.

3.1.2 Format of an SMS message to the SCALANCE M router

The router receives an SMS message from an S7 CPU that is transmitted in a


frame via the TCP/IP connection. The frame matches the following format:
© Siemens AG 2019 All rights reserved

Username#Password#CommandCode#Seq-Num;Phone number;smsText:

1. Username
User name to check the send permission of an SMS message.
Maximum of 10 characters.
Note:
This user name must match the user name entered in WBM.
Figure 3-2

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 16
3 Function Blocks of the "LSmsSR" Library

2. Password
Password associated with the user name.
Maximum of 10 characters.
Note:
This password must match the password entered in WBM.
Figure 3-3

3. CommandCode
Command for sending SMS messages from the local network. The default
value "105" must not be changed.
4. Seq-Num
The sequence number is used to assign multiple requests at the same time.
The function is currently not supported.
5. Phone number
© Siemens AG 2019 All rights reserved

SMS message recipient’s phone number with a maximum of 40 characters.


6. smsText
SMS message text with a maximum of 160 characters.

NOTE For a more detailed description of how to configure the SCALANCE M874/M876
router using Web Based Management, please refer to the device manual (see
\3\).

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 17
3 Function Blocks of the "LSmsSR" Library

3.1.3 Description of the "Send SMS message" function

To send an SMS message, the application has to establish a TCP/IP connection to


the router via the Ethernet interface.
Via this TCP/IP connection, the application sends the target parameters and the
message text to the router, which then sends the information as an SMS message
(see Chapter 3.1.2).
For TCP/IP communication, the "LSmsSR_SndSms" library block internally uses
the "TCON", "TSEND" and "TDISCON" function blocks.
Figure 3-4

smsSnd Establish
active
connection

error
Connected

yes

Sms Generate
Param SMS msg
© Siemens AG 2019 All rights reserved

Send
SMS msg

error
Sent

yes
Terminate Error
active
connection

error
Connection
terminated

yes

End

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 18
3 Function Blocks of the "LSmsSR" Library

3.1.4 UDT1 "LSmsSR_typeSmsSnd"

The "LSmsSR_typeSmsSnd" user-defined datatype contains the parameters for


‘Send SMS message’.
To start up the application, this data type is used in a global data block (DB1
"SmsParam"), that is linked to the "smsParam" InOut parameter of the function
block.
Figure 3-5

1. ipAddress
IP address of the partner (SCALANCE M).
2. deviceId
Local_device_id (see \4\) of the S7-CPU.
3. remotePort
© Siemens AG 2019 All rights reserved

Port number of the remote connection partner (here: of the SCALANCE


M874/M876 router).
Note:
This number must match the address entered in WBM (SMS Relay Outgoing).
Figure 3-6

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 19
3 Function Blocks of the "LSmsSR" Library

4. Usename
User name to check the send permission of an SMS message.
Note:
This user name must match the user name entered in WBM (SMS Relay
Outgoing).
Figure 3-7

5. Password
Password associated with the user name.
Note:
This password must match the password entered in WBM (SMS Relay
Outgoing).
Figure 3-8
© Siemens AG 2019 All rights reserved

6. telNo
SMS message recipient’s phone number.
7. smsText
SMS message text

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 20
3 Function Blocks of the "LSmsSR" Library

3.2 The "LSmsSR_RcvSms" library block


Introduction
The "LSmsSR_RcvSms" FB is used for receiving an SMS message via the
SCALANCE M routers.

3.2.1 Call and parameter interface

The following figure and table show the call interface of the "LSmsSR_RcvSms"
library block.
Figure 3-9

Table 3-2
Name Data type Description
© Siemens AG 2019 All rights reserved

activateRcvSms Bool TRUE:


Activates the reception of SMS
Input

messages.
FALSE:
Deactivates the reception of SMS
messages.
smsParam "LSmsSR_typeSmsRcv" Parameters required for receiving an
PLC data type SMS message (see Chapter 3.2.4).
InOut

ndr Bool Signals that a new SMS message


has been received.
Only valid for one cycle.
busy Bool If the "LSmsSR_RcvSms" block is
busy receiving, busy=TRUE.
busy is set to FALSE as soon as the
above receiving has completed
Output

successfully or with an error.


error Bool Provides feedback if an error occurs
while executing a routine.
Only valid for one cycle.
Default value: FALSE
status Dword When error = TRUE: Returns the
status to narrow down the cause of
the error (see Chapter 3.3).
Only valid for one cycle.

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 21
3 Function Blocks of the "LSmsSR" Library

3.2.2 Format of an SMS message to the SCALANCE M router

The router receives an SMS message from a cellular device in the following format:

RLY Connection Name smsText

• RLY: SMS relay command


• Connection Name: variable, according to the configuration
• smsText: SMS message text

NOTE Only one space is required between the words.

The message is sent to the S7-CPU in a frame via the TCP/IP connection with this
connection name in the following format:

Username#Password#CommandCode#Seq-Num;Phone number;smsText:

1. Username
User name to check the reception of the message.
© Siemens AG 2019 All rights reserved

Maximum of 10 characters.
Figure 3-10

2. Password
Password associated with the user name.
Maximum of 10 characters.
Figure 3-11

3. CommandCode
4. Command for receiving SMS messages from the local network. The default
value "105" must not be changed.
5. Seq-Num
The sequence number is used to assign multiple requests at the same time.
The function is currently not supported.

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 22
3 Function Blocks of the "LSmsSR" Library

6. Connection Name
SMS message recipient’s connection name with a maximum of 40 characters.
7. Phone number
SMS message sender’s phone number.
8. smsText
SMS message text with a maximum of 160 characters.

NOTE For a more detailed description of how to configure the SCALANCE M874/M876
router using Web Based Management, please refer to the device manual (see
\3\).
© Siemens AG 2019 All rights reserved

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 23
3 Function Blocks of the "LSmsSR" Library

3.2.3 Description of the "Receive SMS message" function

Applications can also receive SMS messages via the router’s Ethernet interface.
To do this, the router must establish a TCP/IP connection to the application on the
Ethernet interface. The router receives a command SMS message
(RLY Connection Name smsText) and sends the received message (see Chapter
3.2.2) to the application. For TCP/IP communication, the "LSmsSR_RcvSms"
library block internally uses the "TCON", "TRCV" function blocks.
Figure 3-12

activateRcvSms Configure
passive
=True connection

Wait for router


to establish
connection

SCALANCE M874/M876
establishes the connection
when an SMS message is
received.
Establish
connection
© Siemens AG 2019 All rights reserved

yes

error
Connected

yes Error

error
SMS msg
received

Terminate
connection
SCALANCE M874/M876
terminates the connection
when the SMS message
has been entered in the
Sms Extract CPU.
Param SMS msg

End

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 24
3 Function Blocks of the "LSmsSR" Library

3.2.4 UDT2 "LSmsSR_typeSmsRcv"

The "LSmsSR_typeSmsRcv" user-defined data type contains the receive data.


To start up the application, this data type is used in a global data block (DB1
"SmsParam"), that is linked to the "smsParam" InOut parameter of the function
block.
Figure 3-13

1. deviceId (see \4\)


Local_device_id (see \4\) of the S7-CPU.
2. localPort
Port number of the local connection partner (here: of the S7-CPU).
Note:
This number must match the address entered in WBM (SMS Relay Incoming).
Figure 3-14
© Siemens AG 2019 All rights reserved

3. rcvTelNo
SMS message sender’s phone number.
4. rcvMessage
SMS message text received.

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 25
3 Function Blocks of the "LSmsSR" Library

3.3 Status and error displays


For error diagnostics, evaluate the "LSmsSR_SndSms" and
"LSmsSR_RcvSms" "status" output. By reading the "status" output of the
function block, you are provided with information on logical errors and error
messages that may occur during the communication between the controller
and the router.
The error message structure is such that the first word indicates the block that
triggered this message. For example, error message 16#000180A3 was
triggered by "TCON" instruction. The following tables provide a list of possible
error messages.

"LSmsSR_SndSms" errors
Figure 3-15
Status Meaning Remedy / notes
16#0001xyzx "TCON" error message (active) For a description of the
communication errors, please refer
16#0011xyzx "TSEND" error message
to the STEP 7 Online Help.
16#0111xyzx "TDISCON" error message
16#00008101 Previous job not yet complete.
(You have started a new send
operation, although busy was
still active.)
© Siemens AG 2019 All rights reserved

16#00008102 Watchdog timer alarm. Make sure that


• the IP address entered in the
"ipAddress" parameter is
identical to the IP address of
the SCALANCE M874/M876.
• the S7-1200/S7-1500 CPU is
physically connected to the
SCALANCE M874/M876.
16#00008103 "smsText" contains the
forbidden character ":".
16#00008104 "smsText" contains the
forbidden character ";". Change "smsText"
16#00008105 "smsText" contains the
forbidden character "#".
16#00008106 "telNo" contains the forbidden Change "telNo"
character "x".

"LSmsSR_RcvSms" errors
Table 3-3
Status Meaning Remedy / notes
16#0010xyzx "TCON" error message (passive) For a description of the
communication errors, please
16#0110xyzx "TRCV" error message
refer to the STEP 7 Online Help.

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 26
4 Working with the Library

4 Working with the Library


This chapter consists of instructions for integrating the "LSmsSR" library into your
STEP 7 V15.1 project and instructions for using the library block.

4.1 Integrating the library into STEP 7


The following table shows the steps required to integrate the "LSmsSR" library into
your STEP 7 V5.6 project. After integrating the library, you can use the blocks of
the "LSmsSR" library.

NOTE The following section assumes that a STEP 7 project exists.

1. The library is available on the HTML page from which you downloaded this
document (\2\). Save the "54361177_SMS_SCALANCE_M _LIB_V56_V10.zip"
library to your hard drive.
2. Open the "SIMATIC Manager" and unzip the "54361177_SMS_SCALANCE_M
_LIB_V56_V10.zip" library ("File > Retrieve…").
3. From now on, the library is available under "Libraries".
Figure 4-1
© Siemens AG 2019 All rights reserved

4.2 Integrating the library block into STEP 7


The following table shows the steps required to integrate the elements of the
"LSmsSR" library into your STEP 7 V5.6 project. After integrating these
elements, you can use the blocks of library.
1. Open the existing STEP 7 V5.6 project.
2. Select the S7 program of the "LSmsSR" library.
3. Insert the "Symbols" and the "Sources" in your STEP 7 project using
Drag&Drop.
Figure 4-2

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 27
4 Working with the Library

4. Open the "Blocks" folder of the "LSmsSR" library.


5. Use drag and drop to move the blocks to the "Program blocks" folder of the S7-
CPU.
Figure 4-3

6. Open the global data block DB1 "SmsParam".


Figure 4-4
© Siemens AG 2019 All rights reserved

7. Assign values to all parameters necessary for sending/receiving


(see Chapter 3.1.4 / Chapter 3.2.4):
– ipAddress
– interfaceId
– remotePort
– username
– password
– telNo
– smsText
Figure 4-5

8. Save and compile the global data block DB1 "SmsParam".

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 28
4 Working with the Library

9. In the "Program blocks" folder of your device, open the OB1 organization
block.
10. Use drag and drop to move the "LSmsSR_SndSms" or "LSmsSR_RcvSms"
function block to any network.
11. Enter the name of the instance data block. Generate the instance data block if
it does not exist.
Figure 4-6

Note:
Set within the properties of the Instance-DB the option "Non Retain ".
"Object Properties> General Part2> Non Retain"
12. Assign values to all necessary parameters. Use values from the global data
block DB1 "SmsParam".
© Siemens AG 2019 All rights reserved

Figure 4-7

13. Save the OB1 "organization block" and load the STEP 7 Project.

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 29
4 Working with the Library

4.3 Updating the "LSmsSR" library


The following guide shows you
• how to check whether the library is up to date and
• how to integrate a newer version of the "LSmsSR" library into your
• STEP 7 project.

1. Open "SIMATIC Manager" and compare the current version number of each
element of the library with the latest version from the Industry Online Support
portal.
2. In the Project tree, right-click the blocks of the library. In the context menu,
select the "Object properties" option.
3. In the "Properties" window that is displayed, select the "General – Part 2"
menu.
Figure 4-8
© Siemens AG 2019 All rights reserved

4. If you want to update the library, integrate the latest library as described in
Chapter 4.2.
5. Delete all relevant elements in the "Blocks" folder.
6. Do not delete the function block call in OB1.
7. Add the new elements of the library as described in Chapter 4.2, Steps 1
through 3.
8. In the Project tree, right-click the blocks of the library
Update the elements of the project
"Blocks > Check Block Consistency".
Figure 4-9

9. The library update is now complete.

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 30
5 Appendix

5 Appendix
5.1 Service and support
Industry Online Support
Do you have any questions or need assistance?
Siemens Industry Online Support offers round the clock access to our entire
service and support know-how and portfolio.
The Industry Online Support is the central address for information about our
products, solutions and services.
Product information, manuals, downloads, FAQs, application examples and videos
– all information is accessible with just a few mouse clicks:
support.industry.siemens.com

Technical Support
The Technical Support of Siemens Industry provides you fast and competent
support regarding all technical queries with numerous tailor-made offers
– ranging from basic support to individual support contracts. Please send queries
to Technical Support via Web form:
www.siemens.com/industry/supportrequest
© Siemens AG 2019 All rights reserved

SITRAIN – Training for Industry


We support you with our globally available training courses for industry with
practical experience, innovative learning methods and a concept that’s tailored to
the customer’s specific needs.
For more information on our offered trainings and courses, as well as their
locations and dates, refer to our web page:
www.siemens.com/sitrain

Service offer
Our range of services includes the following:
• Plant data services
• Spare parts services
• Repair services
• On-site and maintenance services
• Retrofitting and modernization services
• Service programs and contracts
You can find detailed information on our range of services in the service catalog
web page:
support.industry.siemens.com/cs/sc

Industry Online Support app


You will receive optimum support wherever you are with the "Siemens Industry
Online Support" app. The app is available for Apple iOS, Android and Windows
Phone:
support.industry.siemens.com/cs/ww/en/sc/2067

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 31
5 Appendix

5.2 Links and literature


Table 5-1
No. Topic
\1\ Siemens Industry Online Support
https://support.industry.siemens.com
\2\ Link to this entry page of this application example
https://support.industry.siemens.com/cs/ww/en/view/54361177
\3\ SIMATIC NET: Industrial Remote Communication Remote Networks SCALANCE
M-800 Web Based Management
https://support.industry.siemens.com/cs/ww/en/view/109751635
\4\ Which "local_device_id" do you parameterize in order to establish a connection with
FB65 "TCON" for Open User Communication (OUC) via Industrial Ethernet?
https://support.industry.siemens.com/cs/ww/en/view/51339682

5.3 Change documentation


Table 5-2
Version Date Modifications
© Siemens AG 2019 All rights reserved

V1.0 10/2019 First version

Wireless Signaling and Switching with SCALANCE M874/ M876


Entry-ID: 54361177, V1.0, 10/2019 32

You might also like