LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use VISA Read in acquisition data from Arduino

Hi 🙂 I'm new in Labview. I created a program with Arduino Mega, which returns 12 values ​​related to the analog pins, ranging from 0000 to 1023, annexed to the constant "SCC200010001 " (on the serial monitor I see the same constant string repeated 12 times with only the last four values ​​that change). I want to read only the last four values ​​of each string, with the VISA Read, and insert each of these into a different subVI, but when I run the program, the computer shuts down.
Someone have any ideas? This can be a problem of bytes count related to the VISA Read function? You must configure the Arduino before use with LabVIEW?

Thanks 🙂

0 Kudos
Message 1 of 5
(3,409 Views)

Its dificult to undestand your archetecture from the description.

 

On the arduino, build your desired string and always terminate the string with a constant such as the newline ("\n")

 

In labview, in a single location, you carry out the serial read (set up the termination character option on the "configure serial port" to match the constant you used at the arduino end).

 

This way labview will catch the entire packet sent from the arduino, up to the termination character. You can then split up this packet into the individual values you desire and send them off to the subVIs.

 

Deceased

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

Thanks for your answer!
So, in this case, what I connect to the "byte count" in the function VISA read? There is a particular value or I must connect VISA Bytes at serial port?
You should set synchronous or asynchronous I/O mode?
Finally, I have labview 2014 with NI VISA 15.01 and I installed the drivers of Arduino. You need something else?

0 Kudos
Message 3 of 5
(3,348 Views)

Set the bytes to read to some overly large number. Once it reaches the termination character in the buffer, it will return the bytes up to that point. 

 

You dont need any arduino drivers at all. VISA serial does all you need.

 

Deceased

0 Kudos
Message 4 of 5
(3,334 Views)

If you're using the Arduino as a DAQ system, and no real code is used on the Arduino for processing or control, then it's easy to just use NI Linx, http://sine.ni.com/nips/cds/view/p/lang/en/nid/212478

 

This is a LabVIEW library designed for interaction with Arduino using Labview code instead o Arduino code.

 

Even if you have control algorithms on the Arduino,

1) Linx is designed to drop in your own code in the Firmware

or option 2) send the serial data to the COM port on the Arduino side, and read with VISA on the Labview side.

 

 

As far as your computer shutting down, you need to check your wiring - mkae sure you have nothing reversed. Switch the Arduino with a different Arduino to see if it's your arduino. You said you have a Mega.. the USB metal shield can reset the Mega... it surely happens when you pull the USB out, I think because it connects ground momentarily.

 

0 Kudos
Message 5 of 5
(3,289 Views)