Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Error Code 50401 after inactivity

Hello,

I have a couple of PCI 6110 boards that I'm programming via the DAQmx DLL library.

I'm using the cards in an application where I'm running lots of short acquisitions with breaks in between. Everything works fine unless I leave the DAQs inactive for a long period of time (~15-20 min), in which case, when I try to create or start a task I get a communication error (error 50401).

I don't have a lot of experience with DAQmx so I'm sure I'm just doing something simple and obviously wrong, and hopefully someone can point me in the right direction.

 

One guess of mine is that I'm not clearing tasks- I'm creating a few general tasks, adjusting their buffer sizes, and starting/stopping them as need be to perform acquisitions. Is it possible the system times out because I'm allocating all these resources and not using them?

If anyone has experience with this I'd appreciate the help!

Kasper

0 Kudos
Message 1 of 4
(3,705 Views)

Hi Kasper,

During these breaks between acquisition, are you running then stopping your code, or is your code continuously running but only the DAQmx Read is being called once every 20 minutes or so?  Also are you clearing the task at the end of your execution?

 

What development environment and programming language are you using?  How are you able to clear this error; do you need to simply need to restart your program or do you have reset your 6610?

 

Thanks Kasper!

 

 

Best Regards,

 

Brandon G

 

National Instruments
Precision DC Hardware Engineer
0 Kudos
Message 2 of 4
(3,683 Views)

Hi Brandon, thanks for the reply and sorry for delay in following up!

My application is written in Matlab by calling a set of C functions (using matlab's MEX foreign function interface), which I believe simply call their counterpart DAQmx DLL functions.

I didn't write these MEX functions myself but others seem to use them without trouble.

 

To answer your question: when the error occurs, I have to unload the DLL library and reload it, but do not have to restart Matlab.

 

Here's a list of function calls involved in a typical workflow.

 

When loading the program:

---------

Load DLL library.

Create tasks and create voltage channels for the tasks.

Configure sample clock timing on both AI and AO channels.

Write a constant value to one of the AO channels.

---------

 

 

At this point, I can wait indefinitely and I've never seen the error. (I can test this rigorously if need be).

 

However, if I run an acquisition, as follows:

---------

Unreserve my main AO task (in case it was previously reserved. If I don't do this, sometimes I can't change the buffer size)

Configure that task to continuous sampling.

Configure the buffer size on that task.

Write data to the task.

Configure my AI task to continuous sampling.

Change the buffer size on that task.

Assign an everyNsample function.

Unregister any done event that was previously registered.

write a constant value to another AO task.

Set a DO line to high.

Commit all of these tasks.

Start them in series using the start command.

---------

 

If I do that, and then wait 20 minutes or so (even if I leave the tasks running!) I get an error on any subsequent attempt to configure the DAQ.

I believe this occurs if I only run one cycle of the acquisition, without the breakdown steps described below, though I should test that rigorously as well.

I am not clearing any tasks until I close down the program. Should tasks be cleared and recreated for each acquisition?

 

For completeness, stopping tasks for me consists of:

---------

Set the previously mentioned DO line to low.

Stop all running tasks. Unreserve those tasks.

---------

 

I hope this makes sense.

Thanks for your help Brandon!

0 Kudos
Message 3 of 4
(3,672 Views)

Hi Kasper,

Thank you for all the additional information!  To answer your question, a task does not need to be cleared and recreated for each acquisition.  I did have a few suggestions to help us narrow down the cause of this issue and I think these steps below will help us figure out what's going on:

 

1.  Can you run this C code in another Application Development Environment such as CVI or Visual Studio? 

 

2. What happens if you take your code and simply try to do the AO task?  Do you get the same results? 

 

3.  Can you try running one of our AO shipping examples using the Matlab MEX FFI?

 

4.  What version of DAQmx do you have installed?  If it's outdated, you may want to try downloading the latest driver here.

 

5.  Can you post your code so I have a better idea of what's going on?

 

Thanks Kasper!

 

Brandon G

 

National Instruments
Precision DC Hardware Engineer
0 Kudos
Message 4 of 4
(3,660 Views)