07-24-2012 05:15 AM
Please look at the attached vi.
When I run the vi with Choose control true everything is ok (you press Boolean control and Boolean 2 Indicator changes state), but when I run the vi with Choose control false the vi completly freezes and nothing works (its impossible to press Boolean control and nothing changes). This is crazy because the False case has no code at all.
If I replace the Choose control with a false constant for the case selector everything runs ok.
If I remove the code from inside the true case when running the the vi with Choose control value of false (so the case false is executed and no the true case) everything runs ok.
This is very weird...
Is someone aware of this? Do you have any ideia why this happened? Workarounds?
Note that I running Labview 8.2.1
Solved! Go to Solution.
07-24-2012 05:35 AM - edited 07-24-2012 05:36 AM
You can make this diagram 'work' by deselecting the Lock Front Panel on the 'Edit Events' dialog for the 'Test - Value change' event case. See attached
Even though the event structure is apparantly not executed it still proceses the Val Signalling from the first event structure and locks the front panel until it is processed - which it never gets to because it is in the case structure!
BTW,I don't know what you are trying to do here but I would never have 2 seperate event structures in my block diagram especially one inside a case structure.
Ken
07-24-2012 05:56 AM
Thanks Ken Naylor.
I was not aware of this behavior of the events.
Anyway it doesn't make sense for me....but...ok...easy solution
07-24-2012 06:11 AM
Obviously you are running into caveats of the event structure.
Norbert
07-24-2012 08:55 AM
@Norbert_B wrote:
Obviously you are running into caveats of the event structure.
Norbert
Obviously yes.
But nothing is mentioned in that help link about the use of event structure inside a case structure. And is not obviously that an event structure inside a case that is never executed is wating for the event on the same way.... ok, ok, after a deep read we can suspect/guess that...
Anyway is not understandable why when the case selector is a constant it works, but not with a control or output of some sub-vi...
07-24-2012 09:00 AM
IDILIO wrote:[..]Anyway is not understandable why when the case selector is a constant it works, but not with a control or output of some sub-vi...
If the constant is set to a case NOT containing the event structure, the LV compiler removes the event structure as unused code from the compiled code. So the executable code does not even contain the event structure!
If the case structure is fed by a control (or the constant does point to the case containing the event structure), this optimization cannot take place; hence you are running into the issue.
Norbert
07-24-2012 09:02 AM
With newer versions of LabVIEW, if the case structure is a constant, then the compiler will remove the portions of code that it know will never execute. Thus the event structure in the other case is removed and is now not capturing events. If the selector is based on a control, the compiler has no way of knowing which of the two cases, or both, will ever execute, so it must compile both event cases. Since the event structure is in the one case, it is present and will capture events, and thus lock up the front panel if the event case is set that way.
07-24-2012 09:06 AM
Clarified!
Thanks for yours answers.