06-07-2010 02:16 PM
I am using serial port for data acqusition with labview.
serial port is sending a string of decimal numbers like
203,200,210,230
now i want to split these strings. I have used ther termination character , (Comma) in Visa configure serial port vi
But now i want the Visa Read to split these number so that i will give them to 4 meters.
For example 203 to first meter, 200 to second meter,210 to 3rd and 230 to 4th meter
Solved! Go to Solution.
06-07-2010 02:18 PM
the vi snap
06-07-2010 03:03 PM - edited 06-07-2010 03:05 PM
Hi number,
well, it's a colorful front panel. What should we do with that picture???
Use a SpreadsheetStringToArray function with "," as separator to transform your string into an array of numbers. Then use IndexArray to index the individual numbers from the array:
06-07-2010 04:20 PM - edited 06-07-2010 04:21 PM
444444 wrote:
I have used ther termination character , (Comma) in Visa configure serial port vi
If you did this then the VISA Read will return only one number at a time since it will stop once it sees a comma.
But now i want the Visa Read to split these number so that i will give them to 4 meters.For example 203 to first meter, 200 to second meter,210 to 3rd and 230 to 4th meter
VISA Read is not used to split anything. You would need to do that with the string returned by VISA Read. However, since you set the termination character to a comma, then that means you're only going to be reading one number at a time. This means you'd need to perform call VISA Read 4 times to get the 4 numbers. I would think that you'd want to use a different termination character so you read the whole 4 numbers. Do you get a linefeed or a carriage return character at the end of the string of 4 numbers? If so, that's what you should use as the termination character. Then you can use the Spreadsheet String to Array as Gerd shows, or you can use the Scan From String function.