LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Random error -50000 using DAQmxWriteAnalogF64

Driver: NI-DAQmx 7.3
Hardware: PCI-6221
Software: Visual C++
 
I randomly get the error -50000 - the value of one of the specified parameters conflicts with the state or the value of another parameter.  The operation could not be completed as specified.  An example call to the driver looks like this:
 
void OutputAnalog(TaskHandle hAOTask, float64 dVal)
{
  int32 lSampsWritten;
  float64 dData[1];
  dData[0] = 1.0f;
  DAQmxWriteAnalogF64(hAOTask, 1, 1, 0, DAQmx_Val_GroupByChannel, dData, &lSampsWritten, NULL);
}
 
It seems so simple and we use it on other machines, difference here is that there a 2 PCI-6221 cards and we use 4 seperate tasks to control the 4 analog output channels.  Nothing special being done, but about 1 of 50 calls results in the error.  I'm confident the handle is good but don't know where to go.
 
Ed

Message Edited by DaytonaEd on 08-15-2005 02:05 PM

0 Kudos
Message 1 of 8
(4,247 Views)

You mention 4 separate tasks to control 4 channels: if you suspend 3 of the 4 tasks do you still get the error on the one remaining running task? If not it looks like you may have to implement a system of controlling shared access to the driver.

JR

0 Kudos
Message 2 of 8
(4,231 Views)

Yesterday I started wondering if the problem might be with multiple-thread access to the driver.  I was under the impression that the driver was thread-safe and I shouldn't have to worry about this.  All four tasks are accessed about the same time by four different threads.  After posting this yesterday I put a short delay and then a retry after getting the fault and monitored it, the retry always worked probably indicating this is the problem.

If this seems to be the culprit, then a critical section can be implemented and should eliminate the problem.  This worries me a little because there are counters being read in addition to analog inputs by other threads - I'm wondering how extensive is this problem and are others dealing with it as well?

Ed

0 Kudos
Message 3 of 8
(4,229 Views)

By the way, when I posting this yesterday I somehow came across a key sequence by accident that created 6 copies - no idea how that happened.  Need to delete the others and can't locate a moderator to help, anybody know how to get rid of them?

Ed

0 Kudos
Message 4 of 8
(4,228 Views)

One of the items on the Options drop-down (to the right of the title of every message) is "Report to a Moderator". Never tried it myself but it might be what you are looking for?

JR

0 Kudos
Message 5 of 8
(4,223 Views)

Got rid of the duplicate posts by contacting the moderator - thanks.  OK, the critical section eliminated the problem and the need for retries.  Cannot understand why this would be necessary, each thread accesses a unique TaskHandle but at almost the same instant so it doesn't seem like this should cause a problem.  Another detail - my application uses the Free theading model if that would affect this problem.

I have at least 3 other threads performing AI and Counter functions as well but they don't seem to be affected.  Anyway, an understanding of why this was a problem would help me avoid it in the future.

Thanks, Ed

0 Kudos
Message 6 of 8
(4,197 Views)
 

Ed,

I don't know why you would see this problem.  It's possible it is a driver issue.  You could try upgrading to the newest version of DAQmx.

https://www.ni.com/en/support/downloads/drivers/download.ni-daq-mx.html 

-Jeff

 

0 Kudos
Message 7 of 8
(4,188 Views)
Hi All-
 
This problem is most likely caused by the fact that you are using seperate tasks for the different AO channels on the board.  For each board you can operate only a single AO task at one time.  I was able to replicate the -50000 error in LabVIEW using exactly the same structure as you, so it is definitely not a programming problem with your C code.
 
 
The NI-DAQmx driver is indeed multi-thread safe, but AI and AO operations only allow a single task for both types per card at any given time.
 
Hopefully this helps-

Message Edited by Tom W. on 08-18-2005 09:51 PM

Tom W
National Instruments
0 Kudos
Message 8 of 8
(4,175 Views)