Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Using IMAQ VIs with LV2

I have IMAQ code that uses a LabVIEW 2 sytle global.  One state initializes the board and calls IMAQ create.  The Imaq seesion reference and Image Reference are wired to an unitialized shift register, the second state uses the Imaq session reference from the unitialized shift register to call the "Imaq Snap.vi", and the last state simply closes. 
 
After Initializing, I call the "Get Image" case, and LabVIEW returns an error code of  ", and this states "NI-IMAQ:  The passed in interface or session is invalid".  I created another simple VI that does not use the uninitialized shift registers and it works.
 
The error is occuring the in the "Imaq Snap.vi".  This VI calls "imgIsNewStyleInterface.vi" which returns false when using the LV2 method, but returns True when using the NON - LV2 method.
 
Has anyone else seen this issue?
Attached is an example VI.
 
I am using a NI PCI-1409 frame grabber.
 
Regards,
CSPowell
.
 
 
0 Kudos
Message 1 of 3
(3,230 Views)

I didn't had a chance to move to LV 8.2 (too many projects ongoin with 8.01) could you please send again your VI in LV 8 or 8.01 ?

 

Thxs

Doc-Doc
http://www.machinevision.ch
http://visionindustrielle.ch
Please take time to rate this answer
0 Kudos
Message 2 of 3
(3,196 Views)

Hello CSPowell,

You are actually seeing the expected behavior of the IMAQ driver. I see that you are trying to open an IMAQ session and keep it open even though you stop your LabVIEW VI. Unfortunately, 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 the way you are trying to use it with an IMAQ Session. If you want to use your "State Machine-like" VI of 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 for you and you won't get the error code you are receiving.

I have actually seen this error before with another customer that was doing the same thing you are, but they were using a sequencing type of program, similar to NI's Testand software but their own, to pass the IMAQ Session to the different states like the open (Initialize), Acquire image, and Close states. Their sequencing software did not keep the IMAQ session open properly because it didn't pass the session via the IMAQ driver properly, but I tested and successfully did this using NI's Testand software with a LabVIEW VI for the different IMAQ states like in your program.

So 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 it (the session id) to and from the upper level VI and the subVI, and you should not get an error. I hope this helps and clears things up for you. Please let me know if you have any further questions or concerns on this issue.

Regards,

Jasper S

0 Kudos
Message 3 of 3
(3,188 Views)