Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

LV 8.0.1 vi reads off of a single channel of the USB 6009 DAQ device causes memory dump after 30 minutes+

I am having a tough time from keeping this vi I made from consuming so much memory over time.  I made it using LV 8.0.1.  Basically, all it is doing is reading in analog input line from a usb device linked to a sensor that basically monitors the line.  Whenever the sensor goes on, the count increments by one no matter how long the signal is held on for and then the time and count of this event is then written to a data log lvm file.  This occurs each time the sensor goes on.  Which is why I am uncertain as to why it still consumes memory other than when it first goes high and writes to the data log.  I didn't think it would keep using the memory up if the sensor was off.  I thought it was something to do with the DAQ assistant step (which was generated into code) but I am unable to figure out how to stop it.  If it was a refnum issue or what.  I was wondering if anybody has any suggestions on keeping a simple vi like this from consuming so much memory.  Basically, if running for more than a 1/2 hour, the smaller computer gets a memory dump crash (blue screen with some kind of a reference to nimxdfk.dll).  I was unable to see any refnums that needed to be closed within the while loops.  Am I supposed to clear the task after each iteration?  A little confused.  It is fully commented on if you have the time to look it over.  Thank you very much for your suggestions.
0 Kudos
Message 1 of 7
(4,501 Views)
Hello Scott,

I had a look at your code, and I believe I see the problem.  You are creating tasks over and over again in your large while loop, but never clearing any of those tasks.  If you look in the "Untitled 3.vi", you will see that it calls DAQmx Create Task.vi and DAQmx Create Channel.vi.  Then you start the task, read in a loop, and stop the task, but you never clear any of the tasks using DAQmx Clear Task.vi.  You should perform all configuration (creating tasks and channels, setting up timing) only once outside the main while loop.  If you move "Untitled 3.vi" outside of you main loop, it should help.

Let me know if you have any further questions!

Best regards,
Message 2 of 7
(4,489 Views)
Thank you for your response, Jarrod.  I went ahead and entered in a clear task after the stop task and that took care of it.  Thank you very much for your help.  Unfortunately, now I need it to work for all 8 available analog channels of the USB6009.  My concern there is that I will want to use any of the 8 analog inputs of the USB6009 throughout different times (days apart).  I wanted to use it as a sensor monitor where sometimes there may be 8 sensors hooked up and other times any thing from 1-7.  I noticed when I first tried this that I had to have all 8 assigned or else I get an error with the DAQmx steps.  I know that when I use DAQ assistant it makes a specific task and therefore expects those channels to be linked, I guess, but yeah.  Furthermore, when I make a DAQ assistant using voltage on only one line, the connection guide would show me maybe pins 15 and 16 for AI0; when I have all eight, the wiring changes to maybe 13 and 14 for AI0.  Is there a simple way of making it use only what is needed of the 8?  Does the wiring have to change?  Probably not making too much sense.  Hopefully it does.  I'll just keep tinkerin with this stuff until I figure it out.  Hopefully I'll have enough time.  Thanks again for your input thus far and I appreciate any further advice.  If you can't help, then thanks anyhow.
0 Kudos
Message 3 of 7
(4,482 Views)
Of course, now I'm checking out that link you have above "Getting started with NI-DAQmx".  Hopefully that'll shed some lilght on this.  Thanks.
0 Kudos
Message 4 of 7
(4,477 Views)
I also went ahead and moved the untitled vi out of the main large while loop.  Thanks for the tips.
0 Kudos
Message 5 of 7
(4,466 Views)
Scott,

I'm glad the clear task fixed your problem. As for the connection diagram, I tried to re-create your problem, but was unsuccessful. The correct pins for connecting AI0 are pins 2 & 3 for a differential measurement. The USB-6009 User Manual can also assist with pin connections (Pages 8 and 9). I would also suggest downloading the latest drivers.

Lastly, the front panel control you have for physical lines will let the user choose how many lines they want to measure.  If you want to make something a little more firm, you can create a case structure with a different number of AI lines in each case. Then, you will have a control for the case structure indicating how many lines the user would like to read. Please see the example below for a demonstration.
David L.
Systems Engineering
National Instruments
Message 6 of 7
(4,458 Views)
Thanks for the help David.  As far as the connections changing when built with DAQmx Assist, when I built one using all available 8 analog inputs from the USB 6009 I was getting pinouts described earlier (I guess it was similar to the "Single-ended" mode in order to use 8 channels), however, when I built a DAQmx Assist with less than 4 channels, then I'd see the connections for them were as shown in "Differential" mode.  This was verified by the bottom tab labeled "Connection Diagram".  I believe I called pin 1 what should be pin 16.  So, AI0 was pins 1 and 2 in single-ended mode and 2 and 3 in differential mode.  So, to avoid this I just need to set it as a constant single-ended mode in order to utilize all 8 channels as needed.  Thanks for helping me realize this.
0 Kudos
Message 7 of 7
(4,453 Views)