FIX16Align

This function can be used to change the resolution (number of decimal places) of a signed 16-bit fixed-point number. The function supplies the new fixed-point number as return parameter.
 Return value
Name  | Type  | Description  | 
|---|---|---|
FIX16Align  | 
  | 
 Inputs
VAR_INPUT
    in : T_FIX16;
    n  : BYTE(0..15);
END_VARName  | Type  | Description  | 
|---|---|---|
in  | Fixed-point number whose resolution is to be modified  | |
n  | BYTE(0..15)  | Fixed-point number whose resolution is to be modified  | 
Example:
PROGRAM FIXALIGN
VAR
    q8, q4 : T_FIX16;
    result : LREAL;
END_VARq8 := LREAL_TO_FIX16( 0.6, 8 );
result := FIX16_TO_LREAL( q8 );(* The result is: 0.6015625 *)
q4 := FIX16Align( q8, 4 );
result := FIX16_TO_LREAL( q4 );(* The result is: 0.5625 *)Requirements
Development environment  | Target platform  | PLC libraries to be integrated (category group)  | 
|---|---|---|
TwinCAT v3.1.0  | PC or CX (x86, x64, Arm®)  | Tc2_Utilities (System)  |