Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: parse data from serial port

by boftx (Deacon)
on Oct 15, 2013 at 05:36 UTC ( #1058238=note: print w/replies, xml ) Need Help??

in reply to parse data from serial port

Many, many moons ago (early 90s)I had reason to collect data from a PBX system that was sent out over an RS232 connection. I found that I had to read a line at a time instead of a fixed block in order to get reasonable data chunks to work with. It looks like you have a similar situation to that.

I haven't had a chance to grok Device::SerialPort yet, but I would suspect it has some kind of input function that is similar to readln that would be suitable.

Assuming that is the case, then it should be relatively simple to bring in a line at a time for parsing/storing and then processing the collected data whenever the closing "Checksum" entry is detected. Doing a split /\s+/ might come in handy for that. (I tend to be partial to dispatch tables for working with record types.)

The answer to the question "Can we do this?" is always an emphatic "Yes!" Just give me enough time and money.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2016-10-21 02:09 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (284 votes). Check out past polls.