slloyd has asked for the wisdom of the Perl Monks concerning the following question:
Update: I found this link on M$ site that explains the problem but I am not sure if the SerialPort module needs to be fixed to support it or if there is a work-around.
WorkAround: The work-around is to pass in the port name as "\\.\COMXX" where XX is the number. This works for me anyway.
Results:#!perl use strict; use Win32::SerialPort; my $port=shift || "COM9"; print "Connecting to $port .... "; our $PortObj = new Win32::SerialPort($port); unless(ref $PortObj){ print "Unable to connect to $port\n"; exit; } print "Connected!\n"; print "Press <ENTER> to disconnect"; my $cmd=<STDIN>; $PortObj->close(); exit(0);
C:\Automation>test.pl COM9 Connecting to COM9 .... Connected! Press <ENTER> to disconnect C:\Automation>test.pl COM10 Connecting to COM10 .... The system cannot find the file specified. can't open device: COM10 at C:\Automation\test.pl line 7 Unable to connect to COM10 C:\Automation>test.pl \\.\COM10 Connecting to \\.\COM10 .... Connected! Press <ENTER> to disconnect
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Connecting to Serial Ports greater than COM9 on win32
by Anonymous Monk on Dec 08, 2017 at 06:13 UTC |