You cannot use a fixed-point decimal notation to directly express fractional data. You must specify constants in hexadecimal format.
 |
Tip Fractional constants must be greater than or equal to –1.0 and less than 1.0. |
Complete the following steps to specify a constant in fractional notation.
- Express the value as a floating-point number.
Example: 0.75
- Multiply the floating point number by 32,768.0 for a fract16 constant or 2,147,483,648.0 for a fract32 constant.
Example: 0.75 * 32,768.0 = 24,576.0
- Truncate, or fix, the result to a 16-bit integer for a fract16 constant or a 32-bit signed integer for a fract32 constant.
Example: FIX(0.75 * 32,768.0) = FIX(24,576.0) = 24,576
- Express the fixed-point number as a hexadecimal value.
Example: FIX(0.75 * 32,768.0) = 24,576 = 0x6000
Entering Hexadecimal Constants in LabVIEW
You can create constants for the Blackfin Analysis Library and Blackfin Numeric VIs in two ways:
- Use the fract16 and fract32 custom controls on the Fixed Point palette.
- Right-click an input terminal of a VI and select Create»Constant from the shortcut menu.
Complete the following steps to specify a fixed-point constant as a hexadecimal value.
- Right-click a numeric constant and change the numeric representation to I16 if necessary.
- Right-click the constant and select Format and Precision from the shortcut menu to open the Numeric Constant Properties dialog box.
- Click the Format and Precision tab.
- Select the Advanced editing mode radio button.
- Enter 0x%04.4x in the Format string text box.
- Click the OK button to display the constant as a hexadecimal value.