LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

waveform generator timing

Hello,
 
   I am trying to control a servo using Labview 8.5.  The servo requires a sqaure wave where the duty cycle determines the position the servo motor moves an extension.  My question has to do with the sampling info parameters.  I was trying to get a duty cycle of 7.5%, so I hooked up my DAQ (NI 6221) to an oscilloscope.  At Fs and #s  1k and duty cycle of 7.5%, the scope said I have a duty cycle of 10%.  At Fs and #s = 4k, I got the scope to read 7.5%.  However, at Fs and #s = 5k, the scope read 8% duty cycle.  I moved up to Fs and #s = 6k and was able to read 7.5% again.  Does the sampling info somehow affect the daq output?  I first thought it just may not be going fast enough, but as you can see going from 4k to 5k produced an error.  I will need to be able to resolve .5% duty cycle changes to control my servo accurately, any help on this would be greatly appreciated!  Attached is a my VI, I use the DAQ output assistant, and tell it to use the waveform timing parameters.
 
Thanks
 
- J
0 Kudos
Message 1 of 3
(2,550 Views)
Just looking at the function generator can provide some clues. With your settings (f = 5.1 Hz, fs = 1 kHz and #s = 1000) you get a period of 196 ms. 7.5% of 196 ms is 14.7 ms. The function generator can generate 14 ms or 15 ms but not 14.7 ms with the 1 kHz sampling rate.

You can repeat the calculations for the parameters you need to see what settings will be required for your system. This is fundamental to any sampled data system.

Lynn
0 Kudos
Message 2 of 3
(2,523 Views)
Hi J,

As Lynn has mentioned, your sampling rate has become a product of your settings.  The DAQ Assistant settings you are using is extracting the timing from the waveform created.  I would follow Lynn's suggestion and verify the numbers your using.  Make sure that the sampling rate used (Fs) is something that will equate to you getting the correct duty cycle your looking for.  For example, if you changed Fs to 10KS/s you would see a 0.1ms accuracy.

I also wanted to mention that you might also just look at using a counter.  A counter output task will allow you to specify a pulse train duty cycle explicitly.  This will make the application a little more automated and easier to deal with.

Regards,
Paul C.
0 Kudos
Message 3 of 3
(2,512 Views)