01-15-2018 07:07 AM
It is an example of running a stepper motor. In the attached VI, after I press run button VI starts. Motor starts moving after I press the "START" button given in the front panel. But I want to stop the whole program after the value in the "CURRENT POSITION" equals the value given in the "DESTINATION POSITION" control. Please tell me how to do it?.
I am attaching the VI.
Solved! Go to Solution.
01-15-2018 07:26 AM
1. You really should have an event for your Quit button. A simple Boolean out of the structure to tell the loop to stop.
2. In your timeout case, you can add simple logic and use the same tunnel as 1) to tell the loop to stop.
01-15-2018 07:37 AM
Hi canzie,
I want to stop the whole program after the value in the "CURRENT POSITION" equals the value given in the "DESTINATION POSITION" control. Please tell me how to do it?.
So you want to compare "current position" with "destination position" and use the result of this comparison to stop your while loop?
Why don't you program it exactly this way?
Use a comparison and wire the result to the stop condition terminal…
01-17-2018 06:06 AM
Thank you for your valuable suggestion.
I worked on it, but there is an issue.value in the 'CURRENT POSITION' is only changed until I press the 'START' button and after that whole program is stopped.
I want to do it without any manual control.
01-17-2018 06:45 AM - edited 01-17-2018 06:46 AM
you might want to check whether your "Start (uSMC).vi" returns an error on pressing the "start" button, drop a probe (right mouse on the error out wire).
edit: or perhaps you get into an infinite loop inside the "Start (uSMC).vi", so you never get to the next "Timeout" event case
regards
01-18-2018 06:59 AM
Thank you for your valuable suggestion.
I worked on it, but there is an issue.value in the 'CURRENT POSITION' is only changed until I press the 'START' button and after that whole program is stopped.
I want to do it without any manual control.
I tried it, but unable to do it. please help me. I am attaching the picture of the program.
01-18-2018 07:38 AM
attach your vi not pictures plz
clean up your vi:
don't have cables under things, don't have cables going the wrong way, don't overlap stuff
get rid of sequence structure (use only if you cannot guarantee execution order with cables)
how does your "start smc" vi react to incoming errors?
do you really need a global variable?
example:
note that the image above is a snippet, which can be dropped onto a block diagram,
you can create this yourself by going to "Edit" -> "Create Snippet from Selection"
01-18-2018 07:48 AM
I have attached VI in my first post