serial port hex onlyby ccherri (Acolyte)
|on Apr 26, 2012 at 20:41 UTC||Need Help??|
ccherri has asked for the
wisdom of the Perl Monks concerning the following question:
I am trying to interface to a device that accepts serial data signals, but the OS in the device only responds to very limited inputs and all the prefix and suffix stuff that goes with a typical serial port configuration is screwing it up.
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
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!