Win32::SerialPort is about as easy as it is possible to be. Try uing the tie interface. With this, you simply tie a filehandle to the serial port the device is attached to, COM1: COM2: etc., and then just print to it and read (<device>) from it using the standard perl io operators.

The example shown under the heading "Methods used with Tied FileHandles" in the pod, pretty much tells you all you need to know with regard to reading and writing. The only other part to understand is configuring the port to the appropriate baud rate, parity, start & stop bits, handshaking etc. but you would need to do this whatever language or comms library you used. Try typing help MODE for a little information on what can/needs to be configured, though the pod with the module seems pretty comprehesive.

As a simple first pass at getting things configured correctly, you can just use the comand line MODE COM1 BAUD=9600 etc to configure it, and the COPY CON COM1 to send and copy COM1 CON to retrieve responses. Once you get that to work, writing the program using WIn32::SerialPort should be pretty easy.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
Hooray!
Wanted!


In reply to Re: *extremely* simple Serial I/O by BrowserUk
in thread *extremely* simple Serial I/O by wa4otj

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.