Combining 2, 16 bit integer's into a IEEE 754 Float

Neil,

We have the same situation that Steve L has.  We are pulling data from a tank level system where we need to combine 2, 16 bit integer's into a single IEEE 754, 32 bit float using a standard serial card in DeltaV, 13.3.2.  You joined the discussion posting a link to a module that will do the complete combination, unfortunately that link appears to be broken.  I'm hoping the information is still out there, if so could you update the link please?

Signed,

Desperate in Ann Arbor

AKA ,Jeff Bilek

  • I recall a link to a 64 bit (4 x 16) document in the distant past. I can provide that again, but not sure that is your issue here.

    Other posts show the general approach (and Calc logic) for combining 2 x 16 bit integers to a Float.

    Point me to the specific post and the broken link and I can see if it I can help. I note one of my links was to a LinkedIn DeltaV Group that no longer appears to exist.
  • Jeff,

    In the past I have used the Calc logic as Neil has suggested. Here is a snippet of the code you can just paste into a calc block.

    ======================================================
    VAR EXPONENT END_VAR;

    VAR SGN END_VAR;

    VAR MANTISSA END_VAR;



    (* IEEE754_IN is a 32 Bit Unsigned Integer parameter *)

    (* FLOAT is a floating point parameter *)



    (* Extract the Exponent from the bits 24 to 31 of the 32 bit word *)

    (* AND Mask to extract bits 24 to 31 then shift 23 bits to the right *)

    EXPONENT := SHR((IN1 & 2139095040),23);



    (* Extract the Sign from the bit 32 of the 32 bit word *)

    (* AND Mask to extract bit 32 then shift 31 bits to the right *)

    SGN := SHR((IN1 & 2147483648),31);



    (* Extract the Mantissa from the bits 1 to 23 of the 32 bit word *)

    (* AND Mask to extract bits 1 to 23 *)

    MANTISSA := (IN1 & 8388607);





    (* The maths used to create the FLOAT from SIGN, EXPONENT and MANTISSA *)



    OUT2 := EXPONENT - 127;

    OUT3 := SGN;

    OUT4 := MANTISSA;



    OUT1 := (1+ (MANTISSA * (2 ** -23))) * (2 ** OUT2);



    IF SGN THEN OUT1 := OUT1 * -1; ENDIF;

    ============================================================


    I hope that helps!
  • Neil,

    Here is the link to the post in question.


    Let me know if it bears any fruit. 

    Thanks for your help.
    Jeff Bilek
    Instrumentation Specialist

    Central Power Plant
    734-764-3476