LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error -1073807339 occurred at VISA Read

Hello

 

Iam sorry to bother you because i know this topic is common in forum but i still dont know why is this happening. For the last 2 weeksi have been trying to make labview work but i couldnt so i found examples adn tried them out but once again i got the same error with visa read. I used Continuous Serial Write and Read.vi connected my arduino nano picked the right port and i still get this error. I tried to reinstall labview and it didnt work, i downloaded all the latest drivers. Iam using windows 10 and labview 2021 and i am beginner at labview but i dont know what is wrong, i tried multiple devices (arduino uno, arduino nano, stm32) but all ended up the same i would really appreciate if you could think of something that would help me make this program work cause i cant make serial communication work.

 

Thank you very much for your time

 

 

0 Kudos
Message 1 of 10
(2,399 Views)

It's a timeout error. It means the device didn't send back (enough) data for the VISA Read to return with.

 

- Are you sure your device is even sending any data?

- Why do you think it is sending any data back?

- Did you write a command to it that you know it understands and will cause it to return some data?

- Did you write the right command syntax?

 

Those Arduino and similar boards only do what you tell it to do. Before they will react in any way over the serial port you first have to download a program to them (an INO file) that tells them to listen on the serial port for specific commands, do something with them on reception and then react by sending something back. Until then you can bang on the serial port of that Arduino until hell freezes over but there will never be any meaningful reaction from them.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 10
(2,368 Views)

Hello

 

I want to thank you cause u already helped me understand something but i still get the same error. I created small code in arduino ide and all it does is that when i write over serial monitor led on the led on arduino will light up and when i write led off the led will switch off and it works perfectly in arduino ide serial monitor but when i try it in Continuous Serial Write and Read.vi its chaotic and it does not work and after while i get the same error with possible reasons "Timeout expired before operation completed" and it does not light up LED on arduino.

 

 

0 Kudos
Message 3 of 10
(2,340 Views)

So you downloaded a program, very likely not self made, that listens on the serial port and when seeing the "led on" or "led off" string it then sets the led on the Arduino. That is great. But your program very likely uses the function Serial.read() to read in a loop until it detects a certain character such as a carriage return and/or linefeed before processing the command.

 

Your terminal program adds a carriage return and/or linefeed automatically when you enter a string and then hit the Enter key (the enter key is in fact that end of line identifier). In LabVIEW you do not have an enter key to send the data but simply a string constant or control. So you need to add that character explicitly to the string yourself. Right click onto the string control/constant, Select Visible Items->Display Style. Then a glyph appears on the left side of your string frame, usually an n, indicating Normal text display mode. Right click on that and select "'\' Codes Display". Now enter at the end of the string a "\r" or "\n". Now your Arduino program most likely will understand what you tell it.

 

And before you can read something with VISA Read your Arduino has to write something back. Does it use a Serial.writeln() call after receiving the command and setting the LED state?

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 10
(2,328 Views)

No i did not download the code i created it myself and asked a friend to help me finish it and you were right arduino reacts to my command without error after i put end of string there, thank you very much iam very gratefull for your support and maybe one last thing: It should be continous write and read but after i try to switch led off while program is running it does not work i have to abort execution and start it again to make it work. Do you think that is problem in arduino code or labview?

0 Kudos
Message 5 of 10
(2,315 Views)

@temple wrote:

Do you think that is problem in arduino code or labview?


We would need to see code (both targets) to make that evaluation.


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 6 of 10
(2,307 Views)

@temple wrote:

No i did not download the code i created it myself and asked a friend to help me finish it and you were right arduino reacts to my command without error after i put end of string there, thank you very much iam very gratefull for your support and maybe one last thing: It should be continous write and read but after i try to switch led off while program is running it does not work i have to abort execution and start it again to make it work. Do you think that is problem in arduino code or labview?


My magic crystal ball 🔮 is unfortunately out of operation for quite some time already. It would be needed to see the code that you forgot to attach to your post!

 

But my superhuman abilities tell me that it is most likely in your Arduino code. 😂

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 7 of 10
(2,305 Views)

Iam sending you both arduino code and VI but its basically just a copy of an example and btw sometimes i still get that error for some reason so i guess there is still something wrong. Thank you again for your support and hopefully your magic ball will work once again 🙂 

Download All
0 Kudos
Message 8 of 10
(2,290 Views)

Allow me to make some tweaks to your VI.

 

1. I gutted a lot of the setup out.  You are using the default settings, so just get rid of the junk.

2. Change your Write String to a button.  Then you can define the two possible messages on the block diagram.

3. Do a read when there is something in the port.  I am just using the Bytes At Port to see if there is any data.  It is not used to tell the VISA Read how many bytes to read.  I am just telling the VISA Read to read more bytes than I expect in a message and the termination character will do the rest for me.

4. You do not need to keep ALL of the data you read in.  Just show the last message you received.


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 9 of 10
(2,277 Views)

Ye, thank you guys very much for your time and effort it really means a lot to me, it works perfectly. And just so u know i didnt change anything in example because i planned to do more stuff with labview and nothing worked for me so i tried to do something simple to understand the program better but i just got that error over and over again. Thanks to you i now understand it a lot better and i can work on bigger project now and hopefully i wont need your help again 🙂

 

Have a lovely day

0 Kudos
Message 10 of 10
(2,269 Views)