FIX16_TO_WORD

FIX16_TO_WORD 1:

This function converts a 16-bit fixed-point number to a WORD variable (the WORD variable contains the digits and decimal places for the fixed-point number).

FUNCTION FIX16_TO_WORD: WORD

VAR_INPUT

VAR_INPUT
    in : T_FIX16;
END_VAR

in: fixed point number to convert (type: T_FIX16).

Example:

PROGRAM FIX_TO_WORD
VAR
    fp16 : WORD;
END_VAR
fp16 := FIX16_TO_WORD(LREAL_TO_FIX16(12.5, 8));

The value of the fp16 variable is: 2#0000110010000000.

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)