Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

status code -50103 using a PCI-6122 card

I have an application that creates multiple tasks, since I want the ability to sample at different rates.  It seems to work fine with just 1 task running, but when there are 2 tasks running I get a status code -50103 "The specified resource is reserved.  The operation could not be completed or specified."  I am using the AnalogSingleChannelReader(task.stream) and setting a callback routine using BeginReadMultiSample.  I'm not sure if I'm using the correct API.  Are there any code examples in C# (without Measurement Studio) showing how to  run 2 tasks at the same time?
0 Kudos
Message 1 of 3
(3,068 Views)
Hello charise,

It sounds like you are trying to run more than one of the same type of task at the same time.  The issue that you are seeing is because each type of task only has one timing engine.  This means that you cannot have two timed tasks of the same kind running together since the first one reserves the timing engine.  You can have two static tasks running simultaneously, so you could try and use software timing in parallel loops to run your tasks, but you can't have 2 timed tasks running at different rates.

One method that is used to get around this is to oversample.  You could sample at the faster rate (or least common multiple of the two if you want exact rates) and then only take the points that correspond to your rates.  For example, if we wanted to sample our Analog Input at 10Hz and 15Hz, we could read both of them at 30Hz (in the same task) and then only read every 3rd point for the 10Hz and every 2 points for the 15Hz.

As far as the driver goes, since you can get one to run correctly it appears that you are using the correct drivers, etc.  I hope this gives you some insight as to what is happening.
Neal M.
Applications Engineering       National Instruments        www.ni.com/support
0 Kudos
Message 2 of 3
(3,027 Views)
Thank you for the explanation Neal!  The oversampling method sounds like a good plan.
0 Kudos
Message 3 of 3
(3,022 Views)