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 FEOver 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:
#! C:\perl\bin\perl.exe use strict; use warnings; use Win32::SerialPort; my $port_name = 'COM4'; my $config_file = 'thermo.cfg'; my $port = new Win32::SerialPort($port_name, $config_file) || die "Una +ble to open: $^E\n"; my $status = pack('HHHHHH', 'ca', '00', '01', '00', '00', 'fe'); $port->write($status."\n"); sleep 1; my $result = $port->input; print "result = $result\n"; $port->close || warn "Close Failed!\n"; undef $port;
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 00I'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!
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |