Hello,
I am using a NI-6602 card and I am using 2 counters input channels to perform buffered event counting on each counter. The signals are TTL pulses arising from photon detectors.
Everything works fine except that the two counters do not start at the same time. And it is essential for my application that they do.
I tried to use the Arm Start Trigger property but it does not work. In a bit more details, here is what I did (in C#) :
// Sample Clock
myTaskSampleClock = new Task();
myTaskSampleClock.COChannels.CreatePulseChannelFrequency("Dev1/ctr3", "", COPulseFrequencyUnits.Hertz, idleState, 0.0, sampleClockFrequency, sampleClockDutyCycle);
myTaskSampleClock.Timing.ConfigureImplicit(SampleQuantityMode.ContinuousSamples, 1000);
myTaskSampleClock.Start();
// Counter 1
counterReadTask1 = new Task();
counterReadTask1.CIChannels.CreateCountEdgesChannel("Dev1/ctr1","", edgeType, initialCountValue, countDirection);
counterReadTask1.Timing.ConfigureSampleClock("/Dev1/PFI24", sampleClockFrequency, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, sampleClockFrequency);
counterReadTask1.Triggers.ArmStartTrigger.ConfigureDigitalEdgeTrigger("/Dev1/PFI0", DigitalEdgeArmStartTriggerEdge.Rising);
myCounterReader1 = new CounterReader(counterReadTask1.Stream)
myCounterReader1.BeginReadMultiSampleInt32(sampleClockFrequency, myCallBack1, counterReadTask1);
// Counter 2
counterReadTask2 = new Task();
counterReadTask2.CIChannels.CreateCountEdgesChannel("Dev1/ctr0", "", edgeType, initialCountValue, countDirection);
counterReadTask2.Timing.ConfigureSampleClock("/Dev1/PFI24", sampleClockFrequency, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, sampleClockFrequency);
counterReadTask2.Triggers.ArmStartTrigger.ConfigureDigitalEdgeTrigger("/Dev1/PFI0", DigitalEdgeArmStartTriggerEdge.Falling);
myCounterReader2 = new CounterReader(counterReadTask2.Stream);
myCounterReader2.BeginReadMultiSampleInt32(sampleClockFrequency, myCallBack2, counterReadTask2);
// Trigger task
Task triggerTask = new Task();
triggerTask.DOChannels.CreateChannel("/Dev1/port0/line0", "", ChannelLineGrouping.OneChannelForEachLine);
DigitalSingleChannelWriter StartTriggerWriter = new DigitalSingleChannelWriter(triggerTask.Stream);
triggerTask.Control(TaskAction.Verify);
// Write the digital edge
StartTriggerWriter.WriteSingleSampleSingleLine(true, false);
StartTriggerWriter.WriteSingleSampleSingleLine(true, true);
StartTriggerWriter.WriteSingleSampleSingleLine(true, false);
In words :
I define and set up my sample clock (used by the 2 counters)
Then I create my 2 readers and set up their ArmStartTrigger properties.
Finally, I define my arm trigger as a DOChannel and write an edge that should start both readers.
But this is not working. I get a timeout error saying that samples haven't been acquiered (er -200284), so it looks like the trigger is never activated. I looked at many forums but didn't find a solution in C#. Do you have any idea why it's not working ?
Any help would be very appreciated !
Thanks,