09-27-2022 03:20 PM
My block diagram has two loops. The mechanical action of the "start" button in Loop 1 is "Latch when released" and I want to keep it that way.
Below is what I am trying to accomplish:
Initially, I want the start button and the case structure in loop 2 to be false. When I press the start button, I want to pass only the true data to case structure in loop 2. So after pressing start button, I want the case structure to be true for the whole time.
I've been having hard time accomplishing it. I have attached my code.
I know this can be accomplished with just one loop, but I want to accomplish this with 2 while loops.
Can someone please help?
I have attached my code.
09-27-2022 03:48 PM
@GRCK5000 wrote:
My block diagram has two loops. The mechanical action of the "start" button in Loop 1 is "Latch when released" and I want to keep it that way.
Initially, I want the start button and the case structure in loop 2 to be false. When I press the start button, I want to pass only the true data to case structure in loop 2. So after pressing start button, I want the case structure to be true for the whole time.
I've been having hard time accomplishing it. I have attached my code.
I know this can be accomplished with just one loop, but I want to accomplish this with 2 while loops.
Can someone please help?
I have attached my code.
Have you learned about Boolean Controls? Do you understand what "Mechanical Action" means? Go to LabVIEW Help and see what the latching Mechanical Action means and does. You will have to "give up" either keeping the Start Button as "Latch when Released" or having the Start Button value "stay True".
Bob Schor
09-27-2022 03:48 PM
First, I would recommend using an event structure in your first loop. Your method is very kludgy. Also, I would generally use some form of messaging to provide input to the second loop. If this was solely to delay the start of the second loop until some event happened I would consider using a notifier. Though the channel wire is basically acting in the same manner. Any way, here is a basic improvement using an event structure in the first loop.
09-27-2022 03:56 PM
I can't see your VI due to the fact that I am running LV2018, however what Mark says comes off as the most logical answer without seeing the code up close. Could you post a picture of the code as weel for those of us not able to run the newer LV?
Blog for (mostly LabVIEW) programmers: Tips And Tricks
09-27-2022 04:12 PM
While I proposed the solution below this would not be the manner that I would approach this problem myself. I see no compelling reason to separate these tasks and would probably combine them into a single state machine. Or, if the parallel task truly needed to be done separately I would have the main control task (state machine) dynamically start the task at the appropriate time.
Original code posted:
My proposed changes:
09-27-2022 04:32 PM - edited 09-27-2022 04:33 PM
Can you give more information on what you are trying to accomplish at a higher level?
Because what you have here does not make a lot of sense by itself. But it looks a lot like the beginning of a Channel Message Handler (CMH) architecture. If that is your intent I am big fan for CMH and can offer some advice that will make this work and scale a lot better.
For instance you are using Channel Wire to send one Boolean (Start Test) and a Local Variable to send another Boolean (Stop) to the same loop
If your Channel Wire was a different type you could send both Booleans or any other data type you need to send.
09-28-2022 09:57 AM
@GRCK5000 wrote:
I know this can be accomplished with just one loop, but I want to accomplish this with 2 while loops.
.
As a first step, explain what "this" is. It is not clear at all. Can you show us the one loop solution so we maybe get an idea.
09-28-2022 10:10 AM
@GRCK5000 wrote:
Initially, I want the start button and the case structure in loop 2 to be false. When I press the start button, I want to pass only the true data to case structure in loop 2. So after pressing start button, I want the case structure to be true for the whole time.
.
We need a full state diagram: