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).
FUNCTION WORD_TO_FIX16: T_FIX16
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 be integrated (category group) |
---|---|---|
TwinCAT v3.1.0 |
PC or CX (x86, x64, ARM) |
Tc2_Utilities (System) |