Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 9401 & Status Code: -50103

Hello Everyone,
 
Software: Visual Studio 2003, VC++
Hardware: cDAQ - 9172
 
I have 2 NI 9401 modules .  1st module is configured as CO while the 2nd module is a CI.  I tried using them in a single chassis and even
on separate chassis but I still have this problem.  Please see attachment.
 
I modified the 2-separate measurement shipping example.  I included a CO task that will output a pulse to the AUX pin of the 2nd NI 9401 module.  I want to measure the time the pulse has been generated and captured by the 2nd module.   
 
 
// Create the counter input task
CNiDAQmxTask myTask;
 
// Create the counter input channel
myTask.CIChannels.CreateTwoEdgeSeparationChannel(physicalChannel, "", minimumValue, maximumValue, firstEdge, secondEdge,         DAQmxCITwoEdgeSeparationUnitsSeconds);
 
// Create the counter output task
CNiDAQmxTask myTask3;
  
// Create the counter output channel
myTask3.COChannels.CreatePulseChannelTime(physicalChannel3, "",  DAQmxCOPulseTimeUnitsSeconds, m_idleState, atof(initialDelayStr), atof(lowTimeStr),
atof(highTimeStr));

//start counter output task
 myTask3.Start(); 
 
// Create a reader for the channel (counter input)
CNiDAQmxCounterReader reader(myTask.Stream);

// Read the data (counter input)
double acquiredData = reader.ReadSingleSampleDouble(); 
 
// Display the data (counter input)
CNiString acquiredDataString;
acquiredDataString << acquiredData;
m_acquisitionResult.SetWindowText(acquiredDataString);
 
Please advice.
 
Thanks again,
A
 
 
 
 
0 Kudos
Message 1 of 3
(7,876 Views)

 



Message Edited by samantham on 05-15-2008 07:20 PM
Samantha
National Instruments
Applications Engineer
Message 2 of 3
(7,855 Views)

Hello,

Status code -50103 “The specified resource is reserved” could be due to a couple of different cases.  Please check if the Counter Output task (myTask3) is in finite mode.  The class CNiDAQmxTiming item DAQmxSampleQuanityMode is where you can set the task to finite or continuous.  When generating a finite pulse train, two counters are actually used and thus reserved.  Since there are only two counters available on the cDAQ (9172), the error -50103 occurs when you are trying to reserve a total of three counters by adding in the Counter Input.  If you change the CO pulse train to continuous mode, the task will only use one counter.  Please refer to this KnowledgeBase for more detailed information.

KnowledgeBase 2VHDS879: Error -50103 With Multiple Counter Applications

The other possibility is that the posted code is being executed multiple times or looped and the tasks are not being cleared.  Clearing the task will unreserved the task resources, so the next time the code is executed the resources will be free.  Again, please refer to this other KnowledgeBase in Case 2 for more information.

KnowledgeBase 2WT74JMM: Causes of NI-DAQmx Error 50103 "The Specified Resource is Reserved"

 

This post also seems to relate to this thread with a Counter Output instead of a Digital Output.

 



Message Edited by samantham on 05-30-2008 06:06 AM
Samantha
National Instruments
Applications Engineer
Message 3 of 3
(7,791 Views)