Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: RS232, parity, program flow

by MarSkv267 (Novice)
on Jan 21, 2022 at 13:49 UTC ( [id://11140679]=note: print w/replies, xml ) Need Help??


in reply to RS232, parity, program flow

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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11140679]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-04-24 20:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found