Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

setting priority

Hi NI Community,

Not sure if this is the right place to start.  But, someone must have had a similar issue.

 

We are using C# to talk to our NI 6323 board.  

We have two analog inputs that need to be read.  (No problem setting that up.)

Here  are the inputs:

static private Task SensorInput;   //needs to be read 10,000 per second

static private Task InputVoltage;    //needs input every 2 seconds

 

reader = new AnalogMultiChannelReader(SensorInput.Stream);
data = reader.ReadWaveform(10,000);

 

Trouble is we need the "InputVoltage" to be read every two seconds and it sometimes gets "locked out" by the 10,000 samples per second stream going on for the "SensorInput"

 

Is there a way to raise the "priority" of the InputVoltage task so that it always reads a value.  Often we only get the exception NationalInstruments.DAQmx.DaqException: The specified resource is reserved. The operation could not be completed as specified.

 

Brian

0 Kudos
Message 1 of 2
(2,545 Views)

Hi BCES,

 

It's not necessarily a priority issue, you can just run one task at the time. For a quick workaround, I recommend you to get both channels inside the same task with a larger acquisition rate and filter the data simulating it has been gotten at the rate you need.

 

You also can stop the task, run the other one, stop it and start the first one again. Take a look at this links they might help you to understand how to improve your program in the future

 

http://www.ni.com/product-documentation/2835/en/#toc7

http://zone.ni.com/reference/en-XX/help/370466AC-01/mxcncpts/taskstatemodel/

0 Kudos
Message 2 of 2
(2,516 Views)