Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations pierreick on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Splitting Data

Status
Not open for further replies.

chath259

Aerospace
Oct 11, 2006
9
Hi,

I'm having trouble splitting up data that I am receiving through a COM port. The data I am receiving is a mix between two different GPS readings and a telemetry reading. Right now the data comes through a timer control that takes whatever is in the receive buffer and writes to a text file every twenty milliseconds. Each string in the text file may contain any combination of the three types of data received. I want each type of data to be its own string, distinguishable from the other two. Any help would be very much appreciated.

-Thanks

P.S. Each data type is preceded by its own specific character (i.e. GPS - $ or B and ARTS (Telemetry) - A)
 
Replies continue below

Recommended for you

Perhaps Regular Expressions can be of use here. First and foremost, however, there needs to be some deterministic method of categorizing the three types of data. How can you tell, by looking at the data, which is of what type?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
I'm sure there are much simpler ways to be doing this but this is my first time programming with the serial port. I thought about using the OnComm event for each time something gets sent to the receive buffer but I'm not sure what I should use...comEvReceive or comEvEOF. If someone could explain these in a bit more detail, that would be helpful.

The thing is is that the telemetry data gets sent at a higher rate (50 Hz) than the GPS, and the data can be in variable length strings. And by using the timer control this may split up strings of one type of data into different lines

Telemetry gets sent in ASCII, and each string starts with an A.
GPS either starts with $GP...and a string of numbers/letters/commas
or
GPS starts with a B and then a string of characters.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor