LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Building waveform from serial interface data

Hey guys, 

I am having some weird data issues with an arduino uno on COM3,
simple enough code the Arduino outputs 4 sensors analog values in the format;

"Temp1, Temp2, Moisture1, Moisture2"

My end goal is to build 4 waveforms of "StoredDisplayLength" to plot and display the data, while also continuously writing the data to a .csv file for long term monitoring.

Unfortunately I am getting weird data transfers, creating line breaks in both the log file and as shown on the front panel in the image attached.

Is there a serial setting I have setup incorrectly? I really just need the while loop to allow the VISA read to finish before looping, which it should have plenty of time to do. 

This isn't the final product, I am just struggling to get this reliable, then aiming to split the "Chart Data" string array into the waveforms as needed. 

Thanks for the help!

CodeSnip.PNG

DataBuilder_vi7.PNG

DataSplitError.PNG

0 Kudos
Message 1 of 2
(1,260 Views)

Hi Jordan,

 


@Jordan29 wrote:

I am having some weird data issues with an arduino uno on COM3,
simple enough code the Arduino outputs 4 sensors analog values in the format;

"Temp1, Temp2, Moisture1, Moisture2"

My end goal is to build 4 waveforms of "StoredDisplayLength" to plot and display the data, while also continuously writing the data to a .csv file for long term monitoring.

Unfortunately I am getting weird data transfers, creating line breaks in both the log file and as shown on the front panel in the image attached.

Is there a serial setting I have setup incorrectly? I really just need the while loop to allow the VISA read to finish before looping, which it should have plenty of time to do.


So you want us to help you on your code problems, but all you attach are some images of your code and an image of the frontpanel showing some truncated strings? We cannot debug/run/edit images with LabVIEW!

 

On your questions:

  • As you seem to send readable text from your Arduino you should enable the TermChar for serial communication!
  • Using BytesAtPort, together with a Wait, most often is just wrong! See this video!
  • When you want to build waveforms you should not store all your data in a huge array of strings!

 

Best regards,
GerdW


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