Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

NIDAQmx call to DAQmxStartTask returns -200251 after another task faults

I am using the NIDAQmx driver directly in my application, and this is my first experience with NIDAQmx although I have used Traditional for over a year. I need to perform 2 different measurements on the PCI-6013 but not simultaneously, they are as follows:

task #1) a large AI read of 5 channels for vibration data where the task is created and cleared each time about every minute or so.

task #2) a low frequency measurement using a counter where the task is created once and cleared on exit, but can be used many times a second in a loop by calling the DAQmxReadCounterF64 function.

Both of these work well independantly and seem to have no problems when a gate signal is present, but when the gate signal is not there for task #2 the call to DAQmxReadCounterF64 returns a -200284 as expected indicating data not available. No problem, but then when task #1 attempts to execute it returns error -200251 from the DAQmxStartTask call indicating "No DMA channels are available".

It seems that after the gate reappears then this problem goes away. I am not confident I understand the proper way to implement these things in NIDAQmx yet, as I understand it you should be able to create and configure a task like #2 once, call the DAQmxReadCounterF64 function many times, and then call DAQmxClearTask on exit without any need to call DAQmxStartTask or DAQmxStopTask. Help me understand why this is not working as expected so I can avoid future problems.

Ed
0 Kudos
Message 1 of 7
(4,044 Views)
Hello DaytonaED,

I have a few questions for you:

1. What environment are you programing in ?
2. For task #1, why do you need to create and clear it every minute? Could stopping and restarting the task be a better choice?
3. Are you using DMA transfer with both tasks or do you have one task set to use interrupt?

I would suggest looking at the following KnowledgeBase entry : http://digital.ni.com/public.nsf/websearch/6CBFC550085B32EC8625699A0078DAD8?OpenDocument.

Serges L.
0 Kudos
Message 2 of 7
(4,025 Views)
Thanks for the reply, I will check the knowledge base entry later today. As for the questions:

1) I am using VC++ 6.0.

2) Certainly I can only create the task once, my inexperience with NIDAQmx makes the decision on how to handle these things difficult. Again, I have worked with Traditional NIDAQ for about a year and this changeover has me a little puzzled about how to accomplish things so far. The examples are too simple for typical apps.

3) I didn't know I had a choice between DMA or interrupt, I would have to read about this to understand why or when to use either. Task #1 reads 5 channels at 10kHz each for 2 seconds every infrequently (every 60 secs) and task #2 reads a counter frequently (every .25 secs) but never at the same time.

I'm sure I can fight my way through this, but I would like to understand the underlying problem because its not clear to me why it acts differently when the counter read succeeds or fails. Also, from the NI info I read in NIDAQmx Help they indicate there is no reason to call Start and Stop funcs for finite reads so I'm not at this time.

Ed
0 Kudos
Message 3 of 7
(4,022 Views)
Hello DaytonaEd,

Please go over the document and let me know if you still have questions.

Serges L.
0 Kudos
Message 4 of 7
(4,019 Views)
Yes, this is exactly the problem. So it is a limitation of the hardware and not something I am doing directly by mistake. I have found the description of the property based on the following statement:

NI-DAQmx--Use a DAQmx channel property node. First, select the property Analog Input, Analog Output, or Counter Input. Then select General Properties » Advanced » Data Transfer and Memory » Data Transfer Mechanism, create a constant, and choose Interrupts.

So far, I haven't found out how to set these channel properties - I don't know the function that does this so I will continue to look.

Is it fair to say that tasks that are infrequently used can be created, configured, used and cleared every time but otherwise should be created and configured on startup, used repeatedly, and then cleared on exit?

Ed
0 Kudos
Message 5 of 7
(4,011 Views)
Found it, took a little searching but the call is DAQmxSetCIDataXferMech. They seem to have followed Microsoft's lead for the Win32 API and have added a function for about everything imagined. I have the same problem with Win32, that is searching through the API to find what I need.

Thanks for the help, if possible I would still like an experienced view on if it ever makes sense to create/clear a task upon use or not. Certainly, it seems that if you are repeatedly using it you would not do this.

By the way, this is my first attempt to use the NI Forum and have found it to be very successful - Bravo.

Ed
0 Kudos
Message 6 of 7
(4,008 Views)
Hello DaytonaEd,

I am glad you like the Forum. National Instruments will always make sure that your question gets answered, that's the NI way of doing things.
Regarding your question, it is always a good idea to erase a task only when you are done with it. There are times of course where you will need to delete it and recreate, but the ideal is create once, use and delete once.

Serges L.
0 Kudos
Message 7 of 7
(4,003 Views)