WORD_TO_FIX16
The function converts a WORD variable to a 16-bit fixed-point number (the WORD variable contains the coded digits and decimal places for the fixed-point number).
VAR_INPUT
VAR_INPUT
in : WORD; (* 16 bit fixed point number *)
n : WORD(0..15);(* number of fractional bits *)
END_VAR
Example:
PROGRAM WORD_TO_FIX
VAR
double: LREAL;
END_VAR
double := FIX16_TO_LREAL(WORD_TO_FIX16(2#0000110010000000, 8));
The value of the double variable is: 12.5
Requirements
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT v2.10.0 Build >= 1326 | PC or CX (x86, ARM) | TcUtilities.Lib |