evergood Posted February 21, 2007 Report Share Posted February 21, 2007 Hello I'm receiveing data form a linux pc over RS-232 about 12 times in 10 seconds. See RS-232_com_v1.vi (picture below) This data is coming out as a string. I'm going to use this data for "realtime" graphic and alarm monitoring. I want them presented as an array, for use in an already excisting program. My recived data looks like |2007-02-20 10:30:30 { 00.0260.043 { 10.0260.045 { 20.0260.044 ... Look her for a sample of a file: Data The Time and Date is not important at the moment. The first colums is the Channel the data is coming from, the second colums is a RMS value and the third colums is a Peak value. Want the array to be 3x16=48 rows big, so its will be easy to pick out the data. Would like the data in a form like this!! Quote Link to comment
Mikkel Posted February 21, 2007 Report Share Posted February 21, 2007 Fist off, I think you need to do some modifications to your loop. For a start you could move the initialization of the serial port outside the loop, and look into using a termination char, so you read data line by line in stead of reading all the bytes present in the serial input buffer. Once you have taken care of this, parsing of the data should be a lot easier. -Mikkel Quote Link to comment
evergood Posted February 27, 2007 Author Report Share Posted February 27, 2007 Thanks, will do. Quote Link to comment
TG Posted February 28, 2007 Report Share Posted February 28, 2007 QUOTE(evergood @ Feb 26 2007, 09:11 AM) Thanks, will do. Here is a tip Put that puppy in a shift register (while loop) and use the match string function with the period '.' delimeter to parse out the values then auto index em out as an array. Attach the comparison operator <0 to the index output of the match string function to tell the loop to stop parsing. This is the essense of parsing strings. Unfortunately I don't have an example. Quote Link to comment
Mikkel Posted February 28, 2007 Report Share Posted February 28, 2007 QUOTE(John Rouse @ Feb 27 2007, 06:35 PM) Here is a tipPut that puppy in a shift register (while loop) and use the match string function with the period '.' delimeter to parse out the values then auto index em out as an array. Attach the comparison operator <0 to the index output of the match string function to tell the loop to stop parsing. This is the essense of parsing strings. Unfortunately I don't have an example. I think I would prefer using the 'Scan from String' function with format string "{ %d.%d.%d" - but it's a matter of taste... -Mikkel Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.