Firstly, apologies if this question has been answered anywhere else already- I searched for all the keywords I could think of and haven't found anything.
I'm trying to get my Arduino to push data to my computer (running a fairly standard Windows XP Pro) which will be interpreted by a Perl script. I chose Perl because I'm familiar with it, it's easy and my host script is using SendKeys. However, try as I might I can't get the Win32::SerialPort module to work. PPM denies all knowledge of it, and the most credible looking installer (that is ten years old) claims to be a windows port, but has a Makefile that looks for /dev/tty and tries to run "./configure"- understandably my XP box doesn't quite know what to make of that.
I'm guessing that at least someone here has tried to use the serial port with Perl under Windows- how do you get Perl to access the serial port? If I'm fighting a losing battle even trying to use Perl then I'll cut my losses and switch to Java or something, but I want to make sure Perl isn't going to work first.
The Win32::SerialPort module seems to be in another repository other than activestate. Per an Experts-Exchange article it can be found here: Index of /perl/ppm as Win32-SerialPort.ppd
You should be able to use basic file I/0 for reading and writing once the port is set up for speed, start/stopbits and parity.
Ah- I guessed there must be some way to add repos. Thanks for the tip, I'll check it out tomorrow when it's not 1am. Would the command I want be something like
? This could maybe do with being stickied somewhere, the Perl example code in the Playground is for linux only and assumed you've already set up the serial code.
You should see Win32-SerialPort in the listing. Install with the i command followed by the package name. Spelling correct and make sure you follow the capitalization in the listing. As an example below.
ppm-> i Win32-SerialPort
My main dev is a Linux box following a full out brawl and fistfight between Kaspersky Antivirus and Cisco VPN Client. Prior to the cage fight I had been using Activestate Perl under Windows XP. I just followed the above directions on the Windows machine, and checked the documentation which now shows the SerialPort module documentation page.
You will probably still have some issues with serial port under windows since Microsoft never imagined you would have more than 9 serial ports.
Ports 10 and Higher will not respond to being called "COMx". You need to use the following naming method: "\.\COM10", for example.
Here is what I put at the top of my perl script;
# COM PORT
my $myPort = 11;
# Deal with ports higher than 9
if($myPort < 10){
$myPort_Str = "COM".$myPort;
print "low port: $myPort_Str\n";
} else {
$myPort_Str = "\\\\.\\COM".$myPort;
print "high port: $myPort_Str\n";
}
So when I open the port, I use:
my $port = Win32::SerialPort->new($myPort_Str);
This way, you can use higher number ports that would by defualt have the system saying, "sorry, port doesn't exist" . With the FTDI devices you will very likely have the FTDI/USB drivers assign ports in the higher range.