LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Display serial data on a listbox

Hi,

 

I am reading data thru a serial interface, as the data is received is concatenated in a data string. When I write this data in a listbox is not properly displayed line by line, meaning there is empty row or 2 rows make a complete line. This format issue is caused by the serial data received sporadically.


How could I fix this issue? How could I take the concatenated string look for the termination character send by the serial device and have properly displayed text in a listbox?

frn

 

0 Kudos
Message 1 of 5
(2,443 Views)

Hi frn,

 


there is empty row or 2 rows make a complete line. This format issue is caused by the serial data received sporadically.


You might avoid that "default if unwired" output of the case structure: they (can) cause empty rows in your listbox!

The "format issue" is not caused by how the data is received, it's caused by you not splitting that data at the correct points...

 


How could I take the concatenated string look for the termination character send by the serial device and have properly displayed text in a listbox?


Use that termchar in your serial communication to receive full strings from VISARead. Get rid of BytesAtPort!

 

And you might use BuildArray instead of your Rube-Goldberg-wise use of InsertIntoArray...

Best regards,
GerdW


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

Thanks GerdW,

 

I made a few changes to the code and it is working.  however, I have to write to a file and then read from the same file in order to make it work, which is a bad work around and I just wonder if I just missed something very simple to duplicate the function of writing and reading from same file.  BTW, it need to use BytesAtPort, because other restrictions.  Please advise.  Thanks.

 

 

0 Kudos
Message 3 of 5
(2,388 Views)

Hi frn,

 

ever wondered about that SpreadsheetStringToArray function in the string palette? Or even cared to look inside those file function you use to load the file?

 

And do you really need such an uncommon delimiter?

Best regards,
GerdW


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

Thanks GerdW for your comments but I am working at another issue and come to this issue later.

0 Kudos
Message 5 of 5
(2,344 Views)