How do you program for data exchange between two CPU modules and for transmitting a message (SMS) from a CPU via a TS adapter?
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.
|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:
Two applications are programmed in this sample program with the FB47 "AS_DIAL" call in the OB1:
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:
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
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.
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".