11-12-2021 05:28 PM
Hello,
I have two instruments (New Focus picomotor and an Allied Vision camera although I suspect this is a general issue) that work unless the last time the VI was run was aborted. This happens frequently while I am debugging. Then I get an error like "Invalid camera session." I suspect that this is because the camera is still open somewhere and so is inaccessible to the current VI. Is there a way to close instruments even if the LabView program doesn't recognize it? Right now I have to restart my computer to get LabView to recognize my instruments
There are probably many great resources on this, but I don't know the terminology to find it.
Thanks
11-12-2021 05:30 PM
The first rule any experienced LabVIEW user will swear by - never abort a VI
It is like crashing the car into a tree to stop it and then you want it to start up and work normally??
11-12-2021 06:07 PM
For DAQmx and VISA issues, I typically just need to restart LabVIEW, not necessarily the whole computer.
Otherwise, it is pretty much impossible to get old references in order to close them unless, perhaps, they are saved in a global variable (actual Global Variable or a Functional Global Variable/Action Engine).
11-15-2021 11:17 AM
runtime
use this to get open sessions, close in a FOR loop, clearing errors
C:\Program Files (x86)\National Instruments\LabVIEW 2019\vi.lib\Utility\visa.llb\Open Sessions.vi
interactive mode
open the VISA CLOSE.vi, select any available sessions and just run that until you start getting errors. then open the next session in the list and repeat until all are closed
good luck!
11-16-2021 10:45 AM
@mwatkins wrote:
interactive mode
open the VISA CLOSE.vi, select any available sessions and just run that until you start getting errors. then open the next session in the list and repeat until all are closed
I think you meant to point to the Open VISA Session Monitor.vi in the same llb as the other VI you mentioned. That is a tool I did not know about that can really come in handy when I mess up during driver development.
11-16-2021 11:57 AM - edited 11-16-2021 11:58 AM
Hi @mwatckins,
Thanks for responding. When I run the Open Sessions.vi and the corresponding Open VISA Session Monitor, they both come up blank even if I purposely have other sessions running. After some digging, I have also tried using the VISA Close function where I directly feed it the known VISA resource name, but that also had no effect.