NMEA over UDP Setup Guide
Introduction
This guide demonstrates usage of NMEAOnUDP to send and receive a GPS position telegram over the ethernet with CDP Studio, the independent automation software for open PC-based real-time distributed control systems.
Setting up a Test-system
First we set up a System that the component can be tested in:
Create a system named NMEATest with a Console application named NMEATestApp, then select Configure mode. See How to Create a system for more information.
Adding an NMEAOnUDP Component
- Select the NMEATestApp that resides under NMEATest in the Project tree
- Select the NMEA0183IO in the Resource tree
- Right-click on NMEAOnUDP and select Add
- Double-click the newly added NMEAOnUDP in the Block Diagram to navigate into it
- Double-click the NetworkTransport to navigate into it
- Set ListenPort to 5000
- Set RemoteIP to 127.0.0.1
- Set RemotePort to 5000
Sending NMEA Strings
Building up NMEA strings to send is done by creating a sequential list of signals and strings. These signals and strings correspond to the values in the NMEA string that are separated by commas. To send '$GPGLL,62.470000,N,6.145380,E':
- Select NMEAOnUDP in the Project tree
- Expand NMEA0183IO in the Resource tree and double-click SendData to add it to the selected component
- Double-click the Send node that was added to navigate into it
- Change SendData Header to '$GPGLL' to emulate the example above
- From the Resource tree, double-click Signal<double> to add it to the data to send
- Rename the added Signal in the CDPChannel table to 'Latitude'
- Set the Value to 62.470000
- From the Resource tree, Add a String and rename it to 'NorthSouth'
- Set the Value to 'N'
- Add a Signal<double> and rename it to 'Longitude'
- Set the Value to 6.145380
- Add a String and rename it to 'EastWest'
- Set the Value to 'E'
- The configuration should now look something like this:
Receiving NMEA Strings
Receiving NMEA strings is just as simple as sending them. Create a sequential list of signals and strings. The signals and strings correspond to the values in the NMEA string that are bounded by commas. To replicate the example above ($GPGLL,62.470000,N,6.145380,E*61):
- Make sure that the NMEAOnUDP component is selected in the Project tree, and that the IOConfig table is visible
- Double-click ReceiveData in the NMEA0183IO resource in the Resource tree to add it
- Double-click the newly added Receive to navigate into it
- Select Header. Change it to '$GPGLL' to emulate the example above
- In the NMEA0183 in the Resource tree, right-click and Add a Signal<double>
- Rename the newly added signal to 'Latitude'
- Add a String, rename it to 'NorthSouth'
- Add a Signal<double>, rename it to 'Longitude'
- Add a String and rename it to 'EastWest'
Note:
- The names given above are examples only . Make sure to use expressive names so it is simple to configure the system. For instance, SendData above could be renamed to SendGPSPos and ReceiveData could be renamed to GPSPos
- The Signals have Precision and Specifier that can be set to force number of decimals and number type used
How to Run the Tutorial
To run the tutorial from CDP Studio, select Configure mode, right-click on the system project and select Run & Connect. See the Running and Connecting to the System tutorial for more information.
Verify That It Works
- Click into NMEATest.NMEATestApp.NMEAOnUDP.ReceiveData
- Observe that the values sent out match the ones that are received
- Go into NMEATest.NMEATestApp.NMEAOnUDP.SendData
- Change Latitude to 62.470597
- Change Longitude to 6.210851
- Click into NMEATest.NMEATestApp.NMEAOnUDP.ReceiveData
- Observe that the received values have changed
- Stop the system by Right-clicking the NMEATest in the Project tree and clicking Stop
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.