01-17-2012 05:46 AM
Hi all,
My target is to realize an application to acquire data from 2 serial port at the same time.
My project originally was designed to acquire data only from 1 serial port and now i'm adapting it to perform the same task on 2 serial ports.
I've created in the main VI a simple copy of a while loop that acquire data from serial port and display results in user interface, so now there are start and stop buttons for both loops.
While loops have inside an event structure to respond to user action on the UI.
If i make start only on the original while loop only there are no problems, i can start and stop and UI is always reactive,
but if i launch only the 2nd (the copy), the UI becomes unresponsive a i cannot do anything.
In attachment there the VI i'm working on.
Thanks in advance for the help.
01-17-2012 07:10 AM
You are running into the very basic caveats regarding usage of event structures.
Rule of Thumb: Do not use different event structures for a single event source (your UI in this case).
hope this helps,
Norbert
01-17-2012 07:28 AM
@Norbert B wrote:
You are running into the very basic caveats regarding usage of event structures.
Rule of Thumb: Do not use different event structures for a single event source (your UI in this case).
hope this helps,
Norbert
I can not open the example submitted but I do that regularly and it works fine.
Example:
Stop button
Main loop and background process all are interested in that info.
Using alternate patterns would increase the coupling between components. High coupling between widgets reduces reuse potential.
The "Docking" example I posted here create mutliple background threads all registering for the same events.
If I followed that rule as you have expressed it I would have to integrate some form of producer-consumer, master-slave architecture that would put additional constraints on the GUI loop to pass the "Stop Button" to an arbitrary number of clients.
So...
What were you really trying to tell us becuase I don't think that "one Event to rule them all and in the complexity bind us" is what you were really trying to say.
Ben
01-17-2012 07:30 AM
This page talks about an "undo operation" that can be performed on a latched boolean control:
http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/latchbooleanevent/
It says:
When you perform an undo operation on a Boolean control configured with a latching mechanical action, the Event structure handles the undo operation as a value change event, which might return unexpected results. You must use a Case structure within the event case for the undo operation to work correctly. Use the TRUE case of the Case structure to specify how you want to handle the Boolean control and the FALSE case to specify how you want to handle the undo operation.
I'm sure I'm missing something really obvious, but how do you perform an undo operation on a boolean control?
01-17-2012 08:06 AM
Ben,
i stated it as "rule of thumb", not as "requirement". I know that more advanced users share sources of events all over a single application, but this requires the developer to be aware of what he is doing. And it is still not a broadly used design pattern due to it's restraints and complexity (at least as far as i know).
Experience shows, that many developer don't know enough about the caveats of the event structures hence leading to issues/questions like this here.
So what i was up to: In order to reduce complexity for beginners, the producer/consumer design pattern is the way to start. Not with parallel running event structures.....
hope this clears things up,
Norbert
01-17-2012 09:18 AM
Hello,
Thanks to all, it seems i have simply forgot to uncheck "lock front panel" in the edit events properties on the start button related to 2nd while loop, despite i remembered that i've already done this
Now it works but i have to lool at your sample codes too, thanks!