Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Win32::SerialPort v. New computers

by BrowserUk (Patriarch)
on Oct 31, 2011 at 00:32 UTC ( [id://934794]=note: print w/replies, xml ) Need Help??


in reply to Win32::SerialPort v. New computers

Maybe the pdf from here will give you enough information.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Win32::SerialPort v. New computers
by hennesse (Beadle) on Nov 02, 2011 at 01:29 UTC

    BrowserUK, Marshall, and afoken,

    Thank you for your suggestions. I'm hoping to market my Perl->RS232->RS485 application, and that means fitting in a variety of real-world situations -including computers that don't have serial ports (imagine that!) There are several options for the RS-485 conversion, and I need to find the "best" option

    USB to RS-232 converter
    Most desirable. Most people will be using an older PC for this "semi-dedicated" application, so my program will run as is. For a new computer without a serial port, there would be no changes to my program - assuming the converter includes software that allows it to be addressed as COM1.
    Of course, in a few years, "older" PCs won't have serial ports either. So I'm gonna have to learn USB sooner or later...
    USB to RS-485 converter
    Middle desirable. If the converter comes with a "COM1 option", it rivals the first choice. Otherwise, it means rewriting my software for USB. I have no idea what that would entail, but I suspect that it would be painful - and device manufacturer-dependent.
    RS-485 PC card
    Least desirable. The target market are techie-hobbyists, but not necessarily computer techies. They're not going to want to take apart their computers.

    You've pointed me in the right direction. Now I have to do my homework... As GrandFather suggested, I will eventually be doing some TITS. But the less "shelfware" I have to purchase, the better.

    Thanks - Dave

      For this sort of application you are never going to have to "learn USB" in order to drive a serial port. The driver stack for the USB device isolates you from having to know anything about the USB layer - you simply use the usual OS provided API for the device. In the current case, so long as you are using the Windows provided serial API (which, as far as I know Win32::SerialPort does), it really doesn't matter if you use a serial port provided on the computer's mother board, or on an ISA card, or by a PCMCIA card or as a USB/serial dongle. The hard wired COM1 constrain however will cause you grief real quick!

      Using the module which (I presume) uses the Windows serial API allows any of the three options you've suggested without any code changes aside from configuration issues such as the COM port used.

      True laziness is hard work

        Some USB-to-RS232 adapters (Logilink, perhaps others) come with a litte tool that allows setting the COM port number from the Windows-assigned number (typically >4) to lower numbers (down to COM1).

        COM1 to COM9 should be no problem for most software that uses the Windows API, COM10 and higher need some obscure syntax to specify the COM port (\\.\COM10, according to http://support.microsoft.com/kb/115831).

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

        GrandFather,

        I feel soooo stupid. I happened to already have one of these in my "shelfware" box, but I didn't realize it.

        About a year ago, I ordered an RS-232->RS-485 converter from Omega Engineering and they sent me a USB->RS-232 converter by mistake. I offered to send the wrong one back, and they said "Aww, just toss it", so I tossed it in my shelfware box, and then totally forgot about it.

        Subsequent to my posting, I started thinking "What was that wrong thing?", and dug through the shelfware box. Sure 'enuf...

        Works as advertised - running the device's "Install" program makes it becomes a COM port, and Win32::SerialPort talks to it just fine.

        NOTES:

        The device becomes a different COM ports on different computers (e.g. COM6, COM11).

        This particular imported no-name USB->RS-232 device was based on the Prolific (a Taiwanese company) PL-2303 chips, as I suspect many commercially available models are. Use the install software that comes with the device - NOT a generic driver from Prolific. Make sure the device says it supports Windows 7 if that's what you're going to use it on. I installed it successfully on one XP computer using the device manufacurer's software. When I tried in on another XP computer using Prolific's generic sofware from their website - it failed miserably. Reboot after installing -even if it doesn't tell you to do so.

        Sorry to bother everone with this question,

        Dave

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-20 00:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found