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).
Return value
Name | Type | Description |
|---|---|---|
WORD_TO_FIX16 |
|
Inputs
VAR_INPUT
in : WORD;(* 16 bit fixed point number *)
n : WORD(0..15);(* number of fractional bits *)
END_VARName | Type | Description |
|---|---|---|
in | WORD | 16-bit fixed-point number |
n | WORD(0..15) | number of fractional bits |
Sample:
PROGRAM WORD_TO_FIX
VAR
double : LREAL;
END_VARdouble := 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) |