LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with VISA Write and Arduino: Error 1073807339, Timeout expired before operation completed

Solved!
Go to solution

Hi,

 

I am getting an error message (see title) during operation of my LabVIEW program. I am controlling a stepper motor that is connected to an Arduino Uno with a shield from Adafruit (https://www.adafruit.com/product/81). I am controlling the speed of the stepper motor with the LabVIEW program. After more than 6 hours (but less than 24 hours) I get the following error message: Error -1073807339, Timeout expired before operation completed at my VISA Write function. That problem does not occur when I set the loop time of my VI to 1 second instead of 0.5 seconds.

 

My current solution is to not connect the error wire to the stop of the while loop. With that the motor keeps spinning for days (and probably longer). However, I was wondering if there is a 'clean' way to solve that problem. I need to have the loop time at 0.5 s.

 

I attached my Arduino code and the VI.


Feel free to point out any mistakes in my VI. I modified an existing one so probably I could remove some stuff.

 

Thanks,

PTobias

Download All
0 Kudos
Message 1 of 7
(4,021 Views)

Hi PTobias,

 

I looked at your code and I noticed that you are continuously operating on the elapsed time variable and including that in the string that you send with the VISA Write command. I suspect that the VISA Write times out because the size of the buffer that is written is always increasing due to the continuously increasing Elapsed Time variable.

 

To confirm this, run the program with loop timing at 0.5s until it crashes. Once it crashes record the value of the Elapsed Time indicator. Do this a couple of times and if the value is the same, we can be confident that this is causing the error.

 

Why do you need the timing to be at 0.5s?

Why are you using the elapsed time in your VISA buffer?

 

Also, you might want to post this in the Instrument Control forum for more visibility from the community.

https://forums.ni.com/t5/Instrument-Control-GPIB-Serial/bd-p/140

 

-Mitchell | NI

0 Kudos
Message 2 of 7
(3,970 Views)

Hi Mitchell,

 

What do you mean with "continuously increasing Elapsed Time variable"? It always shows approx. 0.5 seconds unless one iteration of the loop takes longer than that.

 

I need the timing at 0.5s because I want to use that program and include it in my main program where the loop time is 0.5s.

I am using the elapsed time variable because I need to calculate the steps of the stepper motor per iteration (per 0.5s).

I have to tell the stepper motor how many steps it has to move (per iteration which is equal to one revolution) because it is not continuously moving without that.

Therefore, the amount of steps depends on the speed of the motor and the loop time.

If I don't tell the motor enough steps it will stop until the next iteration and if I tell the motor too many steps I cannot control the speed of the motor without a significant delay.

 

Thanks,

Tobias

0 Kudos
Message 3 of 7
(3,961 Views)

If the elapsed time express VI is not set to automatically reset, it will continue to increment even if it is inside of a while loop. It doesn't appear that you have set the express VI to auto-reset based on the un-wired "auto-reset" input. However, you can set this feature by double clicking the express VI and setting it to TRUE.

0 Kudos
Message 4 of 7
(3,945 Views)

The express VI is set to automatically reset. Otherwise, I would not continuously read 0.5 s in the "Elapsed Time (s)" indicator and the motor would not work how I want it to either. However, everything is working fine besides that error that happens after a few hours.

0 Kudos
Message 5 of 7
(3,939 Views)

Take a look at this document. Solution one is probably the best path to follow for now.

 

Why Do I Receive Timeout Error -1073807339 on VISA Read or Write?
http://digital.ni.com/public.nsf/allkb/874B379E24C0A0D686256FCF007A6EA0

 

To observe the write string when the error occurs, set a breakpoint within a conditional logic sequence (like a case structure) that will halt the program when the error occurs.

0 Kudos
Message 6 of 7
(3,917 Views)
Solution
Accepted by topic author PTobias

I couldn't find any errors there.

However, my program is working now without errors. I removed some stuff that I think that was not necessary.

I attached my working program.

Download All
0 Kudos
Message 7 of 7
(3,877 Views)