Sine Wave Generator Express VI

LabVIEW 2018 FPGA Module Help


Edition Date: March 2018
Part Number: 371599P-01
View Product Info

DOWNLOAD (Windows Only)


LabVIEW 2016 FPGA Module Help
LabVIEW 2017 FPGA Module Help
LabVIEW 2018 FPGA Module Help
LabVIEW 2019 FPGA Module Help
LabVIEW 2020 FPGA Module Help

Owning Palette: Generation VIs

Requires: FPGA Module

Generates a point-by-point sine wave using direct digital synthesis. The synthesis runs continuously from the top-level FPGA target clock to produce an accurate real-time frequency. Each execution of this VI returns the most recent sample produced by the underlying synthesis engine.

During run time, you can use the Normalize Signal Generation Parameters VI to convert frequency, phase, and duty cycle parameters to fixed-point units normalized to the clock rate.

Details  Examples

Dialog Box Options
Block Diagram Inputs
Block Diagram Outputs

Dialog Box Options

ParameterDescription
Sine ParametersContains the following options:
  • Frequency (Hz)—Specifies the output frequency in Hz. The generation process runs continuously from the FPGA clock. Each call to the Sine Wave Generator Express VI samples the current output of the look-up table. If the Show frequency terminal checkbox does not contain a checkmark, Frequency (Hz) determines the frequency of the sine output. If the Show frequency terminal checkbox does contain a checkmark, Frequency (Hz) determines the default value of the frequency (periods/tick) input.
  • Amplitude—Determines the zero-to-peak amplitude of the output sine wave. The default is the full signed range of the Amplitude resolution you select.
  • Full scale—Selects the largest possible amplitude for the Amplitude resolution you select. If Full scale does not contain a checkmark, Amplitude resolution accommodates the Amplitude you select.
  • Phase offset (deg)—Specifies the phase in degrees of the signal the Sine Wave Generator Express VI returns relative to its initialization. If the Show offset terminal checkbox does not contain a checkmark, Phase offset (deg) determines the phase offset of the sine output. If the Show offset terminal checkbox does contain a checkmark, Phase offset (deg) determines the default value of the phase offset (periods) input.
ImplementationContains the following options:
  • Look-up table size—Specifies the number of sine wave points LabVIEW stores in block memory on the FPGA target. Use the Power Spectrum Preview waveform graph to choose a Look-up table size that provides sufficient spurious free dynamic range for the application you create. LabVIEW coerces the Look-up table size you select to the nearest size supported by the FPGA target for the Amplitude resolution you select. For example, if you select an Amplitude resolution of 16 bits, the smallest Look-up table size you can use is 1024.
  • Use linear interpolation—Provides a more accurate sine output by using remaining phase accumulator bits as a fractional index into the look-up table. However, if you place a checkmark in the Use linear interpolation checkbox, you increase latency and FPGA usage. The result of the VI calculation is a 32-bit number. The VI truncates the lower 16 bits to return Sine out.
  • Amplitude resolution—Specifies the output data type of the sine wave. You can choose 8-, 16-, or 32-bit signed integers.
  • FPGA clock rate (MHz)—Specifies the clock rate at which LabVIEW builds the Sine Wave Generator Express VI. If the FPGA clock rate parameter does not match the top-level clock rate, the Code Generation Errors window returns an error when you compile. Use the Top-Level Clock FPGA Target Properties page to change the top-level clock rate.
  • Use top-level clock—Populates FPGA clock rate (MHz) with the frequency of the currently configured top-level FPGA target clock. If you do not use the Sine Wave Generator Express VI in an FPGA VI under an FPGA target in the Project Explorer window, LabVIEW uses the default value of 40 MHz for the FPGA clock rate (MHz).
  • Frequency (periods/tick)—Displays the frequency, in number of periods per tick of the FPGA clock, that corresponds to the Frequency (Hz) you specify. If you place a checkmark in the Show frequency terminal checkbox, you can use Frequency (periods/tick) to verify the programmatic frequency (periods/tick) input is correct.
  • Phase offset (periods)—Displays the number of periods by which the phase is offset. This number corresponds to the Phase offset (deg) you specify. If you place a checkmark in the Show offset terminal checkbox, you can use Phase offset (periods) to verify the programmatic phase offset (periods) input is correct.
  • Show frequency terminal—Creates a frequency (periods/tick) input on the Sine Wave Generator Express VI. If the Show frequency terminal checkbox does not contain a checkmark, Frequency (Hz) determines the frequency of the sine output. If the Show frequency terminal checkbox does contain a checkmark, Frequency (Hz) determines the default value of the frequency (periods/tick) input.
  • Show offset terminal—Creates a phase offset (periods) input on the Sine Wave Generator Express VI. If the Show offset terminal checkbox does not contain a checkmark, Phase offset (deg) determines the phase offset of the sine output. If the Show offset terminal checkbox does contain a checkmark, Phase offset (deg) determines the default value of the phase offset (periods) input.
  • Output sine and cosine—Creates a cosine out output on the Sine Wave Generator Express VI, offset by 90 degrees from the sine out output. You cannot use linear interpolation if you place a checkmark in the Output sine and cosine checkbox.
Power Spectrum PreviewDisplays a preview of the configured signal power spectrum. The peak corresponding to the configured frequency is normalized to 0 dB. The next highest peak in the spectrum gives an estimate of the spurious free dynamic range resulting from the configured implementation parameters. Refer to the support document at ni.com for information about the spurious free dynamic range.

Block Diagram Inputs

ParameterDescription
resetSets the VI to the initial state determined by phase offset (periods). The VI resets automatically when it first runs.
frequency (periods/tick)(Optional) Specifies the frequency, in number of periods per tick of the FPGA clock, of the sine wave. The output frequency depends on the top-level FPGA target clock rate. Verify the top-level FPGA target clock rate is set in the Top-Level Clock FPGA Target Properties page before you configure the Sine Wave Generator Express VI. The default corresponds to the value of Frequency (Hz) you enter in the Configure Sine Wave Generator dialog box. The step size through a 32-bit accumulator determines the frequency. The upper n bits specify the address of the sine point in a 2n element look-up table. Place a checkmark in the Show frequency terminal checkbox in the Configure Sine Wave Generator dialog box to add this parameter to the VI connector pane on the block diagram.

The value you wire to this terminal must be an unsigned fixed-point data type with a 32-bit word length and a 0-bit integer word length. If you wire a data type with a different configuration to this terminal, LabVIEW coerces the configuration to be <+,32,0>.
phase offset (periods)(Optional) Specifies the initial phase, in number of periods, of the sine wave according to the following formula.

phase offset (periods) = Phase offset (deg) / 360

The default corresponds to the value of Phase offset (deg) that you enter in the Configure Sine Wave Generator dialog box. Place a checkmark in the Show offset terminal checkbox in the Configure Sine Wave Generator dialog box to add this parameter to the VI connector pane on the block diagram.

The value you wire to this terminal must be an unsigned fixed-point data type with a 32-bit word length and a 0-bit integer word length. If you wire a data type with a different configuration to this terminal, LabVIEW coerces the configuration to be <+,32,0>.

Block Diagram Outputs

ParameterDescription
sine outReturns a signed 8-, 16-, or 32-bit integer containing the sine output point.
cosine out(Optional) Returns a signed 8-, 16-, or 32-bit integer containing the sine output point offset by 90 degrees.

Sine Wave Generator Details

If you run the FPGA VI on a development computer, the Sine Wave Generator Express VI outputs every point of the generated sine wave, regardless of the rate at which LabVIEW calls the VI. To produce the same data when you run the FPGA VI on a development computer as when you run the FPGA VI on an FPGA target, change frequency (periods/tick) to take into account the rate at which the FPGA VI calls the Sine Wave Generator VI. The following equation determines the correction for running the FPGA VI on a development computer.

frequency (periods/tick) (on development computer) = frequency (periods/tick) (on FPGA target) * FPGA loop time (ticks)

Examples

Refer to the following VIs for examples of using the Sine Wave Generator Express VI:

  • labview\examples\CompactRIO\FPGA Fundamentals\FPGA Math and Analysis\Generation\Sine Wave\Sine Wave.lvproj
  • labview\examples\R Series\FPGA Fundamentals\FPGA Math and Analysis\Generation\Sine Wave\Sine Wave.lvproj

WAS THIS ARTICLE HELPFUL?

Not Helpful