You were correct, when parity is altered it's enough to write it without saving it into conf file.

I'm still working on my RS232 script, I've downgraded it removing the GUI part to avoid messing with non-blocking (which I can include later when basic problems are solved).

On another laptop I have program Termite where the auto-reply is set for 303132 (hex) and the respond is 33 (hex). When my script sends 303132 (hex) Termite should respond with 33 (hex) in its GUI.

$ob->write("\x30\x31\x32"); while(1){ $gotit=$ob->lookfor(); if ($gotit) { print "RX> ".$gotit."\n"; if($gotit eq "\x33"){ print "\t(a)\t".$gotit." eq \\x33\n"; } if($gotit eq "33"){ print "\t(b)\t".$gotit." eq 33\n"; } if($gotit eq "3"){ print "\t(c)\t".$gotit." qe 3\n"; } $nnn=hex($gotit); if($nnn eq "3"){ print "\t(d)\t".$gotit." eq hex(\$gotit)\n"; } if($gotit == 3){ print "\t(e)\t".$gotit." == 3\n"; } } $ob->lookclear; # needed to prevent blocking sleep (0.2); }

When I start my script Termite writes receives the code sent from my script and sends back code 33 (hex):

30 31 32 012 33 3

Unfortunatelly my script doesn't receive the code 33 (hex) sent by Termite.

If I send 33 manually from Termite it writes 33 0a and my script responds as:

RX> 3 (a) 3 eq \x33 (c) 3 qe 3 (d) 3 eq hex($gotit) (e) 3 == 3

The Airlogger (sniffer) shows the following:

[RX]123 [TX]3

Polling in Termite is set to 200ms and the sleep in my script is set to 200ms as well. I set different polling in both Termite and my script and it doesn't solve anything.

I have no idea why code 33 (hex) (or any code sent, 33 is just for an example) sent from Termite is not recognized.

Thanks in advance for your help!


In reply to Re: RS232, parity, program flow by MarSkv267
in thread RS232, parity, program flow by MarSkv267

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, details, 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, summary, 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.