LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading/displaying from multiple sensors

Solved!
Go to solution

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 

0 Kudos
Message 1 of 25
(3,517 Views)

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.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 25
(3,503 Views)

Hi  

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,

0 Kudos
Message 3 of 25
(3,493 Views)

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?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 25
(3,491 Views)

hi

please check the attached image for the received string

0 Kudos
Message 5 of 25
(3,486 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 25
(3,480 Views)

Hi sir

 

This is my resulting display

0 Kudos
Message 7 of 25
(3,478 Views)

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.

0 Kudos
Message 8 of 25
(3,474 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 25
(3,461 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 25
(3,457 Views)