LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I output a permanent 'True' statement once two values are equal?

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;

datatoarry.PNG

 

Thanks.

0 Kudos
Message 1 of 6
(4,300 Views)

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.

Message 2 of 6
(4,289 Views)

You could use your feedback node to implement RavensFan's suggestion:

 

Example_VI_BD.png

steve

----------------------------------------------------------------------------------------------------------------
Founding (and only) member of AUITA - the Anti UI Thread Association.
----------------------------------------------------------------------------------------------------------------
Message 3 of 6
(4,256 Views)

i dont know

0 Kudos
Message 4 of 6
(4,252 Views)

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;

datatoarray_update.PNG

Any suggestions?

 

Thanks.

 

Download All
0 Kudos
Message 5 of 6
(4,203 Views)

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?

0 Kudos
Message 6 of 6
(4,195 Views)