LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with OK Buttons

Take a look at this program and let me know if it does what you want it to do.  You may have to relink the State Enum.ctl.

 

Regards

Download All
Message 11 of 15
(742 Views)
Hi jmcbee.

Thanks for your great help. You program works wonderfully. I now gain a control over start/stop buttons. The state machine code you gave is easy to follow too. 🙂

However, the problem is still there. I tried to cooperate your program with part of my main program, and it does not work as I want.

Please see attached gif file - 2ndAttempt.gif. The commment is in there.
Thanks again!

P.S. I also have the same problem where the loop does not iterate pass i=1. See attachment - 1stAttempt.
Download All
0 Kudos
Message 12 of 15
(728 Views)

On  1st attempt.

 

1.  Writing a new value to a local variable does not generate an event that the event structure can detect.  It only detects button presses, or writing a value to the property node Val(Signalling).

2.  Your inner while loop containing the event structure never stops because you have a False wired to the stop terminal.  Thus the subVI will never execute because it will be waiting for its inputs to come from the inner while loop that never ends unless you abort the VI.

 

On 2nd attempt.

 I suspect something about your subVI.  You say the right loop only executes once.  What is happening in the subVI?  Does it ever end so that the code inside the loop can complete then begin its next iteration?

 

Overall, I suspect you don't quite get the concept of dataflow.  Code won't execute until all of the inputs going to it are available.  A loop won't end until all of the code inside of it has executed.

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours
0 Kudos
Message 13 of 15
(722 Views)
Hi Ravens Fan

Thanks for the help. 

On 1st attempt,

I included a local variable called "Update?", and hope that any change to this value will trigger the condition of event structure (value change). Once the "Update?" value changes, should the event structure update/read the two variables, Move to A and Move to B?

I tried to put the event structure outside the while loop and wire those variables to my subVI. The problem is that my subVI does not read any incoming value change either. Is there anyway to setup the while loop to read updated parameters (from somewhere else) everytime it starts a new iteration? Shift register?


On 2nd attempt,

I also tried to connect the wire directly from the left loop to the right one. My problem is that I want the data to keep flowing out from the loop when the execution does not actually stop yet, says

The left loop keeps sending either "Move to A" or "Move to B", and the right loop accepts the value changes and supplies these values to my subVI.

I'm not sure whether my subVI #9 ends everytime the loop goes one iteration or not, but it definitely waits for the next input from OK buttons. If any OK button wired to that subVI changes, the subVI #9 does the job.


In the meantime I will look over the tutorials you linked to me.
Data flow is hard. 😞
Thanks!
0 Kudos
Message 14 of 15
(714 Views)

aeroomega-

 

          Are you still having issues with your code? The examples posted by jmcbee appeared to be what you needed. Data flow is difficult to grasp at first but once you get it down, it's really easy. I always think of it as text-based. You can use something unless you declare it (initialization) and you can't make things function together unless you tell them too (wiring).

0 Kudos
Message 15 of 15
(700 Views)