Dear all
i'm using a PCI-6602 to generate a range of different pulse trains / retriggered pulses. Ctr0 is running at the experiments base frequency (T0) and is configured like this:
Error = DAQmxCreateCOPulseChanTicks(T0TaskHandle, "Dev1/ctr0", "", "20MHzTimebase", DAQmx_Val_Low, 0, T0Low, T0High);
Error = DAQmxCfgImplicitTiming(T0TaskHandle, DAQmx_Val_ContSamps, 0);A second counter (Ctr2) produces pulses synchronized with T0 but with n times longer period:
Error = DAQmxCreateCOPulseChanTicks(BlockTaskHandle, "Dev1/ctr2", "", "20MHzTimebase", DAQmx_Val_High, 0, BlockLow, BlockHigh);
Error = DAQmxCfgImplicitTiming(BlockTaskHandle, DAQmx_Val_ContSamps, 0);
Error = DAQmxCfgDigEdgeStartTrig(BlockTaskHandle, "/Dev1/Ctr0InternalOutput", DAQmx_Val_Rising);A third counter (Ctr3) produces retriggered pulses from Ctr2 that will serve as a gate for the 4th counter output:
Error = DAQmxCreateCOPulseChanTicks(BlockEnableTaskHandle, "Dev1/ctr3", "", "20MHzTimebase", DAQmx_Val_Low, 0, BlockEnableLow, BlockEnableHigh);
Error = DAQmxCfgDigEdgeStartTrig(BlockEnableTaskHandle, "/Dev1/Ctr2InternalOutput", DAQmx_Val_Rising);
Error = DAQmxCfgImplicitTiming(BlockEnableTaskHandle, DAQmx_Val_FiniteSamps, 1);
Error = DAQmxSetStartTrigRetriggerable(BlockEnableTaskHandle, true);Ctr4 should now output pulses at the frequency of Ctr0 but only when Ctr3Out is high. I tried along the lines of:
Error = DAQmxCreateCOPulseChanTicks(TriggerTaskHandle, "Dev1/ctr4", "", "20MHzTimebase", DAQmx_Val_Low, 0, TriggerLow, TriggerHigh);
Error = DAQmxCfgImplicitTiming(TriggerTaskHandle, DAQmx_Val_ContSamps, 0);
Error = DAQmxSetPauseTrigType(TriggerTaskHandle, DAQmx_Val_DigLvl);
Error = DAQmxSetDigLvlPauseTrigWhen(TriggerTaskHandle, DAQmx_Val_Low);
Error = DAQmxSetDigLvlPauseTrigSrc(TriggerTaskHandle, "/Dev1/Ctr3InternalOutput");This works in terms of gating, but the gated pulses are no longer synchronized with the Ctr0 (they "move" through the gate when looking at it on an oscilloscope).
DAQmxCfgDigEdgeStartTrig does not work for Ctr4 as it is not possible to use start and pause in the same task (at least that's what the error message said).
I tried to synchronize using:
Error = DAQmxSetArmStartTrigType(TriggerTaskHandle, DAQmx_Val_DigEdge);
Error = DAQmxSetDigEdgeArmStartTrigSrc(TriggerTaskHandle, "/Dev1/Ctr0InternalOutput");
Error = DAQmxSetDigEdgeArmStartTrigEdge(TriggerTaskHandle, DAQmx_Val_Rising);which works if i uncomment the three PauseTrig lines (no more drifting pulses, but no gating either). Using it all together produces no errors but the gated pulses still walk through the gating window.
Any help is deeply appreciated
Best regards
Christian