ccherri has asked for the wisdom of the Perl Monks concerning the following question:
The device accepts only data in a hex format....
for instance, I can send (using RealTerm 'Send Numbers' button): 0xc9
the device will respond with hex 'F401' which results in it not being processed at all by the receiving application (perl, hyperterm, etc). RealTerm will show the F401 response if I set the display settings to hex, but Perl does not register any response at all. If I send 0xC9 as ascii, the device cannot correct interpret all the ascii values of 0xC9 and all the prefix and suffix that goes with it.
So, I have two problems
1. How to limit the perl output to the port to be strictly the hex values I specify (not the ascii representation of the hex values)?
2. How to get perl to process back into my script the hex response?
any help at all is much appreciated. I am new this year to perl and so far am having a great time with it.
Cheers UPDATE: I think I am on to something...instead of
$pass=$PortOb->write($text);
I tried
$pass=$PortOb->transmit_char(0xc9);
and it sends only and exactly c9
now to find 'read_char'...but if there are other tips, happy to hear them, and thanks for the quick suggestions!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: serial port hex only
by Marshall (Canon) on Apr 26, 2012 at 21:59 UTC | |
|
Re: serial port hex only
by ww (Archbishop) on Apr 26, 2012 at 21:01 UTC | |
by ccherri (Acolyte) on Apr 26, 2012 at 21:37 UTC | |
by Argel (Prior) on Apr 26, 2012 at 22:04 UTC | |
by Marshall (Canon) on Apr 27, 2012 at 00:05 UTC | |
by Argel (Prior) on Apr 27, 2012 at 19:34 UTC | |
|
Re: serial port hex only
by zentara (Cardinal) on Apr 27, 2012 at 10:20 UTC | |
by ccherri (Acolyte) on Apr 27, 2012 at 18:17 UTC |