LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Close locks up computer

Hello,
 
I have recently seen a problem when trying to use the VISA Close function.
 
In my program, I communicate with one instrument through RS232, and two others through GPIB.  When the program exits, I close all three VISA references "in parallel" on the block diagram.  Every time, the program hangs indefinitely at VISA Close for one of the GPIB references.  The Abort button does not work, and ultimately I have to kill LV using the Windows Task Manager.  If I run in highlight execution mode, the program exits correctly.
 
I originally saw this using VISA 3.5, so I downloaded and installed VISA 3.6, but the problem still occurs.  My solution was to add 50ms delays between each of the VISA Close functions.  That seems to work correctly.
 
The development environment is LabVIEW 7.1.1 and it's running on a Windows 2000 machine.
 
I was wondering if anyone else had seen this or had an explanation.
 
Thanks,
Jon
0 Kudos
Message 1 of 11
(3,971 Views)
Hi Jon,

This sounds like an interesting situation.  I'd like to be able to reproduce it.  Would you be willing to post your code?  Could you modify it so I don't need the hardware?  Also, what version of NI-488.2 did you see this on?  Did you ever take a Spy capture?  I'd love to see the .spy file for this.

Thanks,
Robert Mortensen
Software Engineer
National Instruments
0 Kudos
Message 2 of 11
(3,951 Views)

Hi Robert,

Unfortunately, I had posted some incorrect details Smiley Sad.  The program is actually hanging at a VISA Write (not a VISA Close as I originally posted).  I have attached a screenshot of the block diagram of a greatly simplified sequence.

This vi duplicates the symptom.  If I run the vi, it will hang at the VISA Write I have shown.  If I run with highlight execution, it exits properly.  If I run with NI Spy capturing, it exits properly.  Also, if I switch the offending Write to "Do I/O Synchronously", it exits properly.  It just seems strange that it locks up without timing out or anything.

Anyway, I hope this information is useful and I apologize for posting some wrong information.  Oh, this is using NI 488.2 version 2.30.  I'm downloading the latest version now.

Thanks,

Jon

0 Kudos
Message 3 of 11
(3,939 Views)

What does the FA command do?

Is it possible that you are not waiting long enough for the instrument to do what it needs?

Is it a newer instrument that works well with VISA?

0 Kudos
Message 4 of 11
(3,919 Views)

Hi nyc,

Thanks for the reply.  The instrument is an RF amplifier from IFI...the FA command stands for "full attenuation" and basically shuts off the output.  While the instrument has a few quirks to communicate with it, I've been able to use all of it's functions without any trouble.  I also issue the FA command several other times throughout the program and it works ok.

In this case, when I run the little vi, it will hang "forever" (I've run out of patience after about 4 minutes).  If I open up the block diagram and hit the highlight execution button after it has locked up, the only thing that hasn't executed yet is the VISA Close (please see diagram2.jpg).  So I'm assuming it's still trying to do the Write.

It just seems like it's a strange timing problem that just happens to fall in the correct sequence to lock up the pc.

jon

0 Kudos
Message 5 of 11
(3,911 Views)
I'd like a .spy file to look at as well. When you do VISA Writes synchronously or execution highlighting, you doing the same thing - forcing the writes to occur one after another instead of doing it in parallel. With the GPIB bus, you can't really do the operations in parallel anyway since only one instrument can be addressed at a time. The 488 driver should handle this for you and that's why it would be nice to see the .spy file. A quick fix would be to set the VISA Writes to synchronous mode in this case since it seems to work and you won't see any difference in performance.
0 Kudos
Message 6 of 11
(3,907 Views)
I would be interested in seeing what happens if you take out the other VISA Opens and Closes and leave just the ones for the RF Amplifier.

I am wondering whether on the very first VISA Open the instrument needs longer time for some reason.

Highlighting basically slows everything down, so there is a delay with everything.
Usually when something works with Highlighting turned on, it is a timing issue.


0 Kudos
Message 7 of 11
(3,902 Views)


@Dennis Knutson wrote:
I'd like a .spy file to look at as well. When you do VISA Writes synchronously or execution highlighting, you doing the same thing - forcing the writes to occur one after another instead of doing it in parallel. With the GPIB bus, you can't really do the operations in parallel anyway since only one instrument can be addressed at a time. The 488 driver should handle this for you and that's why it would be nice to see the .spy file. A quick fix would be to set the VISA Writes to synchronous mode in this case since it seems to work and you won't see any difference in performance.


Unfortunately, when I run NI-Spy with the vi, it executes correctly.  I will try a few different options today, but so far I have been unsuccessful duplicating the problem while spy is running.

nyc,

If I remove the other portions of the code (VISA Opens, Write, and Closes) for the other instruments, it functions ok.  In fact, it functions ok if I just remove the other write (the one with the AP-89DM....).

Thanks for all your help and suggestions,

Jon

0 Kudos
Message 8 of 11
(3,896 Views)

What is that AP-89DMR2 command? Is that legitimate?

What happens if you run that part of it alone?

0 Kudos
Message 9 of 11
(3,885 Views)
I have an idea, but it destroys any sembalance of parallelism.  Force the other write first, then the "full attention", finally allow the closes.  The ASRL1 may not need be included in this, it may not be causing the conflict (race condition?).


Message Edited by jasonhill on 07-06-2006 08:58 AM

0 Kudos
Message 10 of 11
(3,883 Views)