Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

My DAQ readings are slowing down

Solved!
Go to solution

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.

0 Kudos
Message 1 of 6
(1,951 Views)
Solution
Accepted by topic author D_Freeman

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

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 6
(1,939 Views)

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

0 Kudos
Message 3 of 6
(1,924 Views)

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.

0 Kudos
Message 4 of 6
(1,879 Views)

solar_vi.png

0 Kudos
Message 5 of 6
(1,872 Views)

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.

0 Kudos
Message 6 of 6
(1,871 Views)