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; (* 16 bit fixed point number *)
END_VAR

 

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 system type

PLC libraries to include

TwinCAT v2.10.0 Build >= 1326

PC or CX (x86, ARM)

TcUtilities.Lib