02-26-2020 10:45 AM
I have a simple VI (attached) that seems to be slowing as the programs runs. For the first 2 hours, it takes readings from my DAQ just fine...but as time progresses, the program takes several seconds to take a single reading. I have added error erase and tried to release the task at the end of each cycle. Any ideas of what I could add to fix this? After a day, LabVIEW is completely locked up and the computer has to be rebooted.
Solved! Go to Solution.
02-26-2020 11:07 AM
One thing I notice right away is that you keep creating many new DAQmx tasks, but you only ever clear one of them with DAQmx Clear Task. The first simple thing to try is to clear every task right after stopping it.
However, I'll note that your whole approach to data acq looks ill-conceived. You can (and probably *should*) put multiple channels into a single task. Then you'll be sampling the different sensors pretty much simultaneously rather than in a software-timed sequence.
That'll further allow you to create the task only 1 time during Init and then keep using it to do your readings as you progress through your state machine. At present you're in "on-demand" mode without a sample clock, so you could also start the task only 1 time during Init. The stop and clear would also happen only once each during shutdown.
-Kevin P
02-26-2020 11:18 AM
Thanks Kevin,
For now I'll try the clearing the task every time I stop it and see what happens. Although it is not perfect, the VI kind-of works (ish)...and I have a hard deadline to get usable data. As a side project, I'll try implementing all the readings into 1 task after this project completes, and I don't have my bosses watching
03-06-2020 05:00 AM
do not save array file because your doing control and data saving both loop please check loop time if loop time more then 250ms defintely program will run slow.
03-06-2020 06:11 AM
03-06-2020 06:13 AM
I took your advice and cleaned up the program significantly. I was thinking I required the "create channel" vi...even though I had created a task...duh. Once that was eliminated, things fell together.