I am doing frequency multiplication with NI 6602 counter (see attached picture LV 2011 snippet):
Ctr0 is triggered by external clock with measured period (say 50 ms, 20 Hz). Ctr0 task is retriggerable, so it is running continuously.
Ctr3 task is retriggerable finite generation - to multiply frequency 100 times (to 2 kHz, 500 us) I generate 100 pulses, high time+low time slightly below 500 us. So all 100 pulses end just before the next ctr 0 trigger. Phase between this task and input triggers is controlled by changing low time of ctr0 task during runtime.
My problem is that when I change delay, ctr3 task can skip one trigger period (50ms). It happens when I reduce the delay and ctr0 pulse is generated before previous ctr 3 finite generation finishes, so ctr3 waits for the next pulse. But they should be running continuously, allowed pause in generating pulses is 5 ms maximum.
One solution is to use a different counter to generate 500 us pulses, and connect it while main tasks are switching. I will have wrong phase for a while, but pause in generating will be smaller.
But I am running out of counters, also disconnecting main task and connecting different task will take time. And I do not like this solution. Any advice?
I can not generate 99 pulses, switch phase, then switch back to 100 pulses, number of samples can not be changed at run-time.