From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-6062E FM signal generation with DAQmx

Hi everyone,
I am trying to use the NI-6062E DAQ card to generate an AC voltage signal and I found 2 relevent example:
(1)Cont Gen Voltage Wfm-Int Clk.vi found in LV7.1 DAQmx examples
(2)Function Generator with FM.vi also found in LV7.1 examples

But I have it hard to implement the 2nd vi directly into the 1st one and it looks like I have to make change to the subVIs?
I am trying to modulate a 500Hz sine wave with frequency of 10Hz, can anyone help?

Thank you!
0 Kudos
Message 1 of 16
(3,406 Views)
Are you trying to do this as a real-time signal or are you generation the waveform ahead of time and sending it out?

An FM modulated signal is defined as

f(t) = A*cos(2*pi*fc*t + m*sin(2*pi*fm*t))

where
A = amplitude of signal
fc = carrier frequency (500 Hz)
m = modulation index (how big of a swing in frequency that you want)
fm = modulation frequency (10 Hz)
pi = pi

so a formula node might be the easiest way. To generate a complete cycle, you will have to generate 0.1 seconds of data, then you could repeat it continuously without any discontinuitues.

Clearly the carrier and modulation can be something other than sinusoids, but this is how it is usually represented.

Attached is an example of generating the waveform.
Randall Pursley
0 Kudos
Message 2 of 16
(3,396 Views)


@rpursley8 wrote:
Are you trying to do this as a real-time signal or are you generation the waveform ahead of time and sending it out?

An FM modulated signal is defined as

f(t) = A*cos(2*pi*fc*t + m*sin(2*pi*fm*t))

where
A = amplitude of signal
fc = carrier frequency (500 Hz)
m = modulation index (how big of a swing in frequency that you want)
fm = modulation frequency (10 Hz)
pi = pi

so a formula node might be the easiest way. To generate a complete cycle, you will have to generate 0.1 seconds of data, then you could repeat it continuously without any discontinuitues.

Clearly the carrier and modulation can be something other than sinusoids, but this is how it is usually represented.

Attached is an example of generating the waveform.




Hi Randall,
Thank you for your reply, yes and I am trying to generate this real time signal on the NI-6062E Analog Output channel, but I find it difficult to insert either your example 🙂 or the example FM vi from LV7.1 into the following VI?
I think it also needs to deal with hardware channel config (for sample clock rate) using DAQmx? or I need to make change to the subVI such as Waveform Buffer Generation.vi or even further the Basic Function Generator.vi?

Thank you for your patient.

Regards
Rolly
0 Kudos
Message 3 of 16
(3,388 Views)
Hi,

This is me again. I found there is something interesting in the Cont Gen Voltage Wfm-Int Clk.vi. While I changed the desired frequency output, the Resulting Sample Clock Rate also changed but it was not make visible in the original front panel.

As I am looking at Randall's example, the sampling frequency is fixed as an input, so what can I do?

Thank you!
Regards,
Rolly
0 Kudos
Message 4 of 16
(3,385 Views)
OK, try this modified example, in the while loop I am dithering the sampling clock to get the FM modulation. The modulation index indicates the magnitude of the dither in Hz. 1000 will swing the frequency +/- 1000 Hz.
Randall Pursley
0 Kudos
Message 5 of 16
(3,380 Views)
Hi Randall,

thank you for the example 🙂 but I found that I can no longer change the output Desired Frequency which means the VI generated fixed 500Hz with modulation despite I changed to 1KHz?

besides, how can I adjust the modulation frequency in this VI?

Many thanks for your patient! 🙂

regards,
Rolly
0 Kudos
Message 6 of 16
(3,369 Views)
Now you can. There are a couple things. One, you have to stop this vi to change everything but the 'Modulation Index' and 'Modulation Frequency'. Those you can change while the vi is running. Two, the while loop is roughly loops every 2 ms which seems to be the fastest it can be run as it is. You will not get as good results if your modulation frequency is higher than around 50 Hz.
Hope this helps.
Randall Pursley
Message 7 of 16
(3,366 Views)
Thank you Randall!

It works fine and I check the output on a Tek TPS-2012, since I am learning about FM, I found the larger the M-Index the greater the fluctuation from carrier frequency, just as the formula says! 🙂

However is it possible to increase the modulation frequency above 50Hz? Is this limitation due to hardware? (NI-6062E is a PCMCIA DAQ card and it's output is limited to 850KS/s, correct me if I am wrong 🙂 ) Or I need to optimize the VI in order to increase the modulation frequency, to about 1KHz?

Thank you!

Best Regards,
Rolly
0 Kudos
Message 8 of 16
(3,347 Views)
Since you are updating the sampling frequency by computing the next value, the while loop runs at 500 Hz which is as fast as I could get it to go. If you run faster then 50 Hz you will get a choppy change in frequency, but you can do it.

The only way I can think of to get it faster is to compute the values ahead of time and store them in an array and feed them into the while loop. I'm not sure what the upper limit would be in this case but it might be faster. Since LabVIEW only allows timing down to a ms, I don't know how you would be able to tell how fast the loop is running if you get to sub ms timing.

Also, if you made the while loop a subvi and only fed the modulation frequency and index as inputs, it would run faster, but you would lose the capability of changing them on the fly.
Randall Pursley
0 Kudos
Message 9 of 16
(3,342 Views)
Hi Randall,

Please have a look at this VI as I had mentioned in my 1st post, is it possible to output the FM waveform to the hardware channel? Is this also limited to 50Hz of modulation? Please help to mod 🙂 !

Thank you for patient

regards,
Rolly
0 Kudos
Message 10 of 16
(3,331 Views)