04-24-2017 05:31 PM
I'm using logic to stop a motor from running once the motor speed reaches the reference motor speed. I am able to do this if I stop my program once the values are equal but I do not want to stop my program quite yet. I want to stop my program once the motor decelerates to a value of 0.
The problem I am having is that once the values are equal, the motor stops....but then it starts to run again once the values "aren't equal".
How can I output a permanent 'True' statement once my motor reaches the reference speed?
Here's a picture if it helps any;
Thanks.
04-24-2017 06:05 PM
Initialize a shift register with a False. OR the result of the comparison with the value in the shift register and put it back in shift register. Now once you get a True, it will always stay True.
AND that result with your other comparison.
04-24-2017 08:50 PM
You could use your feedback node to implement RavensFan's suggestion:
steve
04-24-2017 09:42 PM
i dont know
04-25-2017 08:27 AM
Thank you RavensFan (and steve),
Everything now works perfectly except for one thing. Now I am unable to stop the motor when I click the Stop button, it continues to accelerate until it reaches the reference speed. I would like the motor to stop either when the stop button is pressed, or when the comparison outputs the permanent 'true' statement that you guys helped me with.
I drew the truth table for what I am trying to do and if I'm not mistaken a NOR gate should be implemented as seen below.
Here is my updated block diagram;
Any suggestions?
Thanks.
04-25-2017 08:49 AM
Are you sure about the boolean logic to drive that motor? The NOR node there seems unusual.
You'll need to put some probes in and debug your application to make sure the logic is functioning they way you want.
One thing I see that would cause a problem. You are comparing two floating point values for equality. Are you sure the motor speed you measure will EXACTLY equal the speed you are looking for?