MacSailing.net

Full Version: MAC program to read NMEA data
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The following can be used to read the NMEA sentance (all of them) that come down the wire - it read 1000, displays them, and write them to a file.

use Device::SerialPort;
$port="/dev/cu.KeySerial1";
$ob= Device::SerialPort -> new ($port);
$ob-> baudrate(4800);
$ob-> parity("none");
$ob-> databits( 8 );
$ob-> handshake("none");
$ob->write_settings;

unlink "data.txt";
open (INPUT, "/dev/cu.KeySerial1");
open (OUTPUT, "> data.txt");

$time = localtime(time ());
print "Start Reading NMEA Data ".$time."\n";

$w=0;
while ($w < 1000){
$text=readline INPUT;
print $text;
print OUTPUT $text."\t\n";
$w=$w+1;
}

If you do not have Device::SerialPort on you MAC, you can download it from
www.DarwinPorts.org
Thanks. For those not programatically inclined you can download GPSUtility and just copy and paste the NMEA output in the monitor window.

http://www.versiontracker.com/dyn/moreinfo/macosx/24559