June 20, 2006 10:25
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
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