LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sine Wave Generator Express VI Look-Up Table Size

I'm just looking for an explanation for what the look-up table size does to the actual signals being produced. I see the power spectrum preview but I'm quite confused as to how that pertains to generating a low power, low frequency sine wave. I am sending the output of this VI straight into a scaling math function and then sending that out to a C series output module. I am noticing the higher look-up table size I use; the drastically more block RAMs the build takes up. Is there really any benefit to using a higher look-up table size?

0 Kudos
Message 1 of 17
(2,693 Views)

Hi M,

 


@MGardner5 wrote:

I am noticing the higher look-up table size I use; the drastically more block RAMs the build takes up. Is there really any benefit to using a higher look-up table size?


The larger the LUT, the more accurate the output data: when using a (theoretical) LUT of just 2 values you would not get a sine signal at all with linear scaling between those two values. When the LUT provides a value for each 5 degree (19 samples from 0° to 90°) even with linear scaling inbetween the signal will look much more like a sine. With a LUT size of 91 samples (0° to 90° with steps of 1°) you will hardly notice a difference to a real sine…

 

That's a typical trade-off: how much BRAM (or FPGA fabric) do you can afford compared to the signal quality you get/need!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 17
(2,642 Views)

Hi Gerd,

 

Thanks for the reply, how does this play into the output resolution settings? I notice some of the LUT selections get grayed out depending on which resolution I choose. I am noticing I threw all my LUT selections to the minimum (512?) and now my external circuitry is not picking up the sine waves at all. I was using about 100% of my block RAMs before I switched them all to the minimum. I have about 10 sine wave generator VIs in my build and they worked the way I had them I was just worried if I ever had to expand the project I did not want to hurt my performance if I had to add more RAM demand. Is there any worry of using near 100% all the time?

 

Thanks

Matt

0 Kudos
Message 3 of 17
(2,617 Views)

Hi Matt,

 

why do you need 10 sine wave generators? IMHO you need only one sine wave generator to create any sine signal…

 

Spoiler
I'm having some background on Assembler programming, mainly for those CPUs from 8bit/16bit era. When I needed some sine wave (or any other arbitrary signal) I was creating one (1) LUT to hold the sine data and implemented a function call to read the needed value from that LUT. Now I could call that function as often as needed, with an argument holding the angle parameter for sin(angle)…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 17
(2,604 Views)

I have a large project requiring 10 different sinusoidal signals along with a lot of other logic.

0 Kudos
Message 5 of 17
(2,591 Views)

Hi Matt,

 


@MGardner5 wrote:

I have a large project requiring 10 different sinusoidal signals along with a lot of other logic.


Please explain the term "different sinusoidal signals". A sine signal is a sine, you maybe just need to adjust amplitude scaling afterwards…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 17
(2,588 Views)

3 of them are 60Hz and 120 degrees a part, 3 are the same but phase adjusted for a power factor calculation. The other 4 are all set at different frequencies.

0 Kudos
Message 7 of 17
(2,586 Views)

Hi Matt,

 

you still can use just one LUT: you just need to read the correct value from the LUT according to the needed phase…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 17
(2,581 Views)

That doesn't matter.

 

You just need to do math on your inputs to select the correct part of your look up table.  So something that is at twice the frequency, you'd multiply your X value by a factor so it looks up the correct part of the base sine wave signal.  For a different phase, then you add some constant to your X to get to the correct part of the sine wave.  For a larger amplitude, then you'd multiple the result of the lookup table by a factor.

 

All you need is a basic sine wave that has an amplitude of 1, and nominal number of data points for a full period.

0 Kudos
Message 9 of 17
(2,579 Views)

I am not seeing how I can manipulate a sinewave on the fpga since it is represented as a single precision integer at any point in time. I cannot find any frequency changing methods or VIs within the fpga. The only way I have found is to have 10 separate sine wave generator VIs which takes up near 100% of block RAM usage. From what I can tell the sine wave generator VI doesn't create an actual sine wave function, it just outputs data points that correspond to a sinewave. I am using cRIO fpga chip hardware.

0 Kudos
Message 10 of 17
(2,542 Views)