Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

any ways to generate a sine wave synchronised with counter frequency output?

lab view 8.5
MDAQ 6211
counter 0 output is producing say 10 Hz.
is there a way in lab view to generate a 10 Hz sinewave that is synchronised to this counter frequency?
thanks
m.p.sarma
0 Kudos
Message 1 of 6
(4,888 Views)

A simple way would be to use the analog sample clock as the timebase for generating the counter pulses.  However the startup behavior isn't what you most likely want.  You'd be producing analog samples for a while before generating your first pulse train edge.

Another way would be to use your other counter (let's say CTR1) as a kind of "master timebase" equal to the desired analog output sample rate.  You should be sure to start this task *last*.  You would use CTR1's output as the analog output task's sample clock.  You would also use it as the timebase to drive your original counter pulse train (CTR0) which cycles once per analog output sine wave.  A final config item would be to trigger the analog output task from the output of CTR0.  Then the output won't start until the first pulse of CTR0.

-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 6
(4,884 Views)

thanks but i am a bit confused as i am new to labview.

Actually i want to generate a 10 Hz sine wave at one of the analog outputs and at the same time

i want synchronised in phase and quadrature signals wrt to above sine wave at ctr 0 and ctr 1 outputs.

could you please elaborate.

thank you so much

0 Kudos
Message 3 of 6
(4,869 Views)
Here's some more info about option 1 above.  This won't be a complete cookbook answer, but can hopefully give you a nudge or two in the right direction...
 
1.  Be sure that the number of samples in one cycle of your sine wave is an integer multiple of 4.  You'll only be able to generate "quadrature" edges
on sample clock edges and you need to divide your sine cycle into 4 equal parts for quadrature.  Just for illustration, let's say you have 200 samples per cycle.
 
2. Two counter tasks need to be configured to use the "Dev1/AOSampleClock" signal as their timebase signal / terminal.  They should both be configured with
units of "Ticks" and with low and high times set for 100 ticks each.  One of them should have an "initial delay" of 50 ticks, the other should be set for 100 ticks.
 
3. Be sure to start both counter tasks *before* you start the AO task.  Then they will both be armed and ready to respond simultaneously in hardware to the first
AO sample clock.
 
-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 6
(4,858 Views)

Hello mpsarma1,

 

Kevin has provided good solutions, but I thought I'd just throw this out there as well.  If you're only using one of the analog outputs in your application you could also just use both, generate a sine wave on one and a square wave on the other.  You could start from the Cont Gen Voltage Wfm-Int Clk.vi example (Open LabVIEW and go to Help» Find Examples... Then navigate to Hardware Input and Output» DAQmx» Analog Generation» Voltage» Cont Gen Voltage Wfm-Int Clk.vi).  This example generates a sin, square, saw, or triangle wave and you could modify it pretty easily to output a square wave and sine wave on each of the analog output channels.

 

However, if you're already using the other analog output I would recommend following Kevin's suggestion.

 

Cheers!

Brooks
0 Kudos
Message 5 of 6
(4,851 Views)

And vice-versa.  If you're new to LabVIEW, chances are really good that Brooks' suggestion will be *much* simpler to deal with.  I got myself into counter tunnel-vision because we're on the counter/timer forum...

-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 6 of 6
(4,848 Views)