Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

read data from serial port into an array

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

0 Kudos
Message 1 of 8
(6,361 Views)

I'd read the entire response string and then do a parsing of the comma-separated string after.

 

 

0 Kudos
Message 2 of 8
(6,346 Views)

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

0 Kudos
Message 3 of 8
(6,338 Views)

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?

 

0 Kudos
Message 4 of 8
(6,334 Views)

Usually a VISA resource will be detected automatically. Use the dropdown arrow on the control.

0 Kudos
Message 5 of 8
(6,331 Views)

Thanks-

 

I got it going, just need to figure out how to parse the string into bits for certain controls.

 

0 Kudos
Message 6 of 8
(6,329 Views)

Strip the carraige return line feed and use FOR loop to remove commas to get an array.

0 Kudos
Message 7 of 8
(6,326 Views)

The Spreadsheet String to Array function will do the trick.

0 Kudos
Message 8 of 8
(6,321 Views)