Re: win32 serial port
- From: mwhipple@xxxxxxxxxxxxxx (Matthew Whipple)
- Date: Wed, 26 Sep 2007 14:14:32 -0400
You are using 2 constructors that may be stepping on each others toes.
Opening the port with new may lock the port from being tied later. What
is in the $configfile, since it appears as though most of the
configuration is done in the script (although that configuration would
probably be undone by the loading of the file)? I'd say drop the tie
constructor for now and use write_method to ensure that you have proper
access to the port.
Saran.j.jegan@xxxxxxxxx wrote:
Hello , am using win32::serialport module to communicate with my
serial port device, this is my code
use Win32::SerialPort;
my $serial_port;
my $return;
my $quiet = 1;
$serial_port = Win32::SerialPort->new ($port,1) die "Can't open serial
port $port: $^E\n" unless ($serial_port);
my $configFile= 'ER400TRS.conf';
print LOG "configuration file: $configFile\n";
print "$configFile";
my $baud = $serial_port->baudrate(4800);
my $par = $serial_port->parity("even");
my $rint=$serial_port->read_interval;
my $data=$serial_port->databits(7);
my $stop=$serial_port->stopbits(1);
my $hshake=$serial_port->handshake;
my $rconst=$serial_port->read_const_time(100);
my $rchar=$serial_port->read_char_time(5);
my $wconst=$serial_port->write_const_time(100);
my $wchar=$serial_port->write_char_time(5);
my ($rbuf, $wbuf)= $serial_port->buffers;
$serial_port = tie (*FOO, 'Win32::SerialPort', $configFile)
|| die "Can't tie: $^E\n"; ## TIEHANDLE ##
$serial_port->close || die "\n close problem with $port\n";
undef $serial_port;
the code works fine i can write my data to the buffer but when am try
to use file handle to tie with config file
am getting the error access denied can't tie....can any suggest me ?
.
- References:
- win32 serial port
- From: Saran j jegan
- win32 serial port
- Prev by Date: Re: win32 serial port
- Next by Date: Re: How to set a COM Object property to TRUE
- Previous by thread: Re: win32 serial port
- Next by thread: Displaying a Link on A Web PAge with image/png header.
- Index(es):
Relevant Pages
|