Integer to Fixed-Point Cast Function

Owning Palette: Fixed-Point Functions

Requires: Base Development System

Scales the integer input to produce an output with the requested fixed-point type. This function is the equivalent of an arithmetic shift of the input with configurable overflow handling, constrained so that the least significant bit of the input becomes the least significant bit of the output.

Details  Example

 Add to the block diagram  Find on the palette
fixed-point type is the fixed-point data type to which you want to convert the integer data. You can configure the fixed-point data type in the Data Type page of the Properties dialog box. LabVIEW ignores any data in the constant or control that you wire to fixed-point type. You also can leave this input unwired and configure the output data type in the Output Configuration page of the Properties dialog box.
integer is the data you want to scale. integer can be any integer data type.
fixed-point is the input data scaled to the requested fixed-point data type.

Integer to Fixed-Point Cast Details

If the word length of integer is greater than or less than the word length of fixed-point type, LabVIEW first converts integer to the integer word length of fixed-point type before casting integer to the requested fixed-point type. The least significant bit of integer becomes the least significant bit of fixed-point, so rounding is never necessary.

To override the default behavior of this function, right-click the function and select Properties from the shortcut menu to display the Output Configuration page of the Properties dialog box. You can use this dialog box to configure the output settings of this function.

Note  The Integer to Fixed-Point Cast function combines elements of the Conversion functions, the Type Cast function, and the Scale by Power of 2 function. The Integer to Fixed-Point Cast function performs an operation that reinterprets the bits, like a cast, but also handles the numerical overflow and sign extension issues that commonly arise when combining integer and fixed-point algorithms.

Example

Refer to the Fixed-Point Cast VI in the labview\examples\Numerics directory for an example of using the Integer to Fixed-Point Cast function.

 Open example  Find related examples