08-19-2016 04:39 AM
Hi,
I am using a motor with encoder on its back. I can run the motor using the visa application and read the current and demand position of the encoder. Now i want to use this position as signal to stop the motor.
For example in case of any hurdle, the demand position will keep on changing as the motor was running but the encoder postion will not change. So the idea is to use a case structure to comparre the value of encoder over time and when there is no change in encoder position over time (say 10ms) it should stop the motor. But i am not sure how to implement that in labview.
Can someone put me in some diretion on how to achieve that. Thanks a lot.
08-19-2016 05:02 AM
Basic idea is to use Shift Register which has to hold current position as well as the postion of the encoder before 10ms,
Compare both the postions,If both reamins same just stop the Motor.
Just post the code which you hvae tried to help you better from your idea.
08-19-2016 05:58 AM
Hi,
Thanks for the info. I have my code attached. Now the value i am getting is in string format. Do i need to convert them into number? Secondly shift register is used within a while loop so i need to use shift register in the same loop.
In the file its the Encoder position which i need to control and connect it to stop profile incase the difference in current and previous encoder postion is +-2.
08-19-2016 06:04 AM
I am getting Missing Sub VI's.....
Try to use state Machine Architecture to avoid confusion and makes the code readable and good practice to follow.
08-19-2016 06:07 AM
Hi boy,
Do i need to convert them into number?
It makes sense to convert to numbers when you want to compare positions - but decide on your own… 😄
Secondly shift register is used within a while loop so i need to use shift register in the same loop.
???
There is no shift register in your loop. There are only some feedback nodes…
the Encoder position … connect it to stop profile incase the difference in current and previous encoder postion is +-2.
Use a shift register (or feedback node) to store previous encoder position. Then compare current reading with previous and wire the result to your "stop profile" condition…
08-23-2016 06:17 AM
So after some time i sit again on this problem. With my very basic knowledge of the labview and electronic system i tried to solve the problem.
In the attached example (alongwith the sub VI'S) i tried to put a shift register in my while loop and try to read the encoder value before and after and try to compare it. So when both the values are equal it shold send a stop signal to the motor.
The problem is encoder position changes so fast that there is no time when there is a difference in value. And thus the motor does not run at all.
Can somebody help me what i am doing wrong here. Secondly is there any funtion in Labview that checks if the value is changing overtime or not and if not then send the stop signal.
Thanks for the help in advance