cancel
Showing results for 
Search instead for 
Did you mean: 

Controls not being read inside while loop, that is inside an event case

SOLVED
MikeMack747
Member
Solved!

Controls not being read inside while loop, that is inside an event case

Message contains an attachment

I've encountered a situation with an embedded while loop not functioning as expected once it is placed inside an event case. The Stop and Exit buttons seem disabled. I've tried adding those buttons to the same event case; "Start", but that had no effect.

7 REPLIES 7
GerdW
Knight of NI

Re: Controls not being read inside while loop, that is inside an event case

Hi Mike,

 

simple solution: don't place while loops inside event cases!

 

Event cases should be executed as fast as possible, and so avoid blocking other events...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Highlighted
MikeMack747
Member

Re: Controls not being read inside while loop, that is inside an event case

So, the while loop is there to allow an operation reading incoming data from an instrument under test.

The while loop is waiting for settling of the reading with a threshold level of standard deviation.

A timeout or user input of "Stop" are alternate ways out of this loop.

This method is not possible within an event case?  Why not?

 

 

crossrulz
Knight of NI
Solution

Re: Controls not being read inside while loop, that is inside an event case

You have the "Lock panel until the event case completes" turned on.  Which means, you press the Start button and you cannot interact with the front panel until the case is done, including the inner loop.

 

Generally speaking, you should not have "long" things happen inside of an Event Structure, such as loops.  Use another loop or a state machine (the state machine is to include the Event Structure, not inside of the event case) to handle the reactions.



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
MikeMack747
Member

Re: Controls not being read inside while loop, that is inside an event case

How do I unlock the front panel?

MikeMack747
Member

Re: Controls not being read inside while loop, that is inside an event case

I found it, I went to "Edit Events Handled by this Case" and unchecked the "Lock panel" box.

 

Thank you Gerd!

billko
Proven Zealot

Re: Controls not being read inside while loop, that is inside an event case


@MikeMack747 wrote:

I found it, I went to "Edit Events Handled by this Case" and unchecked the "Lock panel" box.

 

Thank you Gerd!


FYI - generally speaking, a well-written LV application doesn't care if the front panel is locked or not because nothing in the event structure will take so long that locking the front panel matters.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
MikeMack747
Member

Re: Controls not being read inside while loop, that is inside an event case

I agree, this event should trigger and data producing, and a consuming loop operating in parallel to the event.

This is not my code, it came from my coworker who now shall lose a bet