Académique Documents
Professionnel Documents
Culture Documents
receiver to determine
the coordinates and
synchronize the
system time of the S7-
1200, S7-1500 and ET
200SP CPU?
Siemens
CM 1241 RS232, CM PtP RS232, CM PtP Industry
Online
https://support.industry.siemens.com/cs/ww/en/view/45057335 Support
This entry originates from Siemens Industry Online Support. The conditions of use
specified there apply (www.siemens.com/nutzungsbedingungen).
Security Siemens provides products and solutions with industrial security functions that support the
Informati secure operation of plants, systems, machines and networks.
on 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 only form one element of such a
concept.
Customers are responsible to prevent unauthorized access to their plants, systems,
machines and networks. Systems, machines and components should only be connected
to the enterprise network or the internet if and to the extent necessary and with
appropriate security measures (e.g. use of firewalls and network segmentation) in place.
Additionally, Siemens’ guidance on appropriate security measures should be taken into
account. For more information about industrial security, please visit
http://www.siemens.com/industrialsecurity.
Siemens’ products and solutions undergo continuous development to make them more
secure. Siemens strongly recommends to apply product updates as soon as available and
to always use the latest product versions. Use of product versions that are no longer
supported, and failure to apply latest updates may increase the customer’s exposure to
cyber threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security
RSS Feed under http://www.siemens.com/industrialsecurity.
Contents
Siemens AG 2017 All rights reserved
1 Description ..................................................................................................... 3
1.1 Download .......................................................................................... 3
1.2 GPS Receiver.................................................................................... 4
1.2.1 GPS Message ................................................................................... 4
1.2.2 Communication Parameters............................................................... 4
1.3 Hardware Setup................................................................................. 5
1.3.1 Connect RS232 (connector) to CM PtP (ET 200SP) ........................... 5
1.3.2 Hardware Configuration ..................................................................... 6
1.4 Handling the Library........................................................................... 6
1.5 Function Block "GpsReceive"............................................................. 8
1.5.1 Inputs ................................................................................................ 8
1.5.2 Output Variables ................................................................................ 9
1.6 Creation Environment ........................................................................ 9
1 Description
The SIMATIC controllers S7-1200, S7-1500 and ET 200SP can process standard
GPS frames of the RMC data type according to the NMEA-0183 standard. The
GPS receiver captures GPS frames via the RS232 interface of the communication
modules CM1241 RS232, CM PtP RS232 or CM PtP.
The function blocks in the attached library provide the degrees of longitude and
latitude of your current position. In addition, the current UTC time and date in the
"DTL" data type format are output and the system time of the CPU is synchronized.
The function block "GpsReceive" uses the communication instructions "PtP
Communication" V2.3:
Table 1-1
Name Description Version
Port_Config Configure the PtP communication port V1.2
Receive_Config Configure the PtP receiver V1.2
Receive_P2P Receive data V1.5
Receive_Reset Delete receive buffer V1.2
Note More information about the "Point-to-Point" instructions is available in the STEP
7 Professional V14.0 manual.
Siemens AG 2017 All rights reserved
1.1 Download
The download consists of the block library and a sample project. Copy each zip file
into a separate folder. Double-click each zip file to open it and unpack it.
After unpacking the library, follow the steps in Table 1-6. You can then use STEP 7
V14.0 Upd2 to open and process the extracted project.
Table 1-2
Contents Description
45057335_S7-1x00_GPS_LIB_V12d0.zip Library
For CM 1241 RS232 >= V2.1,
FB " GpsReceive" V1.0
S7-1500 and ET 200SP CPU
FB " gps_rcv" V12.0 For CM 1241 RS232 < V2.1
45057335_S7-1x00_GPS_PROJ_V12d0.zip Sample project
S7-1200 with CM 1241 RS232 >=
PLC_1
V2.1
PLC_2 S7-1500 with CM PtP RS232 BA
PLC_3 ET 200SP CPU with CM PtP
PLC_4 S7-1200 with CM 1241 RS232 < V2.1
decimal form
"E" for East or
Direction
"W" for West
Velocity - not evaluated in the block
Course
- used in connection with the UTC time
Date "ddmmyy"
for synchronization
Deviation - not evaluated in the block
Signs
only available for NMEA 0183 version
Signal integrity
V2.3
Checksum "*hh" End of the data record
The individual blocks of information are separated by commas (",").
Figure 1-1
S7-1500
ET 200SP
S7-1200
Siemens AG 2017 All rights reserved
RS232 GPS
L+ M
Figure 1-2
TXD Transmit Data
1 3
RXD Receive Data
2 2
3 RTS Request To Send
7
CTS Clear To Send
4 8
DTR Data Terminal Ready
5 4
DSR Data Set Ready
6 6
DCD Data Carrier Detect
7 1
RI Ring Indicator
8 9
PE Ground
9 5
The following example shows the hardware configuration using the S7-1200 as an
example. Proceed correspondingly for the hardware configuration of the S7-1500
and ET 200SP.
Table 1-5
No Instruction
.
1. Connect the GPS receiver to the S7-1200.
Proceed as follows:
1. Equip the S7-1200 with a CM 1241 RS232 communication module.
2. Connect the GPS receiver to the communication module.
Note:
The power supply of your GPS receiver must be from the external power source required in the
description (voltage level and polarity).
2. Add the communication module to the "Device Configuration".
Proceed as follows:
1. Open the project navigation in STEP 7 (TIA Portal).
2. Open the "Device Configuration" of your CPU.
3. Open the "Device View".
4. Open the "Hardware Catalog".
Siemens AG 2017 All rights reserved
1 3 4
2 7
Table 1-6
No Instruction
.
1. Proceed as follows to download and open the global library "GPS":
1. Load, unpack and open the global library "45057335_GPS_LIB_V12d0.zip".
2. Click the "Open global library" button to open the library.
5 6
Siemens AG 2017 All rights reserved
1.5.1 Inputs
The following table shows the inputs of the GpsReceive function block.
Table 1-7
Connection Data type Remark
cmd_get_ BOOLEAN The evaluation of an RMC-GPS message is triggered by a rising edge.
time_n_date In the sample program, clock marker bits trigger the rising edge.
1. Mark your controller in the "Project Navigation".
2. Right-click to open the "Properties".
3. Select the "System and clock memory" item.
4. Check the option box to enable use of the clock marker byte.
5. Enter an address for the clock marker byte. In this example the
address of the 0.5 Hz marker bit is M0.7.
Siemens AG 2017 All rights reserved
4
1 5
2
6
cmd_hw_id PORT Here, you enter the hardware ID of the communication module.
You can find the hardware identifier in the "System Constants" under "PLC
tags > Show all tags".
1 3
Table 1-8
Variable Data type Remark
Siemens AG 2017 All rights reserved
Latitude_Real Real This variable includes the current latitude position in decimal form
(32-bit floating-point number). Can only be evaluated in
conjunction with "return_done".
Latitude_LReal LReal This variable includes the current latitude position in decimal form
(64-bit floating-point number). Can only be evaluated in
conjunction with "return_done".
Longitude_Real Real This variable includes the current longitude position in decimal
form (32-bit floating-point number). Can only be evaluated in
conjunction with "return_done".
Longitude_LReal LReal This variable includes the current longitude position in decimal
form (64-bit floating-point number). Can only be evaluated in
conjunction with "return_done".
return_done BOOLEAN This variable is set to "true" in the cycle in which the GPS frame is
successfully received and the CPU system time is successfully
updated.
return_aborted BOOLEAN This variable is set to "true" in the cycle in which reception of the
GPS frame or the time and date synchronization has failed.
gps_time_n_date DTL This variable includes the current UTC time with date received
with GPS. With "return_done" = "true" the CPU system time is
synchronized with this time.