09-26-2007 12:12 AM
09-26-2007 12:39 AM - edited 09-26-2007 12:39 AM
Well, you should read the diagram comment. True, if this is a built application that is set to run when opened, the state of all controls is clear and at the controls will be at good default values as configured.
In a development environment, the user can set the two controls to any arbitrary value and they will only be consistent once one them is changed the first time. Running the timeout code once when the program starts makes sure that control for the motion distance corresponds to the value of the velocity. After that, we only need to update whne one of the controls change, so we can set the timeout to infinite (-1).
Actually, you should add a constant of zero to the right shift register (just right-click the shift register and select "create constant"). See image.
Now it is guaranteed that the loop spins the timeout case once whenever the program starts to make sure the distance control contains a value calculated from the velocity setting, whatever it might be. In all later iterations, the timeout is inactive.
You can see what the problem is if the timeout case is absent. Temporarily change the constant to -1, slide the "motion distance" to zero, then run the VI. Now repeat with the diagram constant set to zero. Much better. 🙂
Message Edited by altenbach on 09-25-2007 10:42 PM