LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

event structure stops working

I'm using an event structure to trigger a subvi and monotor button presses. The sub-vi update displays on the main vi. After two executions the event structure stops working freezing the buttions on my vi. Any sugguestions to fix this.

0 Kudos
Message 1 of 6
(2,442 Views)

Your problem is that you have another event structure inside the subVI. Which leads me to ask: Why do you have another event structure in the subVI?

0 Kudos
Message 2 of 6
(2,436 Views)

To capture button presses from the main vi.

This is just a smaller example of my main application.

I have a main test screen that's presented to the operator. Showing analog values and test status. But all the real action takes place in sub-vi's. I need to be able to break out of timing loops in the sub-vi if the operator presses the "Abort Test" button on the main vi.

But when the sub-vi is running it's the active VI so the bottons on the main VI don't work so well without using the Register for Event's structure in the subvi.

0 Kudos
Message 3 of 6
(2,429 Views)

I would recommend having another loop to launch the subVI.  That way your main VI's event structure can still handle all of the events.  And further, I would use a queue or notifier to have the main VI tell the subVI to exit.  Weird things can happen when multiple event structures are used.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(2,410 Views)

If you want the sub-vi to update the main vi's indicator: Send the indicator ref instead. 

 

A better solution is to create a user event which you listen to in your main vi which updates the indicator and which can fire in the sub-vi.

With this solution you send the user event ref as input to the sub-vi.

To not lock your main vi, you can start it through vi server or let it run as a separate loop.

 

The latter is better and you can add user events for start and stop.

 

/Y 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 6
(2,404 Views)

@mikeb alias wrote:

To capture button presses from the main vi.

This is just a smaller example of my main application.

I have a main test screen that's presented to the operator. Showing analog values and test status. But all the real action takes place in sub-vi's. I need to be able to break out of timing loops in the sub-vi if the operator presses the "Abort Test" button on the main vi.

But when the sub-vi is running it's the active VI so the bottons on the main VI don't work so well without using the Register for Event's structure in the subvi.


You need to change your architecture, as the way you have it now is wrong. You should not have multiple event structures active. If the subVIs will take a long time to run, or are supposed to run all the time, then they need to be running in parallel to the main loop or they need to be launched with the VI server. This will allow the main VI to remain responsive for the user interface. As for stopping the subVIs there are myriad ways of doing this. When you press a "stop" or "abort" button on the main VI you just need to send a message to the subVIs. This can be done via a queue, for example.

0 Kudos
Message 6 of 6
(2,393 Views)