Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with error -1073807246

Hello all,
I have a problem with VISA when trying to access an already opened session. I get the following error:

VISA:(Hex 0xBFFF0072) The resource is valid, but VISA cannot currently access it. (error code -1073807246)

I know from several other discussions, that this error may occur if I try to access an opened session. For example I want to communicate with one device with two individual applications. To make sure, that only one application talks to the device, I use the VISA Lock/Unlock. And the thing with the two applications works for me with our USB device, if I use Windows XP, no matter what Labview or VISA version I use. I tried Labview 2009 and some 8.x versions in combination with VISA 4.4 and 4.3. It works all the time. Having installed Vista on the same computer, it doesn't work. I get the mentioned error everytime, no matter what I do!!

Does someone know how solve this problem? I also want this working on Vista (and in time also on Windows 7, but haven't tried that, yet).

And does someone know what's the purpose of the VISA Lock/Unlock, if a VISA session can only be accessed by one application?

Best regards
0 Kudos
Message 1 of 10
(10,669 Views)

Hello Nuesel,


your post is rather interesting - accessing a VISA resource from different applications simultaneously should always result in error -1073807246 being thrown for the second VISA Open call. Please understand that we cannot recommend using this unintentional behaviour as will possibly be fixed in a future version of NI-VISA.

It is possible though to open multiple VISA sessions on the same resource IN ONE APPLICATION (see attached example). This can be used to query multiple devices on the same COM port when using e.g. RS-485. This is also the designed use for VISA locking - if you plan to transfer a larger data segment from one device to the host, you can lock the resource and unlock it afterwards, so that regular query jobs can continue...

Best regards,
Sebastian

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

Oh, just BTW:

There seems to be a program that clones COM ports: Serial Splitter 

This might be a solution for your applications, as it claims to be Vista compatible. Be advised though that NI might not be able to support any issues resulting from the use of this program.

Best regards,
Sebastian

0 Kudos
Message 3 of 10
(10,608 Views)

Sebastian,

 

Did I understand you correctly, that viLock is designed for use within the same application?!

What good is that - since the programmer can decide when to write to the instrument and avoid conflict?

 

It surely is needed when two different applications are trying to use the same instrument at the same time.

 

I'm trying to do this in GPIB where I have an application constantly monitoring an instrument in case of too much power - while other applications are using the same instrument. I though the lock and unlock would be the way to do this?

 

Thanks,

 

Ronnie

 

 

TestStand 4.2.1, LabVIEW 2009, LabWindows/CVI 2009
0 Kudos
Message 4 of 10
(10,358 Views)

Hi Ronnie,

 

you did understand correctly. The lock mechanism allows you to reduce coupling in your code: if parallel access to one specific device is necessary, you don't have to hassle with the device arbitration code yourself. Just check for errors in the VISA Open call and periodically repeat if the "lock error" has been returned....

 

 

Best regards,

Sebastian

0 Kudos
Message 5 of 10
(10,208 Views)
For this kind of operation you need 1 application to access the single resource.  Have you considered using a queued consumer loop to allow access from both applications?

"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 10
(10,202 Views)

Sebastian and Jeff,

 

Thanks for your helpful answers.

 

Sebastian - you seem to be saying that I can have two applications using the same resource. Each of them can employ viLock and use VISA to monitor if their viOpen has been successful or not - if not - keep trying until it is - then use the viLock to stop the other app. OK - this makes sense. I originally thought that VISA would perform the arbitration between the two applications and basically 'pause' one application's attempt to viOpen if the other has locked it. Clearly this is not correct.

 

Jeff - you seem to be saying that it's better to have a single application that uses the resource and that other applications need to go through this application using some sort of queueing mechanism. This also sounds reasonable - I need to investigate this.

 

If I have misinterpreted what any of you said please feel free to correct.

 

Thanks again,

 

Ronnie

TestStand 4.2.1, LabVIEW 2009, LabWindows/CVI 2009
0 Kudos
Message 7 of 10
(10,197 Views)

This error can also occur when you use Instrument Assist to control a serial port. You may find that you can enter a write statement in Instrument Assist, and when you click RUN in instrument assist, it will work but when you click the OK button and the Instrument Assist configures, the error will appear when you run the program.  {The Instrument Assist will flash black for a sec, Error}.  When the Instrument Assist Configures the port, it does not release the port.  You have to save your program, close labview, and restart.  Open your program, and just run it.  This should work.  Just remember any time you open up the Instrument Assist you should shut down labview and restart. NI knows of this problem, but no fix at this time.

0 Kudos
Message 8 of 10
(8,989 Views)

@Jo_Nathan wrote:

This error can also occur when you use Instrument Assist to control a serial port. You may find that you can enter a write statement in Instrument Assist, and when you click RUN in instrument assist, it will work but when you click the OK button and the Instrument Assist configures, the error will appear when you run the program.  {The Instrument Assist will flash black for a sec, Error}.  When the Instrument Assist Configures the port, it does not release the port.  You have to save your program, close labview, and restart.  Open your program, and just run it.  This should work.  Just remember any time you open up the Instrument Assist you should shut down labview and restart. NI knows of this problem, but no fix at this time.


Jo.  A couple points to consider.

First this is a two year old thread and the OP has not visited the forums since January of this year (10 months ago) so your second ever post is not likely to help much (BUT, Thanks for contributing!)

 

Second this is a two year old thread so the OP would not know too much about Instrument Assistant (the post pre-dates its release)

 

Third, open LabVIEW Tools>>Options>>Enviornment check the radio button for "Automatically close VISA sessions" and the bug in Instrument assistant will magically POOF into oblivion.Smiley Wink  


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 10
(8,974 Views)

yeah,this is the answer i need.

0 Kudos
Message 10 of 10
(8,891 Views)