Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: parse data from serial port

by boftx (Chaplain)
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.


Comment on Re: parse data from serial port
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2014-09-21 04:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (166 votes), past polls