Signal Generators

cancel
Showing results for 
Search instead for 
Did you mean: 

Frequency and Gain in FGEN Arbitrary Waveform

I have been using the code provided by Aaron O to switch between various waveforms without stopping generation with PXI-5412:

https://forums.ni.com/t5/Example-Programs/FGEN-Arbitrary-Waveform-Switch-Waveforms-While-Generating/...

 

I have two general questions related to Arbitrary Waveform Output Mode.

  1. 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?
  2. 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:

Gain = 1Gain = 1Gain = 5Gain = 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.

0 Kudos
Message 1 of 3
(3,355 Views)

@artkop 
  1. 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:

  • 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.
  • 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.

 

Good luck!

Marcos Kirsch
Chief Software Engineer
NI Driver Software
Message 2 of 3
(3,336 Views)

@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()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 amplitudeWaveform 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!

0 Kudos
Message 3 of 3
(3,326 Views)