hardy004:

If I had to guess, looking at your data, I'm guessing that it's 7 bits, even parity. So the characters with an odd number of bits (a, k) are coming through looking fine, and the ones with an even number of bits (c) parity are coming in with the high bit set. Setting the high bit on 'c' gives 0xe3, and I'm betting some unicode translation is occurring to give you the gibberish where the 'c' should be.

I'd try dumping the individual bytes you get for $saw to see the actual bytes Device::SerialPort is giving you. You can also just try changing the parity and word size to see if it fixes things up for you.

Note: It's been a good few years since I had to deal with parity & such, so I may have even/odd mixed up in my head, so I'd suggest setting data bits to 7 and try both and see if one works the way you expect.

...roboticus

When your only tool is a hammer, all problems look like your thumb.


In reply to Re: Using Device::SerialPort by roboticus
in thread Using Device::SerialPort by hardy004

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.