09-25-2009 03:55 AM
10-01-2009 06:08 AM
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
10-01-2009 08:19 AM
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
12-21-2009 12:11 PM
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
01-11-2010 08:21 AM
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
01-11-2010 10:09 AM
01-11-2010 10:53 AM
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
10-02-2012 11:00 AM
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.
10-03-2012 08:29 AM
@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.
11-12-2012 07:40 PM
yeah,this is the answer i need.