Connect to a GPS receiver connected to host computer
The gpsdev
System object™ connects to a GPS receiver connected to the host computer.
To connect to a GPS receiver:
Create the gpsdev
object and set its properties.
Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?.
connects to a GPS Receiver at the specified serial port of host computer. gpsObj
= gpsdev(port
)
connects to a GPS Receiver specified by a serial object.gpsObj
= gpsdev(serialobj
)
connects to a GPS Receiver on the specified port or specified through a serial object,
using one or more name-value pairs. gpsObj
= gpsdev(port
,___,Name,Value)
To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named obj
, use
this syntax:
release(obj)
flush | Flush all GPS data accumulated in the buffers and reset properties |
info | Read Update Rate, GPS Lock information and number of satellites in View for the GPS receiver |
read | Read data from GPS receiver |
release | Release the GPS object |
writeBytes | Write raw commands to the GPS receiver |
Connect to a GPS receiver connected to a specific port.
gpsObj = gpsdev('COM4')
gpsObj = gpsdev with properties: SerialPort: COM4 BaudRate: 9600 (bits/s) SamplesPerRead: 1 ReadMode: 'latest' SamplesRead: 0
s = serialport('COM4',9600);
gpsObj = gpsdev(s)
gpsObj = gpsdev with properties: SerialPort: COM4 BaudRate: 9600 (bits/s) SamplesPerRead: 1 ReadMode: 'latest' SamplesRead: 0
gpsObj = gpsdev('COM4','SamplesPerRead',2,'ReadMode','oldest');
gpsObj = gpsdev with properties: SerialPort: COM4 BaudRate: 9600 (bits/s) SamplesPerRead: 2 ReadMode: 'oldest' SamplesRead: 0 SamplesAvailable: 0