Hi all,
I am relative perl newby, and am trying to use perl to program a PSU through a serial port.
I can't get any communication (either transmitting or recieving to the serial port):
Simple code (should work?):
#!perl
use Win32::SerialPort;
use vars qw($portob);
$portob = new Win32::SerialPort ("COM2") || die "Can't start \n";
$portob->databits(8);
$portob->baudrate(2400);
$portob->parity('none');
$portob->stopbits(1);
$portob->handshake('dtr');
$portob->write('4B 4F 45 0D'); #HEX
$portob->write('K0E\r'); #ASCII
print "end";
exit
I've installed (more than once) Serialport.pm and Commport.pm from CPAN.
NOTE: I know that the connection is working becuase both the simple exe program which came with the instrument works and the downloadable (demo version) program (exe) RS232 HEX COM Tool works fine.
I don't get any warnings, it just runs and finishes and nothing happens at on the PSU(?)
Any tips would be appreciated.
A
I am relative perl newby, and am trying to use perl to program a PSU through a serial port.
I can't get any communication (either transmitting or recieving to the serial port):
Simple code (should work?):
#!perl
use Win32::SerialPort;
use vars qw($portob);
$portob = new Win32::SerialPort ("COM2") || die "Can't start \n";
$portob->databits(8);
$portob->baudrate(2400);
$portob->parity('none');
$portob->stopbits(1);
$portob->handshake('dtr');
$portob->write('4B 4F 45 0D'); #HEX
$portob->write('K0E\r'); #ASCII
print "end";
exit
I've installed (more than once) Serialport.pm and Commport.pm from CPAN.
NOTE: I know that the connection is working becuase both the simple exe program which came with the instrument works and the downloadable (demo version) program (exe) RS232 HEX COM Tool works fine.
I don't get any warnings, it just runs and finishes and nothing happens at on the PSU(?)
Any tips would be appreciated.
A