Hey everyone 🙂
I am working on a small "simple" automated Plant for my Study Project with a NI myDAQ. So basically i have a manual mode and a Automatic mode.
Both work fine as i want, but now i have the following Problem:
I can't switch to manual mode if the Cases with the timer are already running until they're done. Both Timers are marked in the Pictures below. Is there a Option wich allows me to abort the timer when he is still in process, when I press the Button "Handbetrieb"? Or even a more simple solution ?
I hope you guys get what i mean, and I'm looking forward for your Answers 🙂 Have a nice Weekend!
No. You can't.
What you can do is turn those timers into while loops with much shorter waits and use the Elapsed Time Express VI. Stop the loops once the time has elapsed OR when an abort condition that you are monitoring within the loop becomes true.
Don't call them "timers", these are "waits"! As you figured out, they stall the dataflow until they are completed. Waits are only useful if they are short. Longer waits have no business in any serious program.
You need to turn your program into a proper state machine. One state would be one that checks elapsed time and compares it with a threshold. One simple way to do poll elapsed times can be found in this example.
Some of the rest of your code could be simplified dramatically. For example you could use arrays of LEDs instead of all these individual LEDs and comparisons. Have a look at this example, 90% less code!. (Since you want multiple colors, you could use a cluster of LEDs and convert the array to a cluster before display. You could also use an array of colorboxes.)
Since you want multiple colors, you could use a cluster of LEDs and convert the array to a cluster before display.
Here is a simple example for that. Also used the advanced format of a simple numeric indicator. No need for strings!
Hey RavensFan and Altenbach
Thank you for your Replies. Perfect, i will implement your Solution in my Project, wich safes so much space 🙂 I really appreciate your help!
Have a nice evening