The Numeric functions are polymorphic functions. When you wire two or more numeric inputs of different representations to a function, the function usually returns the data in the larger, or wider, representation. The functions coerce the smaller representations to the widest representation before execution and LabVIEW places a coercion dot on the terminal where the conversion takes place.
However, you can configure a Numeric function to return a data type you specify. If you select fixed-point representation as the output and remove the checkmark from the Adapt to source checkbox on the Data Type page, you manually can configure the encoding of the output and how the function handles overflow and/or rounding conditions. After you remove the checkmark from this checkbox, a blue coercion dot appears on the output terminal of the function. In this situation, the width and range of the output type determines whether data loss occurs.
Configuring Output Representation
Complete the following steps to configure the representation for the output of a Numeric function.
- Right-click the function and select Properties from the shortcut menu to display the Object Properties dialog box.
- On the Output Configuration page, click the data type icon in the Representation section and select the data type you want to use for the output from the shortcut menu. LabVIEW removes the checkmark from the Adapt to source checkbox if the data type you select does not match the data type of the input values.
- If you set Representation to FXP (Fixed-point), continue to the following section. Otherwise, click the OK button to close the dialog box and apply the configuration settings.
Configuring Settings for a Fixed-Point Output
Complete the following steps to configure settings for a fixed-point output.
- Right-click the Numeric function and select Properties from the shortcut menu to display the Object Properties dialog box.
- On the Output Configuration page, click the data type icon in the Representation section and select the FXP (Fixed-point) icon from the shortcut menu. LabVIEW removes the checkmark from the Adapt to source checkbox because the fixed-point data type does not match the data type of the input values.
- Select the Rounding mode to specify how the function handles rounding conditions.
- Select the Overflow mode to specify how the function handles overflow conditions.
- (Optional) Complete the following steps to configure the Encoding of the output.
- Select Signed or Unsigned to specify whether you want to represent a signed or unsigned number.
- In the Word length field, specify the total number of bits you want to use to represent the value of the output.
- In the Integer word length field, specify the number of integer bits you want to use to represent the value of the output.
|Note Specifying Encoding has a lower impact on performance than specifying Range. The performance impact of specifying Range is minimal. However, the performance impact can be significant if you run a VI that coerces values to a desired range on a target such as FPGA.|
- (Optional) Complete the following steps to configure the Range of the output. If you select Wrap as the Overflow mode, you cannot configure the Range of the output because LabVIEW automatically sets the range to fit the encoding.
- In the Minimum field, enter the minimum value to which you want the output to conform.
- In the Maximum field, enter the maximum value to which you want the output to conform.
- In the Delta field, enter the increment between numbers within the Range.
|Note You cannot configure both Encoding and Range because the settings depend on each other. The settings you configure last are the settings that LabVIEW uses for the fixed-point number.|
- (Optional) Place a checkmark in the Include overflow status checkbox to include an overflow status in the fixed-point output. If one of the inputs of the Numeric function includes an overflow status, the fixed-point output also includes an overflow status, regardless of whether you place a checkmark in this checkbox.
- Click the OK button to close the dialog box and apply the configuration settings.