4.0

4.0 | 3 ratings Rate this file 79 downloads (last 30 days) File Size: 1.52 KB File ID: #15010

Article: Using MATLAB with External Hardware (Garmin GPS example)

by The Instrument Control Team

 

15 May 2007 (Updated 21 May 2007)

No BSD License  

Configuring and controlling external hardware with MATLAB

Download Now | Watch this File

File Information
Description

This MATLAB example shows you how to configure and control external hardware in MATLAB. Specifically, we show how to use MATLAB to communicate with a Garmin handheld Global Positioning System (GPS) receiver with an RS-232 serial interface.

MATLAB supports serial devices including RS-232 using the Instrument Control Toolbox. In the article, we describe how to use a graphical user interface called TMTool to locate, configure, and control the hardware without writing MATLAB script. We also show how to create drivers to incorporate lower level commands.
 
This MATLAB example is featured and explained in the May 2007 MATLAB Digest article called "Configuring and Controlling External Hardware in MATLAB" authored by Trent Jarvi of The MathWorks. This article is available at:
http://www.mathworks.com/company/newsletters/digest/2007/may/matlab_hardware.html

Learn more about using MATLAB with a wide array of external hardware such as serial devices and instruments at the following page:
http://www.mathworks.com/products/instrument/supportedio.html

Required Products Instrument Control Toolbox
MATLAB release MATLAB 7.4 (R2007a)
Zip File Content  
Other Files nmeareceiver.mdd,
MATLAB_GPS_example.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
01 Jun 2007 siti sendari

i want to learn it

01 Jun 2007 ramon vazquez  
07 Jun 2007 Oleg Zariasnki

The good job.
I have made the same script, but using differen NMEA word and obtain information about time and velocity too.
The codes modifies strings looks like:
data='';
while isempty(strmatch('$GPRMC',data))
data = fscanf(obj1);
end
ii=findstr(data,',');
UTC=data(ii(1)+1:ii(2)-1);
Time=str2num(UTC(1:2))*3600;
Time=Time+str2num(UTC(3:4))*60;
Time=Time+str2num(UTC(5:end));
...
Latitude=data(ii(3)+1:ii(4)-1);
Lat=str2num(Latitude(1:2));
Lat=Lat+str2num(Latitude(3:end))/60;
NS=data(ii(4)+1:ii(5)-1);
if (NS == 'S')|(NS == 's')
Lat=-Lat;
end
Longitude=data(ii(5)+1:ii(6)-1);
Long=str2num(Longitude(1:3));
Long=Long+str2num(Longitude(4:end))/60;
EW=data(ii(6)+1:ii(7)-1);
if (EW == 'W')|(EW == 'w')
Long=360-Long;
end
...
And so one.
For displaying there is enough to show simply Latitude and Longitude with N or S, E or W, but to calculation better transfer coordinates.
The same is with time.
I know, that my code is not optimal, but it reads only required information.
  

18 Dec 2007 Kevin Alley

Is there a simulink equivalent for reading and parsing NMEA strings from a Garmin or other GPS unit?

05 Mar 2009 Syed Noman  
18 Jun 2009 Florentino Ruiz

y como harĂ­a para que este adquiriendo las lecturas en tiempo real, es decir, que siempre me este dando los datos en cualquier momento??????

Please login to add a comment or rating.
Updates
17 May 2007

- Updated description and download material.

21 May 2007

- Updated description to provide link to article.

Tag Activity for this File
Tag Applied By Date/Time
example The Instrument Control Team 22 Oct 2008 09:12:54
application The Instrument Control Team 22 Oct 2008 09:12:54
matlab serial gps hardware example garmin The Instrument Control Team 22 Oct 2008 09:12:54
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com