04-28-2013 05:41 PM
While "VISA Wait On Event" is pending on an event, and in another thread the "VISA resource name" input to "VISA Wait On Event" is closed using "VISA Close" vi LabVIEW crashes.
I had a need to programmatically cause "VISA Wait On Event" to unblock so the LabVIEW program it is running in can be closed, or the "VISA resource name" originally input to "VISA Wait On Event" can be changed. I expected that executing "VISA Close" in another thread would cause "VISA Wait On Event" to unblock with an error. Instead LabVIEW crashes.
04-29-2013 10:58 AM
Artst,
Can you post a screenshot of your code to further clarify?
It sounds like you are trying to stop the VIs by clearing the reference while it is still in use which will lead to a crash. There is not a way to "unblock" a VI once it is running. Can you specify a timeout instead?
04-29-2013 06:43 PM
Regular time outs will require poling in a spinning loop I was hoping to avoid. This wastes the processor's time.
I attempted to create a minimized VI to demonstrate this problem. The trouble with it is that it did not crash. Executing "VISA close" caused the "VISA Wait on Event" vi in the other thread to unblock with a timeout error as I originally expected it do and needed it to do. I tried to develop that example VI more to make its context more like the VI I have this problem with, but the crash could not be duplicated with it. I ran out of time trying to find out what is different. So I have attached the entire VI I have this problem with. The crash is triggered when the "VISA resource name" control field on the front panel is used to select a COM port. The selection does not have to be a different from one already selected. This VI was created in LabVIEW 2012sp1.
The VI to run in the attached is located at: "\MOSA 6\MOSA 6 Firmware Development.vi"
04-30-2013 01:52 PM
What error are you receiving when LabVIEW crashes? From your previous post, it sounds almost as if the error is more to do with something in your event structure then something specifically related to the VISA commands.
08-16-2013 05:45 AM
There is definitely a problem with VISA wait on event... VISA Enable Event dumps LabVIEW memory onto serial port
It's about time somebody at NI tried to fix it.
08-19-2013 05:59 PM
Artst,
Could you give an explanation of how I might reproduce the error with the code you posted? Also, along with James, I'm curious as to what error is thrown when LabVIEW crashes.
Troy,
I agree that this does seem to be odd behavior of the VISA Wait On Event function. Did you start with any examples when trying to use VISA events? I found a PDF that seems like it would be useful as a starting point. I've attached a link to it below.
http://www.ni.com/support/visa/vevents.pdf
08-19-2013 06:40 PM
USBarnes wrote: Did you start with any examples when trying to use VISA events?
No, but the "Port B.vi" example I posted in the other thread is quite similar to VISA wait on event example that ships with LabVIEW.
I found a PDF that seems like it would be useful as a starting point. I've attached a link to it below.
The pdf you suggest uses GPIB and was written 15 years ago. Both problems reported by Artst and myself are using serial COM ports.
The sub-palette, controls and refnums it says to use don't even seem to exist any more in LabVIEW 2011/12.
08-20-2013 02:02 AM - edited 08-20-2013 02:04 AM
@James-K wrote:
Artst,
Can you post a screenshot of your code to further clarify?
It sounds like you are trying to stop the VIs by clearing the reference while it is still in use which will lead to a crash. There is not a way to "unblock" a VI once it is running. Can you specify a timeout instead?
Well, I think this is not giving enough credit to the actual problem. One common VISA programming paradigme in the standard C API is to actually let a VISA Read (and of course a VISA Wait on Event) to terminate with an error by issuing the viTerminate() function, which I believe should be possible to get optionally be called by VISA Close too. Unfortunately there is no direct access to any VISA Terminate function in the LabVIEW palettes, but I have in the past created a small VI which calls the underlaying VISA API directly to abort any stuck operations on a session. Possibly this VI could solve the problem, making the VISA Wait On Event return before the VISA Close pulls its session under its feet.
PS: Why can't I upload the VI directly to the board? Is it because it is in LabVIEW 7.1 format??