Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
7 ratings:
 3.57 out of 5   

Archived: Using Fixed-Point Data Types with Integer-Based IP in LabVIEW FPGA 8.5.x and 8.6.x

This document has been archived and is no longer updated by National Instruments

Primary Software:
Primary Software Version: 8.5
Primary Software Fixed Version: N/A
Secondary Software: N/A

How can I use fixed-point data with LabVIEW FPGA Math and Analysis functions that support only integer data in Labview FPGA Module 8.5.x and 8.6.x?

In LabVIEW 8.5.x and 8.6.x, the LabVIEW FPGA Math and Analysis functions support only integer data types. If a fixed-point number is passed directly to a function, LabVIEW truncates the fractional portion when the number is coerced to an integer.

To use fixed-point data with integer IP, you must sign extend the fixed-point data by increasing the integer word length to the size of the integer used. The steps below detail the method to pass a fixed-point number as an integer to the DC and RMS Measurements Express VI, which uses an I16 data type.

Note: To ensure the Number to Boolean Array function uses arrays of fixed dimensions you must select VI Properties, select Execution and place a checkmark in the Autopreallocate arrays and strings checkbox.

Fixed-Point to Integer Conversion

  1. To Fixed-Point function will sign extend the fixed-point value to integer width.
  2. Convert the fixed-point number to an array of Booleans using the Number to Boolean Array function in order to remove the fixed-point radix.
  3. Convert this array of Booleans to an integer using the Boolean Array to Number function.

Integer to Fixed-Point Conversion

  1. Convert integer value to an array of Booleans using the Number to Boolean Array function.
  2. Right-click the Boolean Array to Number function and select Properties from the shortcut menu. Change the representation to fixed-point and fill in the Fixed-Point Configuration according to the properties of the fixed-point data type on the FPGA target.

In LabVIEW 2009 or later, use the Fixed-Point to Integer Cast function or the Integer to Fixed-Point Cast function for functions that do not support fixed-point data. Wire fixed-point data to the Fixed-Point to Integer Cast function to interpret fixed-point data and produce integer data. Wire integer data to the Integer to Fixed-Point Cast function to interpret integer data and produce fixed-point data.

Additionally, in newer versions of LabVIEW FPGA Module, the Math and Analysis functions directly support fixed point data.

An example for using PID, DC/RMS, and Sinewave generation is attached below for LabVIEW versions 8.5 and 2009 and newer.  A png snippet of the code shown here is also attached.

Related Links:
KnowledgeBase 4DPGKPKO: How Can I Transfer My Fixed-Point Data Using a FIFO or Memory in LabVIEW 8.5.x?
KnowledgeBase 4FSHBMLX: Using Fixed-Point Data with CompactRIO and LabVIEW FPGA

Fixed Point to Legacy IP with LabVIEW FPGA 8.5.xFXP to Legacy
FXP to Legacy IP
FXP to Legacy IP.png

Report Date: 03/17/2008
Last Updated: 04/22/2015
Document ID: 4JGA2HLX

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit