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.

Example Code

Convert Sine Wave Generator Raw Output to Fixed Point

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW FPGA Module
  • LabVIEW

Code and Documents

Attachment

Overview

This example demonstrates how to convert FPGA sine wave generator raw output to fixed point.

 

Description

The Sine Wave Generator available in LabVIEW FPGA outputs a raw integer value for each sample of the sine wave. If you are outputting this value to an IO Node, the IO must be configured for raw data. If you would like to use fixed point data, you must convert the raw value to a fixed point value specific to the I/O. This example describes how to configure the sine wave generator for the analog output voltage module NI 9264. The generator is configured to have a maximum amplitude of 10V. The fixed point number is 20 bits in total with 5 signed integer bits. The same approach can also be used for any other analog output module which only requires some simple modifications. Find detailed information about how to makes these modifications in the Block Diagram of the attached VI.

Requirements

 Software

  • LabVIEW Full oder Professional Development System 2012 (or compatible)
  • LabVIEW FPGA Module 2012 (or compatible)
  • If running in a Real-Time context, you will need the LabVIEW Real-Time Module 2012 (or compatible)

 Hardware

  • FPGA target with access to analog output (e.g. cRIO 9118 with NI 9264 or compatible)

 

Steps to Implement or Execute Code

  1. Download and open the attached file "Convert Sine Wave Generator Raw Output to FXP LV2012 NIVerified.vi"
  2. Follow the instructions in Front Panel and Block Diagram and run the program

 

Additional Information or References

Convert Sine Wave Generator Raw Output to FXP LV2012 NIVerified.vi - Front Panel.png

 

Convert Sine Wave Generator Raw Output to FXP LV2012 NIVerified.vi - Block Diagram.png

 

**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text ‘NIVerified’. Read here for more information about the new Example Guidelines and Community Platform.**

Asa Kirby
CompactRIO Product Marketing Manager
________________
Sail Fast!

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Now_With_Underscores
NI Employee (retired)
on

I'm amazed NI doesn't include this simple explanation anywhere in their documentation.  Maybe they should do that (*hint*).

-John Sullivan
Problem Solver