Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Hi, In serial communication VISA, problem in closing the VISA PORT

Hi,

As per my application, I am calling anather Labview application in Main Labview application. For communacation I am using VISA. But VISA is not allowing to communicate in anather application. Even I am closing the VISA port whenever I am execution the Sub- application.

 

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

 

 

Regards...

 

Mahar

0 Kudos
Message 1 of 9
(5,463 Views)
It is expected to do this. You cannot have multiple sessions open at the same time. In addition you have to close the application you used for the visa communication to open the session again in another application.
0 Kudos
Message 2 of 9
(5,462 Views)

Hi,

Once I am closing the serial Port by Close VISA function, it should be properly closed. But it is not happening.

So how can I close the VISA properly. Is some more time delay is required for Closing the VISA port?

 

Or by using any other adv. function we can solve the problem?

 

 

Regards...

Prakash Mahar

0 Kudos
Message 4 of 9
(5,425 Views)
Can you post a screen shot to show us how you have wired the close?
0 Kudos
Message 5 of 9
(5,422 Views)
Any update?
0 Kudos
Message 6 of 9
(5,404 Views)

I'm having the same problem, and I read the linked procedure to manually close it, but the instructions do not say what SW is being used (LabView or something I suppose.)

 

Anyway, I do not have that SW package, I only have what downloaded with the NI-VISA driver, which is NI Measurement and Automation V 4.6.1f0 (from the Visa462full.exe driver running on a WIN2k box & VB6)

 

Also, at first I thought it must be something in my VB code that was oppening a VISA session somewhere, so I closed everything and rebooted. Without touching VB, and going directly to NI Meas & Aut SW, any COM1 verification attempt fails with "could not open VISA session 'ASRL1::INSTR'" error 0xbfff0072 (as if a VISA session was running already right after reboot.)

 

I tried to add a viClose() command on the VB code prior to the viOpenDefaultRM() call, but I get an error 0x3fff0082 (or reference uninitialized.) That's a catch-22 as I can't initialize the Resource Manager because of an open session, and I can't close a session through VB because of uninitialization (Joseph Heller, eat you heart out!)

 

Any help would be appreciated on how to close the ghost visa session without whatever SW was shown in the above link.

0 Kudos
Message 7 of 9
(4,775 Views)

I am also seeing a similar problem to both of these posts where I get error 1073807246 even though I am closing the VISA session each time, and no other sessions are being opened. Unfortunately in my case, it is not very reproducible, as this problem occurs infrequently (I am sometimes able to run it hundreds of times and not see an error). My code is attached.

 

The real problem is that I am not able to clear the port using VISA Close as suggested in the article muks linked, and I have not been able to identify any alternative. No matter how many times I run a Close on the port, the only way to be able to communicate with the instrument (in this case a barcode scanner, but I have seen the same thing with other devices as well) is to reboot the computer. This is not acceptable since this is running as part of a larger automated test.

 

Is there another way to re-open a port when seeing the message "Error -1073807246... The resource is valid, but VISA cannot currently access it"? Is there a reason that this is happening in the first place?

 

Thanks,

rattier

0 Kudos
Message 8 of 9
(4,704 Views)

The solution for me turned out to be disabling the port in "device manager," then re-enabling it. Sadly, it doesn't seem that that is a workable solution for you, as it involves a boot.

 

The basic issue, for me, was that another application was polling the port on boot-up, before NI-VISA got to it. Thus, the problem is fixed by booting with the port disabled, then re-enabling. In hindsight, my problem was caused by a remote PC utility that IT routinely installs on all machines for troubleshooting purposes. Removing it from this particular machine has eliminated all recurrences of the above error.

 

I'd suggest you start looking at what SW may be polling that port before NI-VISA. Any communications type SW, as well as network security may be responsible. Also, improperly closing an NI-VISA session (i.e. crash) may leave the port open, and have the same effect but that shouldn't be a recurring cause.

 

Good luck!

0 Kudos
Message 9 of 9
(4,700 Views)