LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Input and Output State

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

0 Kudos
Message 1 of 13
(707 Views)

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.

0 Kudos
Message 2 of 13
(703 Views)

@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.

 

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 3 of 13
(662 Views)

Chris9823Alb_0-1704975286683.png

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

 

 

0 Kudos
Message 4 of 13
(635 Views)

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


  1. I don't see any "abort execution" button, I just see a "Stop" button. How do you "abort execution"?
  2. I don't see any error handling in your VI: how do you react on "occuring errors"?
  3. I don't see any code to gracefully shutdown your hardware system: where do you plan to place this code? (As has been suggested before!)
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 13
(633 Views)
 
 
 

 

 
 
 
 
 
 

Screenshot 2024-01-11 111201.png I mean this button near pause , and how  can I make my outputs restart when occur error or press this button?

0 Kudos
Message 6 of 13
(611 Views)

@Chris9823Alb wrote:
 
 
 
 
 

Screenshot 2024-01-11 111201.png 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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 13
(605 Views)

@Chris9823Alb wrote:
 
 
 

 

 
 
 
 
 
 

Screenshot 2024-01-11 111201.png 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.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 8 of 13
(602 Views)

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?

0 Kudos
Message 9 of 13
(579 Views)

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!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 13
(557 Views)