04-06-2017 04:13 PM
I created a vi to control a mower test with much help from the NI community. Currently I am running this vi in the 'run continuously' mode, which I was told is not a best practice for operation. I am getting errors every few hours and believe it is due to the run continuously mode. What do I need to do to have the vi run continuously on its own? Thanks.
Solved! Go to Solution.
04-06-2017 05:23 PM
If you have a "1" hardwired to the N input of a For loop, you should just get rid of the For loop altogether. In your case you do have some delays in the loops so you should probably change them to flat sequences or put the delays on the error chain.
What you probably want to do is put a While loop around the 3 bits of code that are currently in For loops. The most likely cause that you crash after a while is that you are constantly creating, starting, stopping, and destroying your DAQmx channels/tasks and eventually run out of some resource or another.
Create one new button that you attach to the "stop" control in the new While loop to stop your program. Probably also ought to put the error handling VI inside the While loop.
04-07-2017 10:29 AM
In addition, this article has a lot of good coding practices and examples that may be good to understand for your application
http://www.ni.com/product-documentation/2835/en/
04-08-2017 06:54 PM - edited 04-08-2017 06:54 PM
1. Use a FOR loop and a 2-D array for looping through your 3 settings.
2. You initialize and closing of the DAQmx task should be outside of your main loop.
Here is my quick cleanup.
04-20-2017 08:21 AM
Thank you for the suggestion. Our solution was very similar to yours.
04-20-2017 08:22 AM
Thank you for the information. It was very helpful.
04-20-2017 08:23 AM
Thank you for the information on why we were having run time issues. The while loop solved the problem. Thanks again.