Sample program 2

Sample program 2 1: Download

Reading and interpreting time telegrams

This example shows a way to process and interpret the most diverse serial time protocols in the PLC. To this end, IEC61131-PLC blocks will be presented that interpret the bit stream arriving at the PLC and, if necessary, extract the time/place information. This information can be used, for example, to synchronize controllers or record movements.

In this example, it is assumed that the data is delivered via a 22-byte interface by a Beckhoff EL/KL60xx serial data exchange terminal.

Background information

Not only in maritime applications is time and place information transported via serial buses: In the majority of cases an existing source distributes its information to lower level listeners/listeners cyclically or after a trigger via RS232 / RS485, USB or Ethernet.
A very large number of telegram formats exists worldwide for the distribution of time and place information; these are also known as ‘sentences’. Such a telegram consists of n bytes of data and is characterized by:

The most diverse organizations and companies have developed open or proprietary formats for specific purposes of use. Therefore, two sample implementations will be presented in this example that can easily be adapted to other specific protocols. The telegram formats in the example are the Meinberg Standard and NMEA0183 v2.3 type RMC.

Sources of information

GPS or radio controlled clock gateways are used as data transmitters in the serial sector. These devices receive the respective time signal (GPS via satellite or radio controlled clock via long wave) and convert it to the serial, wire-bound transmission e.g. RS232 with 8N1. The gateway often contains a local clock source in order to be able to continue distributing reliable time information for a certain time in the event of a short-term failure of the reference signal (GPS, radio transmitter). In Central Europe, the German DCF77 transmitter can be used.
If necessary, further information from the reference signal can be used:

Synchronization of lower level time slaves

In general, lower level slaves should be adjusted to the time gateway, i.e. they should synchronize their time. The following are necessary for this:

If the serial telegram from the gateway is placed cyclically to the bus, the time of the first bit can often be interpreted as a PPS signal. In the block in this example, this information would be lost; only the absolute time information is evaluated.

Time formats

Time telegrams conforming to the NMEA0183 standard are widespread. Please note:

Furthermore, many proprietary formats exist, such as Meinberg Standard, Siemens SINEC H1 and SAT 1703, or military formats, such as the IRIG codes (USA).

Using the sample program

The PLC project contains 2 function blocks (FBs), which must be linked exclusively with an EL/KL600x. Then collect the received bytes from the terminal and interpret the contents as far as possible. The FBs cover:

For other time formats, you can create your own interpretation FBs on the basis of a known telegram structure; contact your device manufacturer regarding this.

Hardware used in the example: EK1100 and EL6001 (also EL600x, KL600x)
The FB to be tested must be linked with its process data to the terminal in the System Manager (22-byte process image and control/status word).
The NMEA block is linked in the example. The baud rate of the terminal must be set to match your transmitter.

References