07-04-2018 01:54 AM
07-04-2018 01:31 AM
Hi,
I am doing a reading from 5 sensors (dissolved oxygen, electrical conductivity, pH, Light Intensity and temperature). I am receiving the readings on my serial read program in labview in runtime. I have 2 problems.
1) When i split the readings coming as text into floating point, it just indicates once and does not overwrite the new reading being sent every 250ms.
2) The display order of the measurements from the sensor gets changed every time i run the program, e.g; the dissolved oxygen reading gets displayed as output 1 and the next time as output 4 etc.
My program is attached. Please help me in this issue.
Thanks
Solved! Go to Solution.
07-04-2018 02:39 AM
Hi sr,
1) When i split the readings coming as text into floating point, it just indicates once and does not overwrite the new reading being sent every 250ms.
Where do you "split" readings? You only parse the concatenated received string!
Main problem here: you collect the received strings in a feedback node, but always try to parse that concatened string from the beginning…
2) The display order of the measurements from the sensor gets changed every time i run the program, e.g; the dissolved oxygen reading gets displayed as output 1 and the next time as output 4 etc.
That's a problem with the formatting of your received string!
There should be a unique marker in the received string to be able to differentiate between your 5 different values, like "A:x.xxx B:x.xxx C:x.xxx Dx.xxx E:x.xxx". There also should be a unique separator (aka "delimiter") char between those 5 values, so you could the SpreadsheetStringToArray function.
07-04-2018 03:09 AM
Hi GerdW
Thanks a lot for response, i have put A before my first reading, and B , C ,D, E before the other 4. I am trying to delimit the string by A but im still getting all those other readings as well. i really appreciate your help sir, im new to labview, please support,
07-04-2018 03:13 AM
Hi sr,
i have put A before my first reading, and B , C ,D, E before the other 4.
Please provide an example of a typical received string!
Best would be to have a string indicator in your VI with a "good" received string set as default…
I am trying to delimit the string by A but im still getting all those other readings as well.
It doesn't make sense to set "A" as delimiter when it is NOT the delimiter char…
im new to labview, please support,
Did you notice those beginner learning resources offered for free in the header of this LabVIEW board?
07-04-2018 03:18 AM
hi
please check the attached image for the received string
07-04-2018 03:37 AM
Hi sr,
oh boy…
Why do you put a linefeed (LF, or CR, or both) between your values? Why not use a space or tab char and only ONE linefeed after the E value?
(Can you switch your string indicator to "\-code" display mode and show the resulting display?)
Right now your delimiter is a LF, that's why you need to concatenate strings in your receiver loop. You need to get the string subset from the first "A" character before the next "A", then parse your 5 values…
07-04-2018 03:40 AM
Hi sir
This is my resulting display
07-04-2018 03:50 AM
Why do you put a linefeed (LF, or CR, or both) between your values? Why not use a space or tab char and only ONE linefeed after the E value?
This is because the measurements are coming from another device in this manner.
07-04-2018 05:51 AM
Hi sr,
you can "split" the string at each "\r\n" delimiter: use SpreadsheetStringToArray with a LF as delimiter.
Now you can convert each separated string element to numeric. When an error occurs while conversion you have a found a letter, use it to put the next numeric value in the right place!
Remove already converted string subsets from your concatenated string to avoid conversion of the very same values again and again…
07-04-2018 06:28 AM
@sr_murd wrote:
Why do you put a linefeed (LF, or CR, or both) between your values? Why not use a space or tab char and only ONE linefeed after the E value?
This is because the measurements are coming from another device in this manner.
Since you can change what is being sent over this serial port, you can remove those extra characters. Personally, I would get rid of the A, B, C, etc. Just have your values with a tab between them and end the message with a Line Feed (\n). This will make things, by far, the simplest to handle.