Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

frequency multiplication on 6602

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.

 

0 Kudos
Message 1 of 4
(5,445 Views)

I'm not entirely certain that I understand what the end goal of your setup here is.  It sounds like you want to have pulse train that is generated every time some counter task ends.  Is that the case?  

0 Kudos
Message 2 of 4
(5,411 Views)

Shane,

 

The goal is to continuously produce phase shifted signal with multiplied frequency (see picture). And change delay without disturbing this signal significantly

Input triggers run continuously, all tasks are retriggerable, so they run continuously too.

See the picture with N = 4 and delay change problem.

 

 

0 Kudos
Message 3 of 4
(5,407 Views)

It looks like you're just missing one trigger edge due to the fact that your other task hasn't yet finished before that trigger occurs.  It looks like you'll have to try and do something creative here to overcome the problem.  What you suggested originally might do the trick.  That or you'd have to try change when the triggers are occuring, such that the Ctr3 task never misses a trigger.

0 Kudos
Message 4 of 4
(5,385 Views)