LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pass Events from main vi to sub vis in sequence

Hi,
 
I'm new to Labview and im using Labview 7.1. I have a problem in passing events from main VI to sub VIs in sequence. I have a requirement where in if I press a button in main window, I want the event to be passed to subv VIs in sequence. Say if I press START button in main VI, I want sub VI 1 to be executed first, followed by sub VI 2 using the same event passed from main. Currently I'm able to achieve this by pressing the button twice. One for first sub VI and another for second VI. I have attached vi for my requirement, modifying the one which was available in the forum for passing events from main to sub.  Could you help me out where I went wrong / if this is possible?
 
Regards,
Hema
0 Kudos
Message 1 of 5
(3,001 Views)
Hi Hema,

why do you want to register events in those subvi's?
Just run the subvi's when the user presses the button...

Message Edited by GerdW on 01-25-2007 02:53 PM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,989 Views)
Hi GerdW,
 
Thanks for your reply. Probably I wasnt clear. My intention is when I press Button ON/OFF in main VI, it should turn on button in the sub VI 1 first, followed by sub VI 2. I'm using Flat sequence to set the priority for sub VI 1 and then sub VI 2. If we do not Register events or pass by Refnum, sub VIs do not know event has occurred. From your reply I understand that sub VIs will run sequentially but will not run based on event in main.
 
Regards,
Hema
0 Kudos
Message 3 of 5
(2,980 Views)
Hi Hema,

they run based on event in main vi! In my opinion you don't need additional buttons in the sub-vi.
You should maybe redesign your project. IMHO a subvi shouldn't wait for an event of the main vi. Subvi's should do some work and exit on its own after work. When a subvi needs a stop signal I usually use an global variable which is set in the main vi and only polled in the subvi.

To make my idea more clear:
Put the event structure in your main vi. Check for "button change"-event. When user presses button you just call sub1 followed by sub2 (you can do this inside the event structure).
See attachment - some changes are made. BUT: I would not recommend such programming!

For processing order of your subvi's you can use the flat sequence - it's ok. It would be much better if you would use some sort of data dependency - easiest is to use an error cluster in/out in every subvi. Please read the manual on this topic!


Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 5
(2,973 Views)
Hi GerdW,
 
Thanks for your reply. It was very useful. Thanks for your time.
 
Regards,
Hema
Message 5 of 5
(2,961 Views)