Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Frequency divider

Hello..
I want to divide a digital input signal frequency by a number ..... For examle  my input signal frequency is 20 kHz and i want to generate  50Hz signal from input signal..like shown in figure
I tried to use counter but i could not manage to obtain yet..
Thanks..
 
0 Kudos
Message 1 of 4
(5,396 Views)
I don't have LV here to be certain of the exact syntax.  The essence of what you'd do goes something like this:
 
a. Configure a virtual channel for pulse generation using Units=Ticks.  Set all pulse params (initial delay, low ticks, high ticks) = 200.
b. DAQmx Timing should be setup as "Implicit" and should also likely be set for "Continuous Sampling."
c. Configure a DAQmx Channel property node to specify that the source of the timebase signal should be your external input edges.
d. Start the task.
e. Every 200 incoming edges, the output state of your counter will toggle.  You'll get 1 output cycle per 400 input cycles, dividing you down
from 20 kHz to 50 Hz.
 
-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 4
(5,385 Views)
Thanks for your help Kevin.
Actually i find an example which works as your instructions. 
I need to an output waveform which has %50 duty cycle. But if i divide the input frequency to odd numbers (an example 500Hz/13 ) using this way the out put signal waveform do not have % 50 duty cycle. This is the my real problem.
Thanks again..
0 Kudos
Message 3 of 4
(5,372 Views)

50% duty cycle with an odd divisor, eh?  Well, since the hardware solution depends on integer counts, I don't think you can do it purely in hardware with your board (assuming the 6036 multifunction board you referenced in a similar thread).  There's a complicated way that might work with an M-series board where you would generate change detection pulses on both rising and falling edges -- then as long as the input signal is 50% duty cycle, it'd be possible to generate a 50% duty cycle output.

There's another possibility that's partly software based.  You would use one of your counters to measure the incoming frequency, and the other one would be set for pulse generation.  As you monitor the incoming frequency in software, you could react and change the output frequency on-the-fly while maintaining 50% duty cycle.  This kind of solution wouldn't sync the output edges with the input edges though.

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 4 of 4
(5,366 Views)