03-09-2020 02:46 AM
Hi!
I am new to LabView, so I am hoping, that I can find some help here!
I have developped a User Interface. While testing it, I noticed a bug, namely:
while the command prompt is logging or a countdown is still in progress, I cannot seem to press any button, which might bring my system in a state which is not safe.
I am using sequential structure and events. I read about the problem and apparently one option is to deselect the lock front panel option from the event properties, however I am not sure if this is a good idea. I also looked into asynchronous processing of the VIs, but it also did not work. Does someone have an idea how it can be done?
Thanks, Mirela
Solved! Go to Solution.
03-09-2020 03:25 AM
Hi mirelche,
@mirelche wrote:
while the command prompt is logging or a countdown is still in progress, I cannot seem to press any button, which might bring my system in a state which is not safe.
I am using sequential structure and events.
Using sequences might be the problem. (Usually you don't need sequences at all when you THINK DATAFLOW!)
Using event structures together with sequences most often also leads to problems.
So my conclusion is: it's your programming style which is responsible for the problems you see.
For more detailed analysis you need to attach your VI(s)…
03-09-2020 03:48 AM
Hi, GerdW!
Thank you for the quick response! I am very new to LabView, so it is possible that it is my programming as well, so I did this small VI which takes a countdown and has a stop button. Here, I have the same problem that I cannot press the stop button at all while the countdown is in progress. I am attaching it and I hope that I can find some help.
Thanks!
03-09-2020 04:01 AM
I am still using LV 2017, not able to view your code.
Will be helpful if you can down convert and share.
Since you mentioned you are new to LabVIEW please do go through LabVIEW Design Patterns (Master Slave/Producer Consumer) which will solve your problem of continuous acquisition as well respond to user actions.
03-09-2020 04:08 AM
03-09-2020 04:14 AM
Hi, everyone!
Here I am attaching my code in Labview 2017.
Best regards
03-09-2020 04:18 AM - edited 03-09-2020 04:21 AM
Hi Mirela,
did you read the LabVIEW help on the event structure? Did you read the "Caveats" when using the event structure?
General rule: an event case should be executed as fast as possible.
Your "OK button" event starts a countdown loop executing NOT "as fast as possible", but instead blocking the outer while loop. As long as the outer while loop is blocked you cannot handle any other events!
Place the countdown code inside the Timeout event (without that inner while loop) or use a parallel running loop so your event handler loop will not be blocked!
Generic advice:
03-09-2020 04:35 AM
Hi,
thank you for the quick response! However, i do not want to place my countdown loop in the timeout, as i want it to be executed only when I press the start button. Can you be more specific about the parallel running loop? Where should i place it?
Thanks!
03-09-2020 04:47 AM
Hi Mirela,
@mirelche wrote:
However, i do not want to place my countdown loop in the timeout, as i want it to be executed only when I press the start button. Can you be more specific about the parallel running loop? Where should i place it?
This is a silly explanation for not wanting to use the TimeOut event. See attachment…
03-09-2020 05:05 AM
@GerdW wrote:
Generic advice:
- Buttons should be placed inside their event case so they will be "visually processed" - this is important for latching buttons!
- No need for a "boolean" local variable when the "boolean" terminal is unused!
- This "IF x<0 THEN 0 ELSE x" can be replaced by the MinMax function with zero…
And do the future-you a favor, and learn to straighten those wires.
This might be a bit annoying right now, but once you developed a bad habit, it will be near impossible to correct.
Bugs hide in messy code...