LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to send the data from Labview to Arduino

Hai

Good evening. I started working on new project that is to establish a two way communication from LabView to Arduino and from Arduino to Labview. I am successful with Arduino to labview communication and failed in writing the data in Labview and reading that data in Arduino. Searched many websites but i couldn't find any help so anyone please help me for finding the solution and i just want to send simple text data either it may be my name or any other data

thank you in advance

 

0 Kudos
Message 1 of 21
(9,509 Views)

On the LabVIEW side, use the VISA Write to send your data.  On the Arduino side, use the Serial.readStringUntil() function to read the data.  I recommend concatenating an End Of Line to the end of the string and use the Line Feed (0xA) as the "until" on the Arduino.


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 2 of 21
(9,491 Views)

Good morning

sir tank you for your response actually i have less knowledge in coding of Arduino and i already applied the visa write in Labview but the Arduino is not able to receive the data and i will attach my screenshots to this and sir help me out for doing this and thank you in advance

0 Kudos
Message 3 of 21
(9,466 Views)

good morning sir 

I am done with programming too in Arduino but i am finding difficulty in seeing the output can u please tel me this how can i able to see the outputs in parallel that is in Arduino and Labview and also i am using the same COM port for both of them and i will attach my VI and Arduino programming to this once go through that sir 

thank you

Download All
0 Kudos
Message 4 of 21
(9,443 Views)

Can you please use punctuation and capitalization in your messages so we can see where one sentence ends and another begins?  It is quite difficult to read your message as it looks like one run-on sentence.

 

In your Arduino code, you should use Println so that it puts a termination character at the end of your message.  This will allow LabVIEW to know when the incoming message ends and not timeout.

 

When you say you are "finding difficulty", you should provide some details as to what is happening wrong so we know what your problem is.

0 Kudos
Message 5 of 21
(9,437 Views)

good afternoon

Hai sir and I am sorry sir for my English. I included "Serial.println" but still then it shows the same Error.

The work till now I have done related to my project and Explanation of that.

I am working on two way communication from Arduino to Labview and Labview to Arduino. I am using "Arduino UNO" and I programmed that in such a way it will first receive the data from "Labview" and later after receiving the data it will send an acknowledgment to Labview that "I RECEIVED" data.

In Labview I used the same COM port that is used for Arduino and here I Build my VI such that first it will send data to Arduino and next it will read the data from Arduino.

Here I need  to see the output in both the Software's but in Arduino it is showing the error "PORT BUSY".

I dont know whether I should use different Ports?????? or I should change my VI???? in Labview. Help me Out.....in this                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              

 

0 Kudos
Message 6 of 21
(9,420 Views)

Since this is a "two way communication", you need to share your Arduino code as well.

 

Have you defined how the messages should be formatted?  That is the first step when you are trying to get two things to talk with each other.


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
0 Kudos
Message 7 of 21
(9,417 Views)

Hai sir

Good morning

And yes I defined the text format but i am not knowing exactly what is correct and what is wrong, when i am trying to attach my code this forum is not accepting that so I will attach the code snipping picture 

0 Kudos
Message 8 of 21
(9,404 Views)

So you are trying to do a formatted echo.

 

1. Change your code to use an Event Structure so that you only send the data when you want to.  Otherwise you are just constantly sending data and possibly overflowing the buffer on the Arduino.

2. No need to close the port twice.  In fact, don't even branch the VISA Resource in this application.  You send the data, then you read it back.

3. Let's simplify your code some:

void loop()
{
  if (Serial.available() > 0)  //See if data is there
  {
    incomingByte = Serial.read();  //Read a byte
    Serial.print("I received: ");
    Serial.println(incomingByte); //println appends the termination character
  }
}

This will work as long as your LabVIEW code only sends 1 byte.


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
Download All
0 Kudos
Message 9 of 21
(9,399 Views)

good morning

Sir I modified my program in Arduino and also changed my VI but the output in Labview seems to be null. It is neither showing any output nor error in Labview. The output in Arduino also not coming. Whats the reason for this???????

I will attach the picture of that just have a look on it sir.

Thank you 

Download All
0 Kudos
Message 10 of 21
(9,381 Views)