From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DO signal continues after stopping VI

 

I am using the NI 9472 DO module to control a 24Vac motor.  The VI is able to turn the motor on and off, as well as measure the voltage pulses generated by the phototransistor, giving me the frequency.  I measure those pulses with the NI 9215 10V AI.

 

Here's my problem: whenever I stop the VI, the DO signal is still on and the motor is still running.  I tried creating a node to reinitialize to default, but when I turned it off, the signal was still on.  But when I started the VI back up, then the signal turned off.  I assume that the solution is simple, but I am still a beginner who isn't very good at troubleshooting.  Thanks for reading.Chopper.PNG

0 Kudos
Message 1 of 14
(3,204 Views)

Assuming you are using the stop button (and not the abort button or [X] in the upper right), all you need is another motor write after the loop with a FALSE wired to it. You already have the task wire.

0 Kudos
Message 2 of 14
(3,189 Views)

Ok You have mastered the use of the wizard. Now you need to actually start learning LabVIEW. You need to set up a state machine and control the order that things are happening in your code. Right now you have now way to stop your motor before you stop your loop. That is why you are not stopping your motor when you hit stop.

 

Look at the state machine and try to make that work with what you are trying to accomplish. There is training links at the top of the LabVIEW discussion board.

Tim
GHSP
0 Kudos
Message 3 of 14
(3,185 Views)

@aeastet wrote:

Ok You have mastered the use of the wizard. Now you need to actually start learning LabVIEW. You need to set up a state machine and control the order that things are happening in your code. Right now you have now way to stop your motor before you stop your loop. That is why you are not stopping your motor when you hit stop.

 

Look at the state machine and try to make that work with what you are trying to accomplish. There is training links at the top of the LabVIEW discussion board.


The motor control is not using the "wizard".  As stated, the OP only needs to wire the task out of the loop and call the Stop Task. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 4 of 14
(3,167 Views)

Yes but most of what he is doing is using the wizard. Learning better techniques would certainly help his code and the flow of the program.

Tim
GHSP
0 Kudos
Message 5 of 14
(3,161 Views)

Altenbach, I tried doing what you advised, but the signal still stays on after the VI is ended (using the actual stop button in the VI, of course).  What am I doing wrong here?Chopper 2.PNG

0 Kudos
Message 6 of 14
(3,141 Views)

Aeastet, thanks for the tip.  I looked into some examples and there is much, much more information that will help me in the long run.  Thanks!

0 Kudos
Message 7 of 14
(3,138 Views)

Aputman, I tried wiring a stop then clear task after the loop, but nothing resulted from that.  I'm confused because what you recommended makes perfect sense...

0 Kudos
Message 8 of 14
(3,137 Views)

There is a DAQmx function "Wait Until Done.vi".  Put that before the Stop Task.  Maybe the false value hasn't been written yet when Stop Task is called.  

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 9 of 14
(3,131 Views)

@aeastet wrote:

Ok You have mastered the use of the wizard. Now you need to actually start learning LabVIEW. You need to set up a state machine and control the order that things are happening in your code. Right now you have now way to stop your motor before you stop your loop. That is why you are not stopping your motor when you hit stop.

 

Look at the state machine and try to make that work with what you are trying to accomplish. There is training links at the top of the LabVIEW discussion board.


The OPs code is actually not very bad for a beginner, and a state machine is not necessary for this simple program. While I use a state machine a lot it is not the answer to every problem. LVOOP could just as easily be offered as an alternative programming method, but it is also not necessary to solve the OPs problem for this simple program.

0 Kudos
Message 10 of 14
(3,107 Views)