Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

talking to serial in w2k + latest activestate

by tachekent (Acolyte)
on Jan 08, 2002 at 22:23 UTC ( [id://137209]=perlquestion: print w/replies, xml ) Need Help??

tachekent has asked for the wisdom of the Perl Monks concerning the following question:

I've been trying to talk to a scrolling LED display via the serial port using WIN32::SerialPort with varying degrees of success. Problem is I can't quite tell why/when/what.

first I tried:

use Win32::SerialPort qw( :STAT 0.19 ); my $PortObj = new Win32::SerialPort ("COM1") || die "Can't open COM1: +$^E\n"; $PortObj->baudrate(9600); $PortObj->parity("none"); $PortObj->databits(8); $PortObj->stopbits(1); $PortObj->write ("feed me"); $PortObj->close || die; undef $PortObj;
which worked once or twice.
then I omitted setting any params which worked fine for a whole evening, now nothing works.

SerialPort seems to pick up the settings on its own with little trouble, and a light comes on on the device whenever I try and talk to it, it's just failing to write.

any thoughts?

Replies are listed 'Best First'.
Re: talking to serial in w2k + latest activestate
by talexb (Chancellor) on Jan 08, 2002 at 22:53 UTC
    I can highly recommend renting a protocol analyzer to go between your computer and the sign you're working on. Something like an HP 4951A from ElectroRent (that's who I'd call in Toronto anyway) will tell you without fail what's passing from your PC to the sign.

    Alternatively, you can do something clever like wrap your serial communications module in something that logs the input and output streams in real time (or maybe Win32::SerialPort has a trace feature that can be turned on). You need to be able to see the character data as well as the control lines, RTS, CTS, DTR and DSR (if they're being used -- you might be using ON/XOFF instead).

    Once you can gurantee what's going on between the PC and the sign, then you can proceed to debugging your Perl code.

    Yes, I have spent some time slaving over a hot protocol analyzer doing data communications work. :)

    --t. alex

    "Excellent. Release the hounds." -- Monty Burns.

      Thanks, unfortunately need it tonight as the device ships tomorrow(sic).However, I fixed it by making a new serialport object and cribbing a config file from the test program that came with the ppm.

      I realised that it was only working after I had run that particular test.
      Every time I thought "Hey it works", it was immediately after running the test program then going back to my original file incomprehensibly.

      So, I guess I'm a litle bit the wiser now...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://137209]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-03-29 06:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found