ppm install Win32::SerialPoint ppm install Win32::API #### use strict; my $deckbox = "/dev/ttyUSB0"; open(DECK, "+<$deckbox") || die('Couldn\'t open GPS'); system("stty -F $deckbox 19200"); while (my $line = ) { print $line; print DECK "\$CCPDT,1,4,0,0,3000,1,0,0,0\r\n"; } #### stty -a -F /dev/ttyUSB0 speed 19200 baud; rows 0; columns 0; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ; eol2 = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke #### require 5.003; use Win32::SerialPort qw( :STAT 0.19 ); use strict; my $line; my $deck = openSerial("com3:", 19200, 'none', 8, 1); # $deck->handshake("xon"); # $deck->buffers(4096,4096); do { my $bytesWritten = $deck->write('$CCPDT,1,4,0,0,3000,1,0,0,0' . "\r\n"); $line = rawReadSerial($deck); } while (1); sub readLineSerial { my ($ser) = @_; my ($numChars, $c); my $line = ''; do { do { ($numChars, $c) = $ser->read(1); } while ($numChars < 1); $line .= $c; } while ($c ne "\n"); return $line; } sub rawReadSerial { my ($ser) = @_; my ($numChars, $c); my $line = ''; do { do { ($numChars, $c) = $ser->read(1); #print "$numChars read=$c\n"; } while ($numChars < 1); print $c; $line .= $c; } while ($c ne "\n"); return $line; }