10-17-2017 11:59 AM
This is my VI. I want my while loop stops after a certain amount of time. I created a shift register to see how many times the loop was running. the problem is if i enter for example 1 second, it shows a value . Then if i stop my program and run it again with 1 second this shift register value is different. even when i close my program, reopen ,run and enter 1 second the shift register is different. what am i doing wrong?
Solved! Go to Solution.
10-17-2017 12:09 PM - edited 10-17-2017 12:09 PM
Start with a few simple LabVIEW tutorials....
10-17-2017 12:43 PM
thank you for your suggestion. I added a wait function for 50 m/s and initialized my shift register. however, the problem still exists. also, I have to every time stop the program and enter a new value for how long control. if i just enter a new value and hit run it only run the loop once
10-17-2017 12:50 PM
You only mentioned two out of my three suggestions. What happened to the remaining? Also look at the express dialog.
50 m/s is a speed, not a wait. (Meters per second). What did you add and where?
Whenever you trap the code inside inner loops, a simple state machine architecture is probably a better choice.
10-17-2017 01:53 PM
sorry my apologies. I created this VI and initialized. I don't know how to initialize the loop . is there a tutorial available for state machine with shift register?
10-17-2017 01:58 PM
Sorry I meant 50 mili second. This is my vi
10-17-2017 02:47 PM
10-17-2017 02:56 PM - edited 10-17-2017 02:56 PM
unfortunately I don't know how to reset the express VI whenever i=0 on the inner loop or stop my vi when inner loop is running. can you please kindly tell me how to do it
10-17-2017 03:15 PM
You have the iteration terminal of the inner loop, so wire an =0 to it and wire the output to the express VI. Right?
As I said, things would be much simpler without stacked loops. They key word is "state machine".
10-17-2017 03:43 PM
you are talking about the i in while loop? you can't wire anything to it except an indicator [ not constant 0.