From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA Sine Wave Generator - how to control the amplitude?

Solved!
Go to solution

What is a good way to programmatically control the output amplitude of the FPGA Sine Wave Generator, before sending it to the physical AO?

I guess I should set full scale amplitude from the block diagram of the Sine Wave Generator and rescale it before sending in to the output. I use I16 for the sine output, which matches the AO connector input.

In my application I'd like to be able to rescale the sin amplitude from 0V to 10V with a fine grain, so not only dividing by 2.

Thanks

0 Kudos
Message 1 of 2
(3,405 Views)
Solution
Accepted by topic author fpdx

The only way to implement a fine gain is to add a Multiplier in your signal path before sending the data to your physical AO.

You have different approaches you can use to do this but the most correct is probably to use fixed-point arithmetic.

Your operations could for example be.

1 - convert your generator data (here assumed to be I16) to FXP <+/-, 16, 16>. This keeps your original data range and resolution

2 - multiply with a gain factor of type FXP <+, 16, 1>. The range for your gain is [0, 1.999..] but this allows you to define a gain of exactly 1.000. Note that any gain value bigger that 1.000 will end overflowing your AO data.

3 - configure the output of your multiply to FXP <+/-, 16, 16> and cast it back to I16 before sending it out to your AO

 

Message 2 of 2
(3,386 Views)