Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

O monks,
I have a serial device (a scrolling led sign to be precise) which I can send text to. It also has a buffer, which I can read the current length of. Both of these things I have managed to do in windows and freeBSD using (respectively) Win32::SerialPort and Dev::SerialPort.

I am trying to work out how to change the output (which should be the number of bytes in the buffer) into a readable form that I can test things against; From my windows monitoring it seems that the device is returning hex in the form:

00 3e
00 23
00 0c

I know this output to be the number of bytes in the buffer, however, when I capture it with $PortObject->read, and try to print it out I get unicode characters. I've tried using hex() and ord() but both convert all output to 0.

How can I convert my hex into decimal?

In reply to how to convert data from a serial port read... by tachekent

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2022-10-04 06:41 GMT
Find Nodes?
    Voting Booth?
    My preferred way to holiday/vacation is:

    Results (15 votes). Check out past polls.