LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Write subVI very slow

Solved!
Go to solution

Hello,

I have a VI which needs to send several VISA commands over a GPIB interface to configure instruments, which has been running fine for more than a month. Recently however, it has slowed down to a crawl. It used to take less than half a second to run, and now takes almost 8 seconds.

 

I have isolated the problem to the "VISA Write" subroutine. When I send a command to the instrument manually using the VISA Interactive Control utility, it happens almost instantly (less time than it takes me to take my finger off the mouse after clicking "Write"). When I send the same command to the same instrument by calling the "VISA Write" subroutine, it takes about 1100ms to return. I have joined the VI code I am using to benchmark execution time.

 

What do you suggest I do to solve this problem? I have tried rebooting the computer, deleting and re-adding the instruments in NI-MAX...

 

I am using LabVIEW 2010 and NI-VISA 5.4 on Windows XP Pro SP3.

 

Regards,

Louis H.

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

Hi louis,

 

you measure the time needed to open the VISA resource AND to send a command…

 

Why do you need to open and close that resource for each command?

Why don't you measure just the time for VISAWrite?

 

I have joined the VI code

No, you just attached an image. No VI/code…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(3,110 Views)

You're right, but I ran it again, timing only the VISA Write itself, and get the same result.

 

The Open and Close session operations have negligible overhead, and in the actual VI I am trying to troubleshoot, I execute them only once, not every time I want to do a VISA Write.

 

Sorry for the attachment format, my mistake!

 

Regards,

Louis H.

0 Kudos
Message 3 of 5
(3,104 Views)
Solution
Accepted by topic author louis.haeberle

Problem solved! It wasn't LabVIEW or NI-VISA at all; the issue was with one of the instruments I was trying to control.

 

I think its firmware had a memory leak, and after leaving it running for several weeks it had slowed down to a crawl. Rebooting the instrument solved the issue.

 

The reason I wasn't seeing a long latency when controlling the instrument manually from the VISA Interactive Control is that it was able to respond to a single command quickly, but if a second command is sent within ~5 seconds, the instrument freezes and takes a long time to acknowledge the command. I ran my benchmark VI several times in quick succession, but when I used the VISA Interactive Control I had to type the command each time, introducing a few seconds of delay between each command.

 

Anyways, thanks GerdW for your help!

 

Regards,

Louis H.

 

P.S. The offending instrument is a Tektronix AFG3102C.

Message 4 of 5
(3,065 Views)

Hey, thanks for following up by posting your solution!  By taking the time to do so, you give the NI community the benefit of your hard-earned knowledge.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 5
(3,022 Views)