Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hi guys, I know, the answer is probably easy, but I can not get this to work. I am trying to communicate with satellite modem using serial port. I am sendng command to the modem and wait for "OK" response, for some rason "OK" is not recognized ( it is printed in terminal window just fine). Here is a code:
#!/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";
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

In reply to Serial port - again by rkrasowski

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (6)
    As of 2018-01-19 02:44 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      How did you see in the new year?










      Results (215 votes). Check out past polls.

      Notices?