LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

parsing string from serial device

Hello, I am reading a data string from an instrument over the serial port every x seconds. The problem I am having is that the output of the instrument is not always the same, so I don't know what character to look for in my parsing vi. Anybody have any ideas? I am using the bytes at serial port vi and the serial port read vi in a while loop (along with a wait until next ms multiple).
0 Kudos
Message 1 of 5
(2,757 Views)
If you know that there are X number of possible outputs you could possibly do a compare of what is coming off of the port and doing a case statement based on the pattern. This way you could have several cases.
0 Kudos
Message 2 of 5
(2,757 Views)
Serial instruments usually respond with a specified format. You need this information in order to parse the data. The format could be that numbers are 8 characters long or a specific character. (Remember, you can use the string functions.) You can experiment to find a way to parse the data on your own but looking in the manual would be the best place to get the information.

You might be able to find an instrument driver on our web site and circumvent the whole issue. http://www.ni.com/devzone/idnet/

Jeremy Braden
National Instruments
0 Kudos
Message 3 of 5
(2,757 Views)
What type of device are you talking to? If we could have a little for in the way of details we might be able to give you more concrete answers--and maybe even some code.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 5
(2,757 Views)
Thanks for your responses. The serial device is a pH meter from Thermo Orion (model EA 940). I am not sure what other details to give. It is an older instrument, and when I'm reading its output from the serial port, it doesn't always return a nice pattern that I can search for.
0 Kudos
Message 5 of 5
(2,756 Views)