LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to split the incomming bunch of serial port (VISA Read) data.

In brief, I'm trying to read the contineous data from uc(micro controler) on serial port 

ex, @gsm_1&gps_1#@gsm_2&gps_2#@gsm_3&gps_3#@gsm_4&gps_4#@gsm_5&gps_5#@gsm_6&gps_7#@gsm_8&gps_8#@gsm_9&gps_9#@gsm_10&gps_10#

if i'm receiving like above data. I 'm want to split them and show them in a table like

S.NO            GSM              GPS

01                 gsm_1           gps_1

02                 gsm_2           gps_2

03                 gsm_3          gps_3

04                 gsm_4          gps_4

05                 gsm_5          gps_5

..on so no like above.

 

0 Kudos
Message 1 of 9
(3,494 Views)

Hi l12,

 

split the string at those #@ chars...

(Replace #@ by a LF and the & by a tab char.)

Where do you get the serial# from?

Best regards,
GerdW


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

From controller , we 'll get above data.( through serial port we can get data including # char). 

0 Kudos
Message 3 of 9
(3,434 Views)

Hi l12,

 

and what's your problem?

Where are you stuck?

Where's your VI?

 

An image to my suggestion:

check.png

The missing formatting stuff is up to you…

Best regards,
GerdW


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

When data comes contineously how we receive synchronously. Bcz we don't have buffer in it, as well it is running in while loop.

 

0 Kudos
Message 5 of 9
(3,429 Views)

Hi l12,

 

When data comes contineously how we receive synchronously. Bcz we don't have buffer in it, as well it is running in while loop.

How do you receive the string data right now?

Why do you want to receive "synchronously"? What is your definition of "synchronously"?

Which buffers are you talking about?

Why don't you attach your VI?

 

And please read this because of "Bcz"

Best regards,
GerdW


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

Please check in page_2 at visa read.

0 Kudos
Message 7 of 9
(3,418 Views)

Hi l12,

 

Here how to receive data, when I'm writing * controller 'll give data(@9391177113&25252525255 #)

You already know "how to receive data": use VISARead as you already do…

 

There is a problem with your MatchPattern afterwards: you try to match "&" twice even though there is only one "&" char in the message!

Best regards,
GerdW


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

@l12ec937 wrote:

In brief, I'm trying to read the contineous data from uc(micro controler) on serial port 

ex, @gsm_1&gps_1#@gsm_2&gps_2#@gsm_3&gps_3#@gsm_4&gps_4#@gsm_5&gps_5#@gsm_6&gps_7#@gsm_8&gps_8#@gsm_9&gps_9#@gsm_10&gp


If you have control over how that microcontroller works, I would have that data stream updated to just have all of the values tab or space delimited.  Less characters yields a higher possible throughput.  This would also make it easier to read.

gsm_1 gps_1 gsm_2 gps_2 gsm_3 gps_3 gsm_4 gps_4 gsm_5 gps_5 gsm_6 gps_7 gsm_8 gps_8 gsm_9 gps_9 gsm_10 gps_10

So if you can get that done, then you just read the line and use Spreadsheet String To Array followed by a Reshape Array to convert it into a 2D array.


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 9 of 9
(3,406 Views)