02-18-2016 05:55 AM
Hello,
The value of duty cycle observed on oscilloscope isn't the same as specified in VI (please, see 2 screenshots below: 1st - screenshot LabView, 50% duty cycle specified, 2nd - screenshot Tektronix).
Any ideas ?
Thanks
Pavel
02-18-2016 06:02 AM - edited 02-18-2016 06:03 AM
Hi Pavel,
first check: check the waveform coming from the SigGen function! I bet it is showing a waveform with exactly 50% duty cycle!
next check: check the way the waveform is output on your AO channel…
(This process is called "DEBUGGING"…)
Or the other way: write a simple VI (just SigGen and DAQmx to output the waveform) and check its output using your scope…
02-18-2016 06:27 AM
Hi GerdW,
Thanks for feedback.
I've tried 1st suggestion - indeed WaveForm seems to be very close to 50% (pleese, see the screenshot below)
check the way the waveform is output on your AO channel…
In VI it's written to device using "DAQmx Analog Write" block, if I properly understood your suggestion.
2nd option coming soon.
Concerning WaveForm graph I 've supplementary question - is it possible to erase it once "STOP" button is clicked ?
Best Regards
Pavel
02-18-2016 06:36 AM
02-18-2016 06:46 AM
Hi Dennis,
Why do you post images that show nothing of how you are actually creating the analog signal?
I attached the code in my 1st post. Did you see it ?
In the meantime I've tried simple solution, proposed by GerdW and oscilloscope display exacly the same waveform, i.e. duty cycle isn't 50% (please see the sceenshot below and attached VI).
Best Regards
Pavel
02-18-2016 06:48 AM
That looks pretty much like the signal you're measuring, if you repeat it. You may want to control the number of samples you generate to match one period.
02-18-2016 07:02 AM
Hi M_Peeker,
You have probably a reason thinkng that this issue is in connection with number of samples.
When I set frequency to 2Hz, the duty cycle is exactly 50%.
So for fractional frequencies like 1,5Hz, 2.53 Hz this simple setup doesn't work and should be replaced by something more elaborating ... setup that adapt the number of samples to frequency. Correct ?
02-18-2016 07:19 AM
02-18-2016 07:19 AM
Here is solution that works with fractional frequencies.
Probably not the optimal one, but at least the duty cylcle remains 50% during generation.
02-18-2016 07:24 AM
Hi Pavel,
I don't think this is a good solution!
- Dennis mentioned the problem of calling DAQmxWrite in a loop.
- Creating a waveform of 1000 samples / 1kHz samplerate with a frequency of 1.7Hz gives 1000/1.7=588 samples for one full period. The next "period" in the signal only has 412 samples left, so the duty will fail for the second part of the waveform… Simple math, eh?