LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering User Events

As a newbie to LabView, I'm really confused as to how to trigger user events in SubVI's. For instance, the attached "Main Controller.vi" just translates a cryostat vertically, so I've attached "SubVI.vi" to indicate the kind of things I want to try and do with it:

 

(1) I feed values into "Absolute Position" and "Relative Position",

(2) Wait for the "Master Ready Indicator" to turn green, and then

(3) Hit the "Home to Bottom Limit Switch" button.

 

So my problem is two-fold: what's going wrong in "SubVI II.vi"? If I try to wire the output of "Master Ready Indicator" to a simple boolean indicator, why isn't it lighting up when the latter does? And then If simply wiring a boolean constant to the Home Button doesn't trigger the event, how can I make this happen? The VI's probably aren't going to run on your machine, but I'd imagine I'm missing something much simpler. 

Download All
0 Kudos
Message 1 of 9
(2,560 Views)

You didn't attach a bunch of other files... namely R356 Home To Bottom Limit Switch" etc. Can't run the VIs. Zip the whole project and post that.

0 Kudos
Message 2 of 9
(2,557 Views)

Sorry about that! I've attched the zipped folder; both SubVI and SubVI II are in the main folder.

0 Kudos
Message 3 of 9
(2,552 Views)

OK, even without those VIs, There are some serious issues with your design. Assuming SubVI-2 (why is it called a subvi if it's the main VI?) You put an event struct in a subVI (the subvi here being Main Controller). If you run SubVI2, Main Controller is never going to return and the whole thing is just going to hang. That's because the event structure is waiting on events... but you haven't even opened up its front panel. So ... it will hang. 

 

You shouldn't use event structures unless you're going to pop up a window and wait on user input. Never use them in subvi's which just need to perform a particular function then return. 

0 Kudos
Message 4 of 9
(2,548 Views)

I guess to summarize, think of subvi's like functions. They should perform a particular task, then exit and return their data. They should have nothing in them that requires keyboard/mouse input unless you're opening up a dialog window to acquire said input. 

0 Kudos
Message 5 of 9
(2,542 Views)

Yeah, someone pointed this out to me in an earlier thread. I'm essentially just trying to string together a bunch of VI's that other people have designed, so my question really boils down to this: can I mimic a user pressing a button on front panel? 

0 Kudos
Message 6 of 9
(2,540 Views)

Yes. Create a property node of the control, then use Value (signaling). Wiring a value to it will trigger its corresponding event.  BUT you should RARELY have to do this and it's a very bad habit to get into. 

 

I think there is probably a better way. Can you explain what your intent is?

0 Kudos
Message 7 of 9
(2,537 Views)

Sure. Main Controller (MC) is one of many VI's that I'm trying to put into a single framework. MC is a one-stop shop controller for the whole translator (hence the event streucture), and another VI - say BG - is the one I use to take measurements. This is what I want to do

 

(1) Exexcute the initial steps using MC that I described above,

(2) translate up using MC (absolute position),

(3) take measurement with BG,

(4) translate down using MC (relative position), and

(5) take second measurement with BG.

 

This simple procedure is very tedious since I have to do it multiple times, switching between VI's; I just want to tell LabView to click the existing front panels instead of me.

0 Kudos
Message 8 of 9
(2,527 Views)

Also, do you mind describing how to use the property node function that you mentioned? 

0 Kudos
Message 9 of 9
(2,509 Views)