Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

Keep IMAQ Session Open Using Functional Global Variables

Primary Software: Driver Software>>NI-IMAQ
Primary Software Version: N/A
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I would like to use a functional global with my image acquisition session. When I try to do this, I get the NI-IMAQ error code -1074397163 that says “IMAQ interface or session is invalid”. Can I keep an IMAQ Session open between calling my functional global that is set up to Initialize, Acquire, and Close the IMAQ session?

Solution:
You might be trying to open an IMAQ session and keep it open even though you are stopping the LabVIEW VI. The IMAQ driver does not allow you to keep an IMAQ session open if the LabVIEW VI stops (or closes). The built-in behavior of the driver will automatically close the IMAQ session if it is left open when the VI stops. Even though the normal behavior of an uninitialized shift register is to return the last value that was stored in it (or the default value for the first time), this is not the case with an IMAQ session. Therefore the uninitialized shift register will not work if you only run the VI once and let it close.

If you want to use your VI in a State Machine style of program, with the Initialize, Acquire, and Close States, then you can, but you will have to have some way to keep LabVIEW open with that session passed to and from it. For example, if you have a higher level VI that calls your VI as a subVI, then this will work and you won't get the error code telling you the interface or session is invalid.

You can easily test this out by simply making your VI into a subVI and placing it into a high level VI that calls it for each state that you want. You will see that because LabVIEW does not stop, the IMAQ session will stay open if you pass the session id to and from the upper level VI and the subVI, and you should not get an error.

Another use case would be trying to use this in a sequencing type of program, similar to NI's TestStand software. You might be trying to pass the IMAQ Session to the different states like the open (Initialize), Acquire image, and Close states. If you are not using NI TestStand, then your sequencing software might not keep the IMAQ session open properly because it does not pass the session via the IMAQ driver properly. In TestStand, you can keep the session open by storing it in a variable in TestStand. This will allow you to pass the IMAQ session from one IMAQ state to another like in a LabVIEW program.

Related Links:

Attachments:





Report Date: 07/21/2007
Last Updated: 08/31/2007
Document ID: 4BK9T3HB

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit