LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read Serial Data from Arduino using labview VISA?

Solved!
Go to solution

hie everyone.. here im new to arduino as well as labview.. i want to send some text like abc from arduino to labview serially.. could anyone help me please.. i have arduino mega board

 

0 Kudos
Message 81 of 143
(2,783 Views)

hi.. im new to arduino and labview.. i want to send text abc from arduino mega and want to read it on labview serialy. could u help me.. regarding codes

 

0 Kudos
Message 82 of 143
(2,780 Views)

From the Arduino, you use the PrintLn command to send your data.

 

On the LabVIEW side, you just use Configure Serial Port to set up your port to make that of the Arduino.  Make sure you leave the Termination Character on.  Then with the VISA Read, you just tell it to read more bytes than you will ever expect to recieve in a single message.  The read will complete when the termination character (the carriage return, 0xA, \n) is recieved.


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
Message 83 of 143
(2,765 Views)

void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}

// send an intro:
Serial.println("\n\nString Constructors:");
Serial.println();
}

void loop()
{
// using a constant String:
String stringOne = "12345";
Serial.println(stringOne); // prints "Hello String"
// do nothing while true:
while (true);


}

 

 

 

this code returns 12345 in serial monitor now i want to send it on labview.. can u provide vi for this

 

0 Kudos
Message 84 of 143
(2,752 Views)

BTW... thank you so much for ur quick reply

Smiley Happy

 

0 Kudos
Message 85 of 143
(2,751 Views)

There's a serial Read VI available in LabVIEW.  You must configure first with appropriate Serial settings and then have a loop set up to read the Serial Buffer.  These VIs you are looking for are available in NI LabVIEW examples.  But you're not going to understand what they do or how to use them properly without doing some LabVIEW research and homework.  That means learning your LabVIEW Core 1 and Core 2 (fundamentals).

Message 86 of 143
(2,736 Views)

hi.  i have one array in labview that varies it continuous and i want use dates of this array for control speed of motor.help me.

tanks a lot  

0 Kudos
Message 87 of 143
(2,649 Views)

Hi Folks,

 

I am pretty new to labview and would like to work into it using a arduino like users did before here in this thread.

 

I want to measure voltages with the arduino. I took the model uploaded by the users here what is a great base to start from. Then I adapted it to write a command to the arduino, what actually works sometimes.

 

What my adaption of the code does:

 

1) open serial connection (works)

2) write command 7 (worked one time, what I saw in the string window)

3) loop read the output of voltages loop from arduino

4) put them in the string window (only worked one time)

 

So I think it might need correct timing to read the buffer because it only sometimes goes into the "standard case" that reads something to the string window. all the other times it just does not read anything.

 

do you guys have any idea? Is my approach correct?

Many thanks


Anna 🙂

Download All
0 Kudos
Message 88 of 143
(2,375 Views)

From the image, it looks like your Arduino is going back to waiting for a command.  Perhaps you should create a state machine so that you can go back and forth between reading data and sending the command.


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
Message 89 of 143
(2,370 Views)

running this VI i am getting this error

Error -1073807360 occurred at Property Node (arg 1) in VISA Configure Serial Port (Instr).vi->serial_arduino_ABC (1).vi

 

0 Kudos
Message 90 of 143
(2,322 Views)