08-31-2023 12:10 AM
Hello
I'm trying to use the same control in 3 different tabs, after surfing in the internet i find out that best thing is to use a Event Structure, so i did it and it worked.
But now i have 2 other issues, the .VI only run once every time a press a buttom. I need that event, from the buttom actioned, to run continously, this is my main problem. I know that the loop freezes and it waits for event structure for an action, i dont know how to fix this.
Also, another small issues that i find out is that when a press the buttoms too fast, i mean +/-, the vi starts to run slowly, i think it is something with the queue in the event case but i'm not sure.
Thank you
Solved! Go to Solution.
08-31-2023 12:56 AM
You can use the timeout case of the event structure (instead of the 500ms wait outside the event structure).
But then the code still wouldn't make any sense. What is it that you want to happen with each iteration?
08-31-2023 02:36 AM
@FCance wrote:
I know that the loop freezes and it waits for event structure for an action, i dont know how to fix this.
Don't have them in the same loop ...
08-31-2023 03:19 AM - edited 08-31-2023 03:20 AM
Hi FCance,
your VI should look more like this:
(There also is an event for the stop button, in the timeout event your iteration counter is updated…)
@FCance wrote:
I'm trying to use the same control in 3 different tabs, after surfing in the internet i find out that best thing is to use a Event Structure, so i did it and it worked.
Which "control" do you want to use "in 3 different tabs"?
There is no tab container and there is no control used three times…
08-31-2023 03:35 AM - edited 08-31-2023 03:38 AM
@FCance wrote:
Also, another small issues that i find out is that when a press the buttoms too fast, i mean +/-, the vi starts to run slowly, i think it is something with the queue in the event case but i'm not sure.
Faster than the 500 ms loop time? Why is there a loop timer at all? Like the others suggest, use the timeout of the structure with, let's say, 5 ms or 10 ms so it can react quickly to button presses. In the timeout case you could put some code and if that code shall only run, like, every 500 ms, then use a counter that counts the 5 ms timeouts to 100, then run the code and reset the counter.
Regarding your "once I press a button I want the code to start and run permanently", you could also do this with a boolean flag. Button ORed with flag -> first button press goes into case -> inside the case set flag to 1 -> next time case is executed automatically.
08-31-2023 07:26 AM
I tried that but for some reason the 2nd loop doesnt work, the data doesnt come out from the first loop.
08-31-2023 07:36 AM
Hi Gerd, this what i mean with "same control in 3 differents tabs"
I tried your code it worked but it only cut data there is a point where i run out of data and the vi send error.
08-31-2023 08:03 AM - edited 08-31-2023 08:06 AM
The way LAbVIEW works, the second loop will run only when the input is available, and for that to happen the first loop has to stop.
08-31-2023 08:15 AM
Using tab control you need o add it to the event structure
the event will be triggered when tab control changes in addition to all the others.
08-31-2023 08:17 AM
why do you need it to run continuously ? is this coming from data bein acquired ? In your file it will change only if one of the inputs (duration/start time) change.