01-10-2024 12:36 PM
I have a doubt about LABview when I stop the program the I/O state still same before I click on stop program run , example I'm controling a servo motor and if I stop the program the servo still spinning , I just want how can reset the I/O status when I press to end the DAQ programm
01-10-2024 12:48 PM - edited 01-10-2024 12:48 PM
Hi Chris, you will have to share your code for specific suggestions. You can set the state of your DAQ card to whatever you need it to be (example set some outputs to 0 V) as your program is shutting down.
Make sure you are not using the abort button (stop sign next to run button) because that is only for emergencies. Your VI should complete its run gracefully e.g. when its task is finished, when a front panel control is pushed, or other stop event is triggered.
01-10-2024 06:38 PM
@Chris9823Alb wrote:
I have a doubt about LABview when I stop the program the I/O state still same before I click on stop program run , example I'm controling a servo motor and if I stop the program the servo still spinning , I just want how can reset the I/O status when I press to end the DAQ programm
Just to clarify, LabVIEW is a graphical programming language; the code you implement using LabVIEW, called "Application," is the one that interacts with your hardware. So, in essence, it would be more appropriate to ask how to achieve a proper shutdown on application close.
Your program must implement a method to properly power down or stop your external hardware, or else it will be like crashing a car into a tree to stop it; of course, there is the best way, to apply brakes, and again, not in the middle of the highway.
01-11-2024 06:16 AM
This is my code , when I click to abort execution or program occur an error the state of I/O ports still same so the motor keep running
01-11-2024 06:30 AM - edited 01-11-2024 06:31 AM
Hi Chris,
@Chris9823Alb wrote:
This is my code , when I click to abort execution or program occur an error the state of I/O ports still same so the motor keep running
01-11-2024 08:14 AM
I mean this button near pause , and how can I make my outputs restart when occur error or press this button?
01-11-2024 08:57 AM
@Chris9823Alb wrote:
I mean this button near pause , and how can I make my outputs restart when occur error or press this button?
Do NOT use that button. It is only meant as a last-ditch option when things go totally wrong. It is commonly compared to using a tree to stop your car. You cannot do any clean up when you abort the VI. Everything just instantly stops where it was. This is catastrophic when dealing with hardware.
You need to use your actual stop button on your front panel to gracefully let the loop stop, then set your outputs to "off", and then stopping the DAQmx tasks.
01-11-2024 09:00 AM
@Chris9823Alb wrote:
I mean this button near pause , and how can I make my outputs restart when occur error or press this button?
I assumed you would do that and provided the example of hitting a tree to stop a car instead of properly pulling over and applying brakes.
You seem to have a Stop button, use it to stop the program and add a logic such that when the Stop button in True, set the value to Servo to stop it.
01-11-2024 12:41 PM
Already have a logic with panel stop button , but if the code get an error to abort VI ,how can I avoid keep the servo ON?
01-12-2024 01:09 AM
Hi Chris,
@Chris9823Alb wrote:
if the code get an error to abort VI ,how can I avoid keep the servo ON?
As has been said: do all the cleanup stuff after the loop has finished.
THINK DATAFLOW!