|Welcome to the Monastery|
Sending and reading hex commands on a Win32 serial portby c4onastick (Friar)
|on Jan 25, 2008 at 23:02 UTC||Need Help??|
c4onastick has asked for the
wisdom of the Perl Monks concerning the following question:
Greeting fellow monks!
I have been trying to write a bit of perl to talk to a piece of equipment at work. I'm fortunate enough that the manufacturer has thouroughly documented the protocol to issue commands and talk to the instrument. I believe I've narrowed the problem to the mysterious pack function.
I'd like to send the hex:CA 00 01 00 00 FE
Over the serial port (pretty sure I've got the serial port working, thanks to Win32::SerialPort). I'm actually using a little USB to serial converter that comes with a nice little monitor utility that can show the hex dump of what goes over the port. Here's the code I've come up with so far:
The script executes fine with no results to speak of, but the port monitor sees:00009 8 (351.485.411): TX: C0 00 00 00 F0 00
I've been through the limited amount of examples and tutorials that I could find on Win32::SerialPort but to no avail. I loved process control in college and would love to learn how to control process equipment with perl! (Who needs LabVIEW? is where I'd like to be able to go with it.)
Any insights would be greatly appreciated. Thanks!