LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

user event or event structure time-out

Jörn,

 

Good explanation.  🙂

I would not recommend using an Event Structure with timeout in any sub-vi.  It is not an appropriate coding method.

There is only the need for a single Event Structure in the main VI (loop). 

Queues are very useful to pass messages & data to a consumer loop / sub-vi, etc.

 

R

0 Kudos
Message 11 of 18
(853 Views)

Hi,

 

Still exploring this. So how do i use a queue structure, enqueued by the primary VI to stop a secondary VI if the secondary VI has  an event structure (time out of -1)?

 

-assuming using the 'Abort' node remotely from the primary VI is not a great idea (?).

 

This seems relatively straight forward with user events, but i have not managed to work out how to do it using a queue structure. 

 

Jörn, 

'what you are describing is best performed using queues instead of an event structure. The event structure in one of the sub VI might be waiting for an event which does not occur and thus block the whole application. '

 

Sorry Jörn, i don't follow this statement, surely the use of the event structure is that it triggers when the event occurs, -the non-occurrence of an event is just the normal (i.e. just waiting for an event) state of the VI? Or are you saying the event structure is not reliable, and events that do occur may not be acted on by the event structure?

 

 

Ray,

'I would not recommend using an Event Structure with timeout in any sub-vi.  It is not an appropriate coding method.'

 

Can you explain why it is not an appropriate coding method?  It is not what i have implemented in the trial application i am doing at the moment, but i am interested. Indeed, the reason for my initial post was to avoid using the 'time out' feature of the event structure.

 

Thanks,

 

Blue 

0 Kudos
Message 12 of 18
(835 Views)

Still exploring this. So how do i use a queue structure, enqueued by the primary VI to stop a secondary VI if the secondary VI has  an event structure (time out of -1)?

 

Use the  'Value (signalling)' property node... 

0 Kudos
Message 13 of 18
(831 Views)

It is a mis-use of an EVent Structure to force an iteration by timing out.  There are better mechanism than an Event Structure for this.  If you do plan to use an Event Structure in a sub-vi along with one in the main vi, then your program may face a conflict to detect events.  That means if your sub-vi is running, your main vi may (will) not detect events, such as terminating the application.

 

I had an example of what you are looking for on the forum.  I will look for it or create a new example.

 

R

0 Kudos
Message 14 of 18
(822 Views)

Thanks Ray, once i have finished my queued example i will post that for a critique.  :smileysurprised:

 

Blue 

0 Kudos
Message 15 of 18
(817 Views)

Cool.  That's the best way to learn.

 

🙂

0 Kudos
Message 16 of 18
(811 Views)

wow, where did that week go...

 

Attached is a zipped llb with two examples, one using user events and one using a queue structure.

Both offer the same user functionality. (xp, 8.6)

 

The main objective is to be able to co-ordinate and pass control values between a number of VIs which are not necessarily wired.  

 

Comments on the suitability of either approach would be welcome. The only real appeal of the event structure approach is it seems to use/require less coding, particularly in the secondary VI (though maybe this is illusory). The queued example is obviously has more scope, but is it overkill for handling simple GUI interactions?

 

One of my aims was to avoid using the time-out function of the event structure, which both examples achieve (i.e. no continual looping). 

 

I think i have talked myself/been talked in to the queued structure, but i just have a feeling there may be a simpler way? 

 

Comments on general structure/error handling (?) also appreciated.  :smileysurprised:

 

Cheers,

 

Blue 

0 Kudos
Message 17 of 18
(761 Views)

BlueTwo wrote:

wow, where did that week go...

 


I know exactly what you mean.  I wondered where the month went.. 😮

 

I just logged in and saw you post.  I will (try to) look at it tomorrow.

 

🙂

0 Kudos
Message 18 of 18
(748 Views)