03-29-2012 01:51 PM
I am a bit of a newbie to Labview and trying to figure out how to read a serial port and
then extract, parse and display the data in labview.
I have a serial device that outputs a string of data that is comma delimited.
I would like to take this data and read it into a labview application and then parse the data
so that I can turn on an indicator or load a string on a labview front panel to display the contents of status
of the data read and parsed.
Is this best done by placing the data read into an array or is there an easier/ more efficient way to parse this
data and display it?
I have set up the serial fort with the measurement and automation utility and can read the data being output from the
serial devise but I am not sure how to take that operation and put it into a VI... Is there a way to import this or does it have to be manully set up?
Any helpful suggestions are greatly appreciated.
thanks
03-29-2012 07:07 PM
I'd read the entire response string and then do a parsing of the comma-separated string after.
03-30-2012 07:29 AM
Thanks-
Unfortunately I am still not able to read my serial device with labview even though I can read it with
the MAX utility. Here is the string of data that is comma delimited that I want to parse and set certain controls
based on the individual numbers:
1,1,1,1,1,1,1,0,1023,5.03,1023,0,0,0\r\n
Also, I have included a copy of my LV code below in case anyone can tell me what I am doign wrong and why
I can't read this data from my device's serial port.
thanks
03-30-2012 07:45 AM
OK, I see that i used a serial port initialize instead of a visa open, but how do I associate the
visa name of my device to the VISA Open on my block diagram?
03-30-2012 08:21 AM
Usually a VISA resource will be detected automatically. Use the dropdown arrow on the control.
03-30-2012 08:30 AM
Thanks-
I got it going, just need to figure out how to parse the string into bits for certain controls.
03-30-2012 08:59 AM
Strip the carraige return line feed and use FOR loop to remove commas to get an array.
03-30-2012 09:33 AM
The Spreadsheet String to Array function will do the trick.