05-07-2012 07:38 AM
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.
05-07-2012 08:01 AM
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?
05-07-2012 08:16 AM
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.
05-07-2012 10:40 AM
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.
05-07-2012 10:56 AM
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
05-07-2012 01:17 PM
@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.