LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Separate data from Serial

Hello everyone,

 

I'm using data communications to read two sensor (arduino) and represent the valuees in Labview. I don't know how to separate those measurement from the diferents sensors. I think that it should be easy, but I haven't too much experience with labview.

Thank you

 

Best Regards,

Jose S.

0 Kudos
Message 1 of 7
(4,131 Views)

Hi Jose,

 

yes, that should be easy! 😄

 

Two notes:

- don't use BytesAtPort here. Either use a TermChar (as you have configured) or a fixed byte count

- the answer to your question is found in your Arduino sketch: how do you send those values on the Arduino side of the serial communication? You need to read/parse the received string in the same fashion…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(4,116 Views)

The first thing we need to know is what does your data string look like? And then what is it supposed to look like once split.

I expect you can use the scan from string function, or some other string manipulation, depending on what your string is.

Ian
LabVIEW since 2012
0 Kudos
Message 3 of 7
(4,114 Views)

Thank you for your response GerdW,

 

I send the values using "Serial.println(temperature)" (temperature is a double) and actually I can see the values in the box, one second aprox from one sensor, and the next second the other, but I want to representate them in diferent boxes, and I don't know how separate them.

 

Thank you,

 

Jose S

0 Kudos
Message 4 of 7
(4,106 Views)

Hi Jose,

 

- send them as Serial.println(temp1, ";", temp2).

- Then you need to read a full line string using a byte count of 99.

- Parse the received string using ScanFromString with a format of "%.;%f;%f"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 7
(4,102 Views)

I would have used a "spreadsheet string to array" (or whatever it's called these days).  Would that have been Rube-ish?

 

Edit: I guess actually "spreadsheet string to array" (or whatever it's called these days) would be more scalable?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 7
(4,083 Views)

@billko wrote:

I would have used a "spreadsheet string to array" (or whatever it's called these days).  Would that have been Rube-ish?

 

Edit: I guess actually "spreadsheet string to array" (or whatever it's called these days) would be more scalable?


Spreadsheet String To Array (the name has not changed for many, many years) is more scalable.  But for just 2 items, I would use the Scan From String.  Any more than that, then I would go to the Spreadsheet String To Array.  At that point, I would likely be using an array indicator anyways.


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 7 of 7
(4,074 Views)