‎06-24-2011 04:16 PM
Based on my own trial&error tests and also based on what I read here I think that it is not possible to have two waveforms of different freq on two channels. It seems that if I want to generate waveforms I have to have the channels in one task. The task has to have one Sample Clock Rate (lets say 100kHz) then I create first waveform for the first channel (lets say 6kHz) and another waveform for the 2nd channel (lets say 3kHz). When I try to write them to the Task I get an error telling me that: Number of samples to write must be the same for every channel. This basically limits me to generate same freq across the channels (or in special cases the 2nd freq has to be a multiple of the first frequency while generating one cycle for the first and two cycles for the 2nd).
Is there some way how to overcome this or do I have to take it as a fact?
‎06-27-2011 01:52 AM
Hi Ceties,
I guess what you experienced is correct, as DAQ boards have usually one timing engine for output.
If you need to generate different frequency on different analog outputs without them being multiples of each other, you can use non-regeneration mode. This approach will make your code little more complicated, as you will need to always prepare reasonable number of elements to buffer, but it allows to you to generate whatever.
The idea with non-regeneration more is that each sample is generated just and only once.
I believe with this approach it should be possible to generate ciompletely different and independent frequencies on different analog outputs, for the price of more complicated way to prepare samples.
BTW: If you need more help, feel free to contact our local Czech and Slovak technical support directly
With kind regards,
Martin Stefik
Application Engineer
Czech Republic and Slovakia 🙂
‎06-27-2011 08:10 AM
Thanks Stefo,
I was actually quite wondering if you work for NI or not 🙂
Regarding the non-regen method - I am aware of this but it seems too risky. If the application hangs for few seconds it might cause troubles (we all know Windows). And since the periodic signal generation is just a bonus in my app I can live with the limitations of having the same freq over the channels.
Thanks
‎06-27-2011 10:40 AM
Hi ceties,
You can certainly generate waveforms at different frequencies on the same device. The sample clock must be the same across all channels, but the waveforms can be different.
The most general way to do this would be to use non regeneration (see example). The nice thing about this is that you don't have to worry about writing an exact number of periods of each waveform to the buffer.
If you don't want to use non-regeneration, you'll have to pick a number of samples to write that corresponds to an integer number of periods for every channel (unless you want discontinuities in your waveform output). This should be easy if you have frequencies that are multiples of each other (like 6 kHz and 3 kHz). Then, if you regenerate from this buffer the result would be a continuous waveform.
Best Regards,
‎06-27-2011 10:53 AM
Hi John and thanks for your time,
As I wrote above - the non-regenaration method is software timed and thus not acceptable for me (risk of not updating the buffer fast enough if the app hangs for few sec). Since this is not the main task of my app I can live with the limitattions of the regeneration method.
‎06-27-2011 11:24 AM
More details (maybe *too* many more) in related thread...
-Kevin P