Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you get the Edge Counter Channel to reset its count without stoping and re-starting the Task?

I'm doing the basic Counter Channel in C#. I asked the NI engineers about this, they said stop and restart the Counter Task. But that kills my performace and can't read fast enough. 

 

   myCITask = new NationalInstruments.DAQmx.Task();

   myCITask.CIChannels.CreateCountEdgesChannel("Dev1" + "/ctr0", "Dev1" + "ctr0",
   CICountEdgesActiveEdge.Falling, 0, CICountEdgesCountDirection.Up);

   runningTask = myCITask; 

   myCITask.Control(TaskAction.Verify);

   counterInReader = new CounterSingleChannelReader(myCITask.Stream);

   counterInCB = new AsyncCallback(CounterInCallback);

   counterInReader.SynchronizeCallbacks = true;

   counterInReader.BeginReadSingleSampleInt32(counterInCB, null);

 

 

And in the Callback ciData int value is at risk of an overflow

   ciData = counterInReader.EndReadSingleSampleInt32();

I tried this:

   myCITask.CIChannels[0].CountEdgesCountResetResetCount = 0;

But that kills the whole thread and callback mechanism. I can't reset ciData to 0 unless I stop and restart the Task. But that does bad things to timing.

Does anyone know how to get the counterInReader initial count value back to 0?

 

Any help is appreciated.

Also, how do you delay the callback say 40 milliseconds? I'm just not seeing it.

   counterInReader.BeginReadSingleSampleInt32(counterInCB, null);

 

 

0 Kudos
Message 1 of 1
(1,279 Views)