08-16-2018 07:20 AM - edited 08-16-2018 07:26 AM
I have been using the code provided by Aaron O to switch between various waveforms without stopping generation with PXI-5412:
I have two general questions related to Arbitrary Waveform Output Mode.
Gain = 1
Gain = 5
Where these distortions may come from, and is it possible to remove or reduce them with some VIs?
Any comments are welcome and appreciated.
08-16-2018 09:37 AM
@artkop
- Am I right in thinking that the frequency of the output signal equals the sample rate divided by the number elements in a waveform array, which means that there are only two ways to change the frequency of the output signal: (1) change the number of elements in the waveform array, and (2) change the sample rate?
Sounds about right.
I have noticed that when Gain set by Configure Arbitrary Waveform VI is higher than unity, the output signal experiences some distortions in the beginning of signal generation:
Where these distortions may come from, and is it possible to remove or reduce them with some VIs?
Any comments are welcome and appreciated.
The glitches you are seeing appear to be coming from the reconfiguration of the analog front end of the device. When you change the gain, there's a good chance that relays need to flip in order to route the output of the DAC through different amplifiers. You have two options:
Good luck!
08-17-2018 03:21 AM - edited 08-17-2018 03:23 AM
@kirsch
- Have improved control over when this reconfiguration happens by calling Commit() explicitly. This assumes you are not in the Running state (meaning the device is not generating). At commit, the driver will do all analog reconfiguration. You ca wait for output to settle and then call Initiate() at which point waveform generation begins and you should not see any glitches. Depending on your application, this may or may not be a viable solution.
I tried using Commit(), Wait() and Initiate(), and also just Commit() and Initiate() without Wait(), but, unfortunately, I did not see much of an improvement. Waiting for output to settle in this way seems only to lengthen the time between glitches and the starting point of a signal:
Short delay between Commit() and Initiate()
@kirsch
- Set your Gain up to the maximum value you need upfront. Then control the signal either by not using the full range of the waveform (-1.0 to 1.0). The tradeoff is that you are giving up dynamic range by using less of the DAC's resolution. Also, by amplifying signals more than you need to, it will raise the noise. This may or may not be ok based on the requirements of your application. Another similar option: use NIFGEN_ATTR_DIGITAL_GAIN property which will do the math on the signal before it is fed into the DAC.
Setting Gain up to the maximum necessary value upfront did not help either.
The maximum range of the waveform is (0,75 to -0,15). DC offset is 0,3. So the waveform with the maximum amplitude looks like this:
Waveform mith max amplitude
I also need the amplitude range of the output signal to be (-1,5 to 7,5). Therefore, setting Gain to 5 is unavoidable.
Anyway, thank you for your advice!