12-15-2014 12:07 PM
Hi there,
It is probably a stupid question but I am still going to ask it:
I do not completely understand why in the "Basic Function Generator.vi" there is a distinction between the number of samples #s and the sampling frequency Fs..?
What is the purpose to have more or less samples in the generated waveform then specified by the sampling frequency of the signal?
I hope this question make sense (or am I missing something obvious)?
thanks,
Best,
Renaud
12-15-2014 12:16 PM
12-15-2014 12:18 PM
#s / Fs is the time duration of the output waveform. The default is one second at 1kHz Often you want a different length of time in the waveform.
12-15-2014 01:02 PM
Thanks for those prompt replies.
I thought it was like this by playing with those values but I was not sure.
I am sending those values to an AO (to a mechanical system that reproduce the sended waveform) and record the signal with an AI. My problem is that when I reduce the number of sample as explained in the previous message, I enhance the number of cycles i.e the time of the signal seen by the AO but it does not seem to apply to the AI... see attached image (Fs = 305000 #s=30500 AO is in white AI is in red)
Why does the #s only affect the time of AO and not the one of AI? (the number of cycle is the same though, only the time base is different)
Thanks,
Best,
Renaud
12-15-2014 01:16 PM
rihns wrote:
I am sending those values to an AO (to a mechanical system that reproduce the sended waveform) and record the signal with an AI. My problem is that when I reduce the number of sample as explained in the previous message, I enhance the number of cycles i.e the time of the signal seen by the AO but it does not seem to apply to the AI... see attached image (Fs = 305000 #s=30500 AO is in white AI is in red)
Why does the #s only affect the time of AO and not the one of AI? (the number of cycle is the same though, only the time base is different)
I think we need to see some code in order to get the full picture of what you are doing. The number of samples of the AO should have nothing to do with the AI.
12-15-2014 01:22 PM
Yes, this is what I thought...
attached is the code, do not hesitate to make as much comment as you can 🙂
Thanks,
Best
12-15-2014 01:42 PM
You really should have your Fs set to your DAQ sample rate. You can use Bundle By Name to update the Fs to match rate gx.
You should also be using Build Array and Index Array instead of the Combine Signals and Split Signals. This avoids the super annoying Dynamic Data Type and actually avoids data copies.
And as long as your loop rate is decently fast, you shouldn't need to play around with the buffer size of your analog input. Just leave the number of samples unwired so that you clear the buffer.
12-15-2014 01:52 PM
Those DDTs - Get rid of them use buid array and index array:
Y
You will save yourself a huge headache
Timing of the wavforms you generate with the Basic Function Generator vi's is ignored by DAQmx Write. The task timing is set with DAQmx Configure timing and there is no other way to change the timing. (Unless you use a DAQ Assistant and select the use wafeform timing box But, I don't recommend it and changing the timing dynamically with a waveform may cause some unexpected results)
All of wich then points to the obvious reason that only the AO sees any change from the wavform parameters- The AI Task has no data dependance on Basic Function Generator.vi
12-16-2014 06:41 AM
Thanks for those replies (I got rid of the DDTs)!!
Crossrulz:
If I remove the options on the buffer I get an error... can this be due to the fact that there is a delay of around 12ms in the signal acquisition (see image)?
Why do I need to have rate(in timing.vi) equals to Fs (in the function generator.vi)? If I try to do rate=Fs my Vi does not work anymore...
Jeff:
How do I change the timing.vi to get a writting/aqcuiring signal more than 1sec?
When I change the number of sample #s in the Basic Function Generation it is still changing the number of cycle on the AO and AI(but not the time though)...
Thanks,
Best,
Renaud
12-16-2014 06:42 AM