rkrasowski has asked for the wisdom of the Perl Monks concerning the following question:
When I try to emulate satellite modem and sent OK response to my program it is still not recognized. When I change line until ($rx =~ m/OK/); to until ($rx =~ m/O/);("OK" changed to just one character "O" )it is recognized with no trouble. Any idea what is the problem?? Thanks in advance Robert OK, it looks like the issue was with Hyperterminal on win XP that I used aas emulator. I swich to Linux and used perl script as emulator and things are moving as expected. Thanks like always, Robert#!/usr/bin/perl use strict; use warnings; use Device::SerialPort; my $PORT = "/dev/ttyUSB0"; my $serialData; my $tx; my $rx; my $ob = Device::SerialPort->new($PORT) || die "Can't Open $PORT: $!"; $ob->baudrate(115200) || die "failed setting baudrate"; $ob->parity("none") || die "failed setting parity"; $ob->databits(8) || die "failed setting databits"; $ob->handshake("none") || die "failed setting handshake"; $ob->write_settings || die "no settings"; $| = 1; $tx = $ob->write("AT&K0\n"); do { $rx = $ob->read(255); chomp $rx; print $rx; } until ($rx =~ m/OK/); print "OK received\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Serial port - again
by RichardK (Parson) on Mar 15, 2013 at 17:20 UTC |