DescriptionWith the block in the library, you can use a GPS receiver to read out the time stamp and date of GPS messages. You can use this data to compensate the time drift of the real-time clock (RTC) of your S7-200.
In the attached sample PLC application, the minutes and seconds of the real-time clock are synchronized with the time stamp of the GPS message. Restricting time synchronization to minutes and seconds has the following advantages:
In the attached sample PLC application, the minutes and seconds of the real-time clock are synchronized with the time stamp of the GPS message. Restricting time synchronization to minutes and seconds has the following advantages:
- It can be applied worldwide, independently of time zones.
- It can be applied independently of summer/winter time.
Time synchronization is done between xx.20 and xx.40 after the synchronization command.
Fig. 01
CommunicationThe GPS receiver receives GPS messages in compliance with the NMEA standard and sends these as ASCII character strings to the S7-200 basic module. The time stamp and date are read out of them in each case. The S7-200 uses the freely programmable communication mode (Freeport) via the RS485 connection ( Port '0' or Port '1') for communication with the GPS receiver. The library uses the RMC protocol of those available in the NMEA standard.
Transfer format
The transfer format used for GPS messages in compliance with the NMEA standard requires the following interface parameters:
The transfer format used for GPS messages in compliance with the NMEA standard requires the following interface parameters:
- 4800 baud
- 8 data bits
- No parity
- 1 stop bit
The resulting interface parameter to be entered at the "GPS_NMEA_TIME_UTC" block is 2#1101 (see description under "Library: Read out time stamp and date").
RequirementsThe library and the sample PLC application can be used
- With a GPS receiver with serial interface that supports the NMEA standard and which is connected to the S7-200 basic module via an RS232 PC/PPI cable.
- With an RS232 PC/PPI cable
No. | Remarks | ||||||||||||||||||||||||||||||||||||||||||||||||||||
1 | Use the GPS receiverConnect the GPS receiver to the RS485 connection of your S7-200 basic module via an RS232 PC/PPI cable. Set the DIP switches of the PC/PPI cable as in Fig. 02. Fig. 02 Additional informationThe RS485 connection does not provide any power supply for your GPS receiver. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
2 | Add libraryStore the attached "gps_time_read_port0.zip" or "gps_time_read_port1.zip" file on your computer. Unpack the file and add the library to your configuration software STEP 7 Micro/WIN.Additional information Instructions for adding libraries are available in Entry ID 16689345. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
3 | Add GPS block From the "GPS_TIME_READ_PORT0" or GPS_TIME_READ_PORT1" library you drag-and-drop the "GPS_NMEA_TIME_UTC" block into a cyclically called network. Fig. 03 Assign an unused memory area to the library. Additional information
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
4 | Connect the GPS blockAssign the contacts of the block. The variables used in Fig. 04 are examples. Via the "Freeport_Config" contact you configure the freely programmable communication. The parameter "2#1101" results for the NMEA transfer format used (see "Transfer format"). Fig. 04 Additional informationAdditional information on configuring the freely programmable communication is available in the S7-200 manual, section 7.5 "Creating user-defined protocols in the freely-programmable communication". | ||||||||||||||||||||||||||||||||||||||||||||||||||||
5 | Use the GPS blockYou start the GPS evaluation with a positive edge at the 'Start' input. You can tell how well the evaluation is from the contacts 'DONE', 'ABORTED' and 'GPS_status'.The table lists the contacts of the block and tips for usage.
|
Sample application: Synchronize the timeThe sample application uses the functions of the "gps_time_read_port0.mwl" or "gps_time_read_port1.mwl" library. You can use the sample application without incorporating the library.
No. | Remarks | ||||||||||||||||||||||||||||||||||||
1 | Use the GPS receiverConnect the GPS receiver to the RS485 connection of your S7-200 basic module via an RS232 PC/PPI cable. Set the DIP switches of the PC/PPI cable as in Fig. 05. Fig. 05 Additional informationThe RS485 connection does not provide any power supply for your GPS receiver. | ||||||||||||||||||||||||||||||||||||
2 | Open the sample applicationStore the attached "gps_time_read_port0.zip" or "gps_time_read_port1.zip" file on your computer. Unpack the file and add open it using your configuration software STEP 7 Micro/WIN. | ||||||||||||||||||||||||||||||||||||
3 | Use the sample applicationYou start the sample application with a positive edge at the 'Start' input of the "GPS_SYNC" block. For this you set the variable V541.0 to 'high' using the variable table. The sample application remains active until synchronization has been done after the time window has been reached. You can tell the status of the evaluation from the contacts 'DONE', 'ABORTED', 'GPS_rcvd_warning' and 'sync_not_in_window'. Fig. 06 The sample application cyclically reads the time stamp of the GPS message received. The minutes and seconds are synchronized automatically in the time window between xx.20 and xx.40. The table lists the contacts of the block and tips for usage.
|
Table 02
PasswordThe password for the library is "1234" (without the quotation marks).
Download
Description | Download |
Library for reading out the GPS time via Port '0' | gps_time_read_port0.zip ( 3 KB ) |
Library for reading out the GPS time via Port '1' | gps_time_read_port1.zip ( 5 KB ) |
Sample application for synchronizing the RTC via Port '0' | gps_time_sync_port0.zip ( 9 KB ) |
Sample application for synchronizing the RTC via Port '1' | gps_time_sync_port1.zip ( 9 KB ) |
0 comments :
Post a Comment