×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 25000624, Entry date: 03/26/2007
(0)
Rate

How do you program for data exchange between two CPU modules and for transmitting a message (SMS) from a CPU via a TS adapter?

  • Entry
  • Associated product(s)

Instructions:
The table below uses STEP 7 programs to show examples of

  • how to exchange data between two CPU 300/400 modules with a modem connection or an ISDN connection
  • and of how to send an SMS (e-mail) with a TS adapter on a CPU 300/400 and a GSM modem.

Note on program transfer:
The sample programs may only be transferred if the relevant CPU module is in "STOP" status. The programs use communication resources and could hang if you conduct the transfer in "RUN-P". If you don't use the default address 0 for the local TS adapter, the address has to be modified in the program.
 

No. Examples:
1 Data exchange between CPU modules via Teleservice
In order to establish the connection you require two TS adapters (version 5.1 or higher), two modems or ISDN adapters. Furthermore, you require Teleservice V6 and STEP 7 V5.4 software or higher. A modem and ISDN cannot be combined in Teleservice.

In this sample program actions are activated by positive edges to the inputs of the local CPU. The following two parameters have to be modified on your own plant:

  • DB1.DB_PHONE_NO: Entering the phone number of your remote CPU.
  • OB1, network 2, parameter: ADDR_CPU: Entering the MPI address of your remote CPU.

Two applications are programmed in this sample program with the FB47 "AS_DIAL" call in the OB1:

  1. Transmission of the values from the I/O range
    The status of the first 8 digital inputs on the remote CPU is displayed on the first 8 outputs of the local CPU. Handling:
  • Switch off all inputs (set them to 0)
  • E0.0 =1 (this establishes the Teleservice connection between the two TS adapters)
  • E0.0 =0
  • E0.3 =1 (EB0 on the remote CPU is read and output to AB0 on the local CPU)
  • E0.3 =0
  • E0.4 =1 (this ends the Teleservice connection between the two TS adapters)
  • E0.4 =0 (all the inputs are now off again)
  1. Transmission of the values of a data block
    Three "ABC" bytes from the local CPU are transmitted to the remote CPU and back again to an empty area on the local CPU. For the purposes of the test, the DB2 must be present in the remote CPU before the program starts. Handling:
  • E0.0 =1 (this establishes the Teleservice connection between the two TS adapters)
  • E0.0 =0
  • E0.1 =1 (the first three bytes in DB2 on the local CPU (bytes 0 to 2) are transmitted to the first three bytes in DB2 on the remote CPU)
  • E0.1 =0
  • E0.2 =1 (three bytes from the remote CPU are read and written to DB2 (bytes 3 to 5) of the local CPU)
  • E0.2 =0
  • E0.4 =1 (the Teleservice connection between the two TS adapters is ended)
  • E0.4 =0 (all the inputs are now off again)

The two applications can also be combined by switching all the inputs (E0.0 to E0.4) one after another. The following file "En_FB47.zip" contains the STEP 7 project with the program described above:

En_FB47.zip ( 44 KB )

2 Transmitting a message (SMS) from a CPU via the TS adapter
For this application you require Teleservice V6 and STEP 7 V5.4 software or higher, and the TS adapter must be V5.2 or higher. The GSM modem must be equipped with a SIM card, and the following two parameters have to be modified on your own plant:
  • DB1.Phone_No.: Number of the mobile phone to which the SMS is to be sent.
  • DB1.Service_No.: SMS service number of the network operator of the SIM card in the GSM modem (a D1 number is saved in the example).

Note:
The mobile phone number is only saved in numerical format, e.g. 01601234, and the SMS service number be prefixed with a "+" symbol, e.g. +491710760000, if your network operator is Telecom (D1 network).

An additional AT command, which transmits the PIN number of the SIM card in the GSM modem, must be stored in the TS adapter. The entire AT command for the PIN number 4711 is

  • AT+CPIN="4711";AT&FE1L1M1Q0V1&C1S0=1.

You have to enter your PIN number instead of the number 4711. You can also find further information in the manual in Entry ID 15220172.

In the sample program FB48 "SMS_SEND" is called in the OB1, triggering the transmission of an SMS through a positive edge at input E0.0 on the CPU. The example transmits the text, which is saved in parameter "DB1.Message", as an SMS to the mobile phone, entered in the parameter "DB1.Phone_No.", via your SMS network operator.

The following file "En_FB48.zip" contains the STEP 7 project with the program described above.

En_FB48.zip ( 44 KB )

Copy the relevant ZIP file into a separate folder on your hard disk and then run the file by double-clicking it. The STEP 7 project is now unpacked with all the associated subdirectories. You can use the SIMATIC Manager to open and process the extracted project.

Note:
The two new TS Adapter IE versions (6ES7972-0ED00-0XA0 and 6ES7972-0EM00-0XA0) only support communication via Ethernet on the output side towards the S7 CPU. The TeleService function block FB48 "SMS_SEND" can only be used via the MPI interface, because FB48 "SMS_SEND" calls SFC65 "X_SEND" internally. This is an SFC for S7 Communication of the non-configured connections. These SFCs can only be used via the MPI interface of an S7 CPU. The same applies of course also for the TeleService FB47 "AS_DIAL".

Keywords:
Teleconnection, Teleservicing

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
https://www.siemens.com/cybersecurity#Ouraspiration.