03-17-2010 06:21 AM
Solution is probably very simple, but by searching the forums and using the LabView help I haven't solved my problem yet. I have a pH meter connected to serial port and I need to read the pH value and temperature. The string that the connected meter puts out is usually "18.03.11 12:47 pH 6.238 26.1 øC
Tauto". Everything works fine when I use Scan From String function and put the right initial scan location, but sometimes the string does change a little and the pH and temperature values are not in the exact same location and it gives "Scan failed. The input string does not contain data in the expected format" error. So I would like to know if I can use another function to aquire the data or what format string to use so it would pick up the the value right after letters pH or right before øC.
03-17-2010 08:04 AM - edited 03-17-2010 08:08 AM
Take a look at the string in /-code display and see if there is a termination character. This can be set in the serial init (or via properties)
In the received string search for "pH.*C" and if found use the scan string function.
Your scan string might be like "%.:pH/s%f/s%f/s"
I ignored the date because it's in the future 😉
EDIT: ARRGH how do I disable the smily??? so with a extra space " % . : p H .... the "%.:" will fix situations where the decimal seperator is set to , via OP. 😛 😛 😄
04-09-2010 03:40 PM
Hi
I have a similar problem, my read strings look like this:
pH 6.493 pH 21.0 deg C 760 mmHg 3234 AGC 1694 RAGC 02/29/2008 03:55:22
How can i scan just the pH (ie the 6.493) from my read string?
Is there a resource for string formatting that I can look at?
Thanks for your help,
Tatiana
04-09-2010
05:09 PM
- last edited on
05-01-2025
03:43 PM
by
Content Cleaner
The LabVIEW Help on Scan From String contains a link for the various format strings that you can use. For your example you could do something like this: