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.
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.
07-18-2019 10:12 AM - edited 07-18-2019 10:16 AM
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.
07-18-2019 10:18 AM
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.
07-18-2019 10:20 AM
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.
07-18-2019 10:38 AM
@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.
07-18-2019 10:39 AM
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.
07-18-2019 11:06 AM - edited 07-18-2019 11:07 AM
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?
07-18-2019 11:09 AM
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!
07-18-2019 11:10 AM
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...
07-18-2019 11:18 AM - edited 07-18-2019 11:20 AM
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.
07-18-2019 12:06 PM
@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.