There are a lot of assumptions (on my behalf) inferred from the information you have given us.

14 bytes sounds like the default FIFO buffer size for COMn: ports (under win32 anyway).

That you get the first 14 bytes and no more suggests that some form of handshaking is involved. That it isn't being reset automatically means that it (the comm port) is probably set up for software (Xon/Xoff) handshaking.

If you are on a win32 system, the easiest way to verify this would be to open a CMD window and issue the command:

C:\test>mode com1 /STATUS Status for device COM1: ----------------------- Baud: 1200 Parity: Even Data Bits: 7 Stop Bits: 1 Timeout: OFF XON/XOFF: OFF CTS handshaking: OFF DSR handshaking: OFF DSR sensitivity: OFF DTR circuit: ON RTS circuit: ON C:\test>

That was from the (currently inactive) com1 on my NT system.

If you are simply reading from the port and want to 'slurp' as much as possible, you could use the control-panel->ports (or the mode command (see help mode) to switch the handshaking off.

This isn't going to help much if the device attached to the other end needs the hadshaking though. If the device is waiting for you to empty the buffer, and has recieved an Xoff (ascii 14?) ... it will be waiting for an Xon (ascii 15?). Maybe just writing the appropriate one will restart the flow. There is probably a module that will take care of this nastiness for you on CPAN.

Of course, if your not using win32, ignore me and wait for one of the "real programmers" to supply similar info for *nix systems:)


In reply to Re: Reading data from the Serial Port by BrowserUk
in thread Reading data from the Serial Port by Anonymous Monk

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.