11-02-2018 03:53 AM
11-02-2018 05:12 AM - edited 11-02-2018 05:22 AM
First: have a look at the specs and the manual.
Usually
the DAC samplerate is not arbitary .. (Without digging into the details, I suspect something like 100MHz/n (n something like 100 to ???). You can check the actual used samplerate by reading the 'actual samplerate' property after a commit of the configuration.
the samplerates are limited due to memory transfer
the internal memory is limited
So, to create a waveform of a specific periode you need to choose a valid samplerate and fit n periodes into m samples. Sometimes the samplesize is also not arbitary, so m must be a multiple of 2 or 4 ....
For such low frequencies and a DMA able PXIe I expect no problems to continously stream the wfrm (save data: use U16 😉 )
11-02-2018 07:54 AM
In agreement with Henrik, just offering some thoughts in my own words.
You'll end up choosing between a simple but limited solution and a complicated but
more nearly exact solution.
1. A simple solution will want to define 1 cycle of the sinusoid with a sufficient # of points (20 is fairly decent, more is better, depends what the signal's used for). Then you'll want to set a sample rate that makes that waveform cycle at the desired waveform frequency (such as 5001 Hz).
There will be quantization effects that will prevent you from landing exactly on many of the frequencies you're aiming for. You'll often be pretty close, but rarely exact.
And that's about it, simple but limited.
2. One more complicated method will require you to continually calculate and write the next chunk of points to the task while it's running. This is one way around the quantization effect. By no longer restricting yourself to define exactly 1 cycle of the sine at a time, you can define 0.997 or 0.9942 of a cycle instead. That will allow you to generate your exact waveform frequency, but to accomplish it, you have to keep continuously calculating and writing new samples to the task, always starting and ending at different parts of the sine wave, to make a continuous-looking waveform.
3. Another more complicated method is to work through the problem in rational approximation that will let you fit N cycles of the waveform into M periods (as Henrik already mentioned) pretty much exactly. Then you can again write this bigger buffer once only and the task will keep repeating it. I wrote this up in a thread a *very* long time ago, but happened to add a useful (IMHO) update pretty recently.
-Kevin P
11-03-2018 06:02 AM
@Kevin_Price wrote:
In agreement with Henrik, just offering some thoughts in my own words.
You'll end up choosing between a simple but limited solution and a complicated but
more nearly exact solution.
1. A simple solution will want to define 1 cycle of the sinusoid with a sufficient # of points (20 is fairly decent, more is better, depends what the signal's used for). Then you'll want to set a sample rate that makes that waveform cycle at the desired waveform frequency (such as 5001 Hz).
There will be quantization effects that will prevent you from landing exactly on many of the frequencies you're aiming for. You'll often be pretty close, but rarely exact.
And that's about it, simple but limited.
2. One more complicated method will require you to continually calculate and write the next chunk of points to the task while it's running. This is one way around the quantization effect. By no longer restricting yourself to define exactly 1 cycle of the sine at a time, you can define 0.997 or 0.9942 of a cycle instead. That will allow you to generate your exact waveform frequency, but to accomplish it, you have to keep continuously calculating and writing new samples to the task, always starting and ending at different parts of the sine wave, to make a continuous-looking waveform.
3. Another more complicated method is to work through the problem in rational approximation that will let you fit N cycles of the waveform into M periods (as Henrik already mentioned) pretty much exactly. Then you can again write this bigger buffer once only and the task will keep repeating it. I wrote this up in a thread a *very* long time ago, but happened to add a useful (IMHO) update pretty recently.
-Kevin P
Thanks Kevin!
2. By continuously calculating and writing new samples to the task, do you mean sending samples from PC to the memory of the card in loop? If yes, it will add overhead delay of PC.
Please suggest if there is any alternate.
What I am doing is keeping freq 5000Hz and changing the cycles to 0.999, 0.998, 0.997 ........ What I am getting is 5000 few times and then 5002.5 few times and then 5005 ........
3. Can you explain it little more how to execute it. I define no. of samples. I can define update rate by selecting the freq to be generated Freq = Fupdate/no. of samples per cycle.
This way no. samples got saved in the memory of the card and it gives output @ Fupdate. This runs in loop.
How to adapt for your method?
11-03-2018 06:29 AM
Thanks Henrik!
We tried writing samples, defining cycles and update rate(sampling rate).
Fupdate = 50kHz, n = 10
Freq = 50kHz/10 = 5kHz
here x was 100MHz/50kHz = 2000
Changing x from 2000 to 2001.
Fupdate = 100MHz/2001 = 49975Hz
Freq = Fupdate/samples = 49975/10 = 4997.5Hz
So I am getting 4997.5, 5000, 5002.5, 5005 ......
Is there anything I am missing from your method?
11-03-2018 09:48 PM
I attached a simple but pretty complete working demo for my approach #3. I'm going to post the zip file over in the linked thread too since I've linked to that thread several times over the years and future searches are liable to lead more people there.
-Kevin P
11-26-2018 10:24 AM - edited 11-26-2018 10:26 AM
Please refer my set up . Can i use this set up to increase the internal time base clock i.e 100Mhz (used to generate sampling rate ) to 200Mhz or 500Mhz or greater . Because as we increase the internal time base clock it will decrease the frequency resolution .Refer link below . I am using PXIe 6738 as my analog out device . I dont know locking range of PLL here
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P9HgSAK
11-26-2018 03:03 PM
1. I'm pretty sure the answer's No. Most NI DAQ boards I'm familiar with are spec'ed to allow external clock signals that are *slower* than their internal timebase due to things like input circuitry and signal paths. That's a pretty hand-wavy description, but I'm not an EE.
For example, page 6 of the specifications refer to a 25 MHz max external "base clock" as compared to the available 100 MHz internal timebase.
2. However, this whole thread is about the idea that there are *other* ways to achieve better frequency resolution. The knowledgebase article you linked makes the common assumption of defining exactly 1 cycle of the AO waveform. When you take that constraint away, you can achieve very much better frequency resolution.
Have you tried the demo code I posted? Did you read the linked thread? You *can* get better freq resolution, *not* by using a faster external timebase clock (your board won't support it), but by defining your waveform over the span of a relatively large # of full waveform periods.
-Kevin P
11-27-2018 10:53 AM
Depending on your continuous updated sample rate, you can always use a continuous updated AO and generate any frequency within Nyquist ( better use >5 times oversampling ) .... so one of your cores will not be totally bored. 😄
For frequencies <20kHz you can use your PC headphone output ... (usually even higher .. but I'm not sure about 'your' PC 😉 )