LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LABVIEW communication variables

Having Major issues

 

First and foremost I am a total noob at LabVIEW im trying to get better!

 

secondly, I am having issues with the temperature only displaying incremental values as the PNG image shows, and other values displaying. 

 

Thirdly, I want to send my microcontroller adjustable variables from LabVIEW which I can set from the LabVIEW interface. I require 5 controllable values on a scale of 0 - 255 of each can be sent to Arduino. here I can send them to the PWM ports once i read them in.

 

Please dont say use LIFA (i have already used LIFA it works great but does not offer me transportability so VISA is much more robust for my purposes.

 

please can offer me some advice and perhaps give me an example in my code of how i can output variables to my microcontroller.

 

im really stuck and need help

 

Thanks in advance!

Download All
0 Kudos
Message 1 of 5
(2,616 Views)

Hi xx,

 

Please dont say use LIFA

Use LINX! 😄

 

I want to send my microcontroller adjustable variables from LabVIEW which I can set from the LabVIEW interface. I require 5 controllable values on a scale of 0 - 255 of each can be sent to Arduino. here I can send them to the PWM ports once i read them in.

Create a sketch for your Arduino.

Implement handling of the serial port.

Implement some commands (to receive data from your PC/LabVIEW) and implement some messages to answer those commands.

Then use VISA functions in LabVIEW to communicate with your Arduino!

Best regards,
GerdW


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

Well your LabVIEW version is newer than mine so I can't look at your code.

 

But...

 

Communicating with a microcontroller over a serial port using VISA is no different than communicating with an instrument connected to a serial port, in fact it is easier. Because you (I assume) are programming the microcontroller, so you get to decide how both the query and response should be formatted.

 

Since I can't give you any exact things to change in your code I will give some general hints.

 

  1. Don't use "Bytes at Port" (search the forum for why)
  2. Make sure the response sent from the micro ends with a termination character
  3. In the VISA Serial Setup enable the termination character and set it to match
  4. On your VISA Read set it to read a higher number of bytes than you expect to receive
  5. Now VISA will read until it sees the Term Char or a VISA timeout occurs

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 5
(2,595 Views)

So is this the correct way to send the information to the write file?

refer to PGN (Like this)

 

also still not sure how to fix my issue with the temperature only displaying every so often.

 

thanks in advance

Download All
0 Kudos
Message 4 of 5
(2,550 Views)

Hi xx,

 

is this the correct way to send the information to the write file?

Surely not - as you would have noticed once you start debugging your own code…

 

See the difference in your conversion and my suggestion:

check.png

They are different in complexity - and in the final string result (for a good reason)…

 

Btw. (auto-)cleaning up the block diagram would help to increase its readability!

 

On your "Still this issue" image:

- what is the content of the "read buffer"?

- why do you use an empty string as delimiter at SpreadsheetStringToArray?

- why do you convert to a 2D array when you apparently only receive a 1D array?

- why do you create a waveform with a dt of zero?

- why do you need formula nodes for simple calculations?

- why do you need a comparison and a select function instead of a simple MinMax function?

 

Best regards,
GerdW


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