How Can We Help?


Subroutine and how to connect to a RS232 GPS/GNSS module to a ACE PLC

This tutorial and subroutine provide all the information needed to connect an RS232 GPS module to an ACE PLC.


How Does GPS Work?

All GPS (which stands for Global Positioning System) units work in the same basic way. The GPS network is made up of 24 satellites that orbit the earth in precise, predefined trajectories while broadcasting radio signals that contain data about the satellite’s precise location. Each satellite’s orbit and accompanying radio signal is unique.

GPS receivers are configured to:

  • Accept the incoming signals from the various satellites.
  • Compare the location data and its transmission time.
  • Use this information to triangulate the receiver’s precise location.

The GPS device needs at least three signals to determine its position in two-dimensional space and at least four signals to determine its location in three-dimensional space. Depending on location, time of day, and the presence or absence of structures that may block the signal, we can expect a receiver to track as many as eight satellites at any given moment.

How to Connect RS232 GPS Module to ACE PLC

Simply connect the RS232 TX signal to RX, and RX to TX, then the GND signal.

What RS232 GPS modul send via its RS232 TX port?

There are over 30 different NMEA frames. Each frame has its own syntax.

A GPS receiver often returns several additional frame types (GGA and RMC are an example) because not all software that interprets NMEA knows about all frames.

Also many GPS receivers transmit non-standardised frames specific to their manufacturer (usually these proprietary frames do not start with $GP. For example, “GL” reserved for GLONASS).

Here we will in the subroutine decode the RMC frame.

The subroutines for ACE PLC with RS232 port

You have to check the speed of the GPS RS232 port. 9600 bds ?

You can download and try the subroutines here

You will find 3 subroutines:

  • SearchCharInStri.viofs
    • Which search the character “,” for separate each data
  • ASCII2Number.viofs
    • For convert a ASCII code to a number
  • GPSNMEA0183.viofs
    • Extract all data from the GPS data trame