Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

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

Primary Software: Driver Software>>NI-RIO
Primary Software Version: 2.4
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
How can I use fixed-point data with LabVIEW FPGA Math and Analysis functions that only support integer data?

Solution:
As of LabVIEW 8.5.x, the LabVIEW FPGA Math and Analysis functions only support integer data types.  If a fixed-point number is passed directly a function, the fractional portion will be truncated when the number is coerced to an integer.

In order 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 uses arrays of fixed dimensions you must select VI Properties, select Execution and check 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 VI in order to remove the fixed-point radix.
  3. Convert this array of Booleans to an integer using the Boolean Array to Number VI

Integer to Fixed-Point Conversion

  1. Convert integer value to an array of Booleans using the Number to Boolean Array VI, .
  2. Right click on the Boolean Array to Number VI and select Properties.  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. 

An example for using PID, DC/RMS, and Sinewave generation is attached below.



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

Attachments:
Fixed Point to Legacy IP with LabVIEW FPGA 8.5.xFXP to Legacy IP_85.zip




Report Date: 03/17/2008
Last Updated: 05/16/2008
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