Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

how to pass IMAQ session to subVI

Solved!
Go to solution

Hi,

 

My experience with LabView is neither very good nor extensive. I am a scientist and I am acquiring data with IMAQ.My current problem is that the people who wrote the script in the beginning made it neither versatile, nor modular nor clear structured. So I am trying to reduce the ridiculous numbers of execution controls in a single flowchart to a level that people can actually understand it... and to make the script more versatile for future experiments.

 

I am introducing quite a few subVIs to be executed repetitively. However, I can't find out how to pass the IMAQ session on to the subVI. I always get error messages. In this case I want to acquire frames with OIDE_CollectFrame.vi controlled by OIDE_TrialPhaseCollect.vi. I couldn't figure out how to assign the IMAQ session refnum class, either.

 

It's probably a newbie question but I usually don't program with LabView. 😉

 

Dennis

P.S. I use LabView 2009
Download All
0 Kudos
Message 1 of 13
(4,598 Views)

Hi,

 

See the attached example.  It passes the IMAQ session created in the main VI on to the subVI and then passses it again from the SubVI to the main VI.

 

Regards,

 

Greg H.

Applications Engineer
National Instruments
Download All
0 Kudos
Message 2 of 13
(4,585 Views)

Sorry, I am running LabView 2009 Basic Edition, your version is newer 😞

 

Could you just explain what to do?

P.S. I use LabView 2009
0 Kudos
Message 3 of 13
(4,576 Views)

Hi,

 

See attached, you should be able to open these.  Let me know if you cannot.

 

Regards,

 

Greg H.

Applications Engineer
National Instruments
Download All
0 Kudos
Message 4 of 13
(4,569 Views)

Hi,

 

your files work. It shows me what I knew how it is supposed to look like... but not how you did it.

 

I probably did not make my question clear. I know what to do, but not how... e.g. How do you generate the session handler in the subVI?

 

Dennis

P.S. I use LabView 2009
0 Kudos
Message 5 of 13
(4,549 Views)

Dennis,

 

Do you mean how to actually make the session controls and indicators in the the SubVI?  If so, you will see in the snap.vi subVI that there is an IMAQ session in and out connected to the IMAQ snap.vi.  You can create these by right clicking the session in terminal on the left hand side of this VI and selecting create»control.  Then you can do the same thing to the session out terminal on the right hand side, except you will want to create an indicator.  Then you can create terminals for this control and indicator on the connector pane.  Then save this VI and inset it into another VI as a subVI.  The session in and session out with show up as terminals that you can use to pass the session.  Please let me know if you have any questions.

 

Regards,

 

Greg H.

Applications Engineer
National Instruments
0 Kudos
Message 6 of 13
(4,536 Views)

Hi,

 

thanks a lot, this is the question I had. I actually tried exactly that but the icons coming up don't look like in your script and I get error messages when I try to connect them.

 

Dennis

P.S. I use LabView 2009
0 Kudos
Message 7 of 13
(4,534 Views)

Hi,

 

Are you trying this on the IMAQ Snap.vi or a different VI?  If you are trying this on the IMAQ Snap.vi could you attach a screenshot of what your block diagram looks like?

 

Regards,

 

Greg H.

Applications Engineer
National Instruments
0 Kudos
Message 8 of 13
(4,522 Views)

okay, although I still don't get the icons that look like yours, in the snap.iv, it works (see screenshot). I could actually connect it to the connector and in the Snap_Main connect the session ID to it, and it runs.

 

Question is, why this does not work in my scripts...

 

P.S. I have no idea what went differently, but now it worked o.O I am pretty sure I did it that way, all the time. The script runs but returns there was a bad session ID, I guess this is a different issue. However, how do you create these smaller icons for session id's?

P.S. I use LabView 2009
0 Kudos
Message 9 of 13
(4,508 Views)

P.P.S. (sorry for that!) I just realized that the session ID numbers do not match between the different subVIs.

P.S. I use LabView 2009
0 Kudos
Message 10 of 13
(4,505 Views)