03-19-2018 05:38 PM
Here's how it works (or how it should work)
I am desperately seeking any solution which doesn't eliminate my UDP functionality. Any help is appreciated. I also added my VI if you need it.
Solved! Go to Solution.
03-19-2018 05:51 PM - edited 03-19-2018 05:58 PM
You should not have interactive loops inside event cases. Events are (by default) configured to "lock the front panel until the event completes" but your event cannot complete until a button is pressed or an error occurs. You cannot press a button if the panel is locked: Deadlock! What's the purpose of the greedy loop in the upper left?
Why are there so many loops within loops within loops? Think state machine instead.
An event structure should never be inside a case structure.
Most of your loops cannot be stopped.
There are probably better ways to parse a string than using a matlab script.
You really should take a few more tutorials and re-think the entire code architecture from scratch.
Also please attach the actual VI instead of a picture to get more specific advice. We cannot see what's in the other cases. We cannot see how the events are configured. We cannot tell the mechanical action of the buttons, etc.
03-19-2018 08:29 PM
There are two infinite while loops in that case. Why would it ever stop?
03-20-2018 10:16 AM
The infinite while loops were done on purpose because I don't have a need to exit those loops at this point.
This is the structure -
I'm no professional labview programmer, so if anyone thinks I can do this in a simpler way which wouldn't disrupt my UDP command structure, please let me know.
03-20-2018 10:46 AM
I appreciate your feedback. I'll start to rethink my architecture given that I have only a few months of experience with Labview.
In any case, removing the "lock until event finishes" checkbox in the event handler details did the trick. now I can record without issue, and then exit the loop by hitting 'y'
03-20-2018 11:07 AM
@rodrigonramon wrote:
- While loop to check for buttons (indefinitely)
This is a complete misunderstanding. These buttons are not even connected to anything and you "read" the button state with event structures. These terminals could be anywhere. Only If they are latch action (and I guess they are), they belong inside their respective event case so they reset once the event fires and the terminal is read by the code. You should be aware that your current small loop runs as fast as the CPU allows and will saturate one CPU core 100%.
LabVIEW ships with some good templates. I am sure one is suitable for your problem.