LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Weird Bug

Solved!
Go to solution

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

 

0 Kudos
Message 1 of 8
(2,887 Views)
Solution
Accepted by topic author IDILIO

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

Message 2 of 8
(2,881 Views)

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

0 Kudos
Message 3 of 8
(2,868 Views)

Obviously you are running into caveats of the event structure.

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 8
(2,862 Views)

@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...

0 Kudos
Message 5 of 8
(2,838 Views)

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 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 8
(2,831 Views)

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.

Message 7 of 8
(2,828 Views)

Clarified!

Thanks for yours answers.

0 Kudos
Message 8 of 8
(2,822 Views)