LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

add event in event structure



Norbert B wrote:
[Edit] You should not include other loops into events if the loops depend on useraction. Please read Gerds posts carefully regarding this "issue".

But the thing is,  I need the process to keep going on. Actually my bad, till now I was using temporary subvis in the event structure. My actual subvis I need to use are attached. So I am testing multiple units at one go. And I need the process to keep continuing in a loop.
The Tstat_demo VI is used as a subvi in Mux_try_demo, which in turn will be used as a subvi in an event in the events VI>
Also the other events will be similar. Only the tsta_subvi's will be slightly different in them. So thats is my problem. Any thoughts?
Download All
0 Kudos
Message 21 of 42
(1,487 Views)
Without looking into your code, i would suggest you to use another architecture for your main application.
The three button example you previously posted is called "User Interface Event Handler". This one is NOT designed to execute something in parallel (okok, i am generalizing here maybe in an improper way, but for starters, please take it like that!).
The architecture, you might want to take a closer look at, is called "Producer/Consumer (Event)". It is implemented as a template. You can access it through the template browser which you can open by selecting File >> New.
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 22 of 42
(1,484 Views)

But isnt the producer-consumer architecture a queueing concept. I don't necessairly need every code to be executed one after the other. Only when the button is hit, it should execute.

Also if this is not true, what goes in the consumer loop and what goes in the producer loop?

0 Kudos
Message 23 of 42
(1,473 Views)

smm,

You can still use the event structure to accomplish what you are trying to do.  If I understand correctly, you want to be able to independently start VIs running in separate threads by clicking on the appropriate buttons.  The trick is that you need to call the subVIs dynamically (look up Run VI function which can be called on a VI using an invoke node).  If you execute the subVI using "Run VI" you can set an input parameter "Wait until done" to false in order to allow your event loop to continue processing your user's button clicks, etc.

If you need to be able to synchronize these threads, it is possible, but is definitely not "basic" LabVIEW - expect to read a lot of documentation to get up to speed.

Rob

0 Kudos
Message 24 of 42
(1,465 Views)
I tried reading up about your suggestion but I could not follow it too well. Could you may give me an example depicting what should be done and how this function is implemented
0 Kudos
Message 25 of 42
(1,452 Views)
Unfortunately, I don't really have the time to create an example specifically for your case - however, I have an existing VI I wrote that does something similar and also uses the Run VI function.  I'll attach it as an image file in case there are any versioning issues (I use LabVIEW 7.0).  The basic concept displayed in this VI can be used to accomplish what you want to do.  In your case, instead of making the call in the timeout event handler, you will have a call for each subVI you want to support in the associated button's click handler.
Hope that helps.
Rob
0 Kudos
Message 26 of 42
(1,443 Views)
can u tell me what the blocks in the event structure are. I'm using LV 8.5 so ifLV 7 vis open in 8.5, can u attach it please?
0 Kudos
Message 27 of 42
(1,433 Views)

I'm afraid attaching the VI won't be particularly useful, and since it is technically the property of the company I work for, I'm not even sure the legality of doing so.  In any case, there are numerous dependencies and most of it doesn't apply to your situation at all.  What you care about is all within the timeout event block.  And unless you need to pass parameters to your subVIs, you don't need the call to "Set Control Value" either.  Just use the "Open VI Reference" passing it the path to your subVI, and pass the resultant VI reference to an invoke node and select the "Run VI" method, passing in a false for the "Wait until done" parameter.  The stuff in the error handler just manually closes the reference and ignores error 1000 in case the subVI that I'm calling was still running from a previous call; you probably don't need it for prototyping purposes.

Anyway, good luck.  I'm sure there is documentation on how to use Run VI somewhere, though in a cursory investigation I must admit that I didn't find it.  Anyone out there want to point to some examples that might help?

Thanks,

Rob

Message 28 of 42
(1,430 Views)
 

Here

http://zone.ni.com/devzone/cda/epd/p/id/2144 

0 Kudos
Message 29 of 42
(1,422 Views)
That helped a lot. I think I did make some progess. Once I'm done with all of it, I'll repost my VI and ask you take a look if it's correct. Thanks for your help and I can totally understand you not being able to post ur VI. Thanks anyways Rob. That was some great help.
0 Kudos
Message 30 of 42
(1,412 Views)