Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-6062E FM signal generation with DAQmx

This VI generates an FM signal but nowhere near real-time. I doubt you could use this in a real-time application at all. Each time through the loop it creates a waveform at a frequency defined each time through the loop. You would then have to modify this VI to write to the analog output channel each time through the loop. This takes more time than you want so you wouldn't be able to update the waveform as fast as you seem to want to. It would be much slower than the vi I posted.

The vi I posted only updates the sampling rate without changing the data that is repeatedly being output by the analog output channel so without having to send new data to the analog output channel, we are able to change the frequency of the analog output.

The limit to the vi I posted is defined by the speed of the while loop. I timed the loop at 2 ms because it didn't run fast enough when I set the timing to 1 ms. This means you can update the FM modulation at a rate of 500 Hz. If you wanted to modulate the signal with a square wave, you could run it at 500 Hz by switching between two values each time through the loop. But if you want a smoother FM modulation (sine, triangle, sawtooth), you will have a lower maximum modulation frequency. I mentioned 50 Hz because that gave the sine wave modulation 10 samples per cycle which gives a smaller jumps in frequency over time.

I will take a look at what it will take to speed it up and get back to you. There are a few things that might increase speed some, but not orders of magnitude improvement.
Randall Pursley
Message 11 of 16
(987 Views)
Hi Randall,

Thank you very much for useful advice, I think I got your methodology in generating these real time signals.
If I directly apply the mathematics to generate the waveform, it will be consisting of many frequency components, as the frequency is modulated and changing back and forth. The DAQ hardware channel, no matter using DAQmx or Traditional DAQ, can only generate waveform of single frequency. So I must send part of the FM signal to the channel, wait till it was generated then erase the it and resent the other frequency component! This approach is too slow and not applicable for real time FM generation.
Therefore you use the "dithering" technique to change the sampling clock rate to generate the real time FM waveform haha 🙂 .
Although I am not familiar with dithering but I only known it was used in graphical application where only black and white dots are used to generate grey level. There varying locations of B/W dots appear to be an illusion of grey level but actually no grey colors exist.

Please correct my ideas if they are wrong and I am thinking to try real time Amplitude Modulation. Again, do I need to use dithering to adjust the sampling scale in this AM case? 🙂

Thank you for patient and I am learning new things this time! 🙂

Regards,
Rolly
0 Kudos
Message 12 of 16
(973 Views)
You have it mostly right. DAQ can generate any waveform you want as long as it is below its maximum sampling rate. You can also download the whole waveform once (thousands of points) and have it repeat endlessly by reading the waveform as it is stored in memory. So if you know the whole repeating cycle of data for the FM modulation signal, and you download it, it will work because it will be in memory (i.e. if you sample at 50 kHz and generate 5 kHz signal with a 1 kHz modulation, it only takes 10 points to get one cycle of 5 kHz, but it takes 50 points to get one complete cycle of the 1 kHz modulation of the 5 kHz signal. If you repeat the same 50 points you will output a waveform that will look like a 5 kHz signal with a 1 kHz modulation but you wouldn't be able to change it without restarting the program and selecting a different waveform with different parameters to download into memory).

In my approach, I only have to download a waveform once. While the DAQ program is repeatedly outputting the same waveform I alter the sampling frequency to change the apparent frequency of the outputted waveform (i.e. if you sample at 50 kHz and the waveform is 10 points, then the waveform will be at 5 kHz. If the sampling frequency is then altered to 48 kHz, then the same 10 points will be 4.8 kHz. This is what I meant by 'dithering'

As for AM modulation, you will have the same challenges.

Can you describe your application? What is the modulation signal?
Randall Pursley
0 Kudos
Message 13 of 16
(964 Views)
I am doing a project related to sonic vibration studies and I want to generate FM/AM voltage signal to feed to an amplifier to give sound of different frequencies.

Thank you for your kind advice and please have a look at the pic attached. I still have questions to clear up 🙂
0 Kudos
Message 14 of 16
(959 Views)
Take a look at the attached vi and then ask questions if you have any.
Randall Pursley
Message 15 of 16
(936 Views)
hi Randall,

Thank you for your LV example, it works fine.
I am trying to write my own code in VC++ .Net(MFC) for this FM/AM generation, but it was more demanding than the LV platform. I can build the framework for all parameters (ie. Carrier Freq, Modulation Freq, Modulation Index, Amplitude) but as I came to the the array size, sampling rate, buffer size, I don't know what to do??

Can you please have a look?

Thank you very much!

Regards,
Rolly
0 Kudos
Message 16 of 16
(884 Views)