WORD_TO_FIX16

WORD_TO_FIX16 1:

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).

WORD_TO_FIX16 2: Return value

Name

Type

Description

WORD_TO_FIX16

T_FIX16

 

WORD_TO_FIX16 3: Inputs

VAR_INPUT
    in : WORD;(* 16 bit fixed point number *)
    n  : WORD(0..15);(* number of fractional bits *)
END_VAR

Name

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_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)