Example Code

Cast Two I16 Numbers into One Double Precision Number Using LabVIEW

Code and Documents

Attachment

Overview

This VI casts two 16-bit signed integer numbers (I16) into one Double Precision number.

 

Description

This VI uses the LabVIEW Typecast functionality by inputting the most significant bit (MSB) and least significant bit (LSB) Values and using the Join Numbers function.  It outputs the casted number as a double.

 

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Select the Most Significant Bit (MSB) value.
  2. Select the Least Significant Bit (LSB) value.
  3. Run the VI.
  4. Observe the Casted Number being shown as a Double Precision Floating Point Number.

 

Additional Information or References

Snippet.png

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

 

Francisco Arellano

National Instruments Mexico
Field Systems Engineer - Energy Segment
www.ni.com/soporte

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Todd S.
NI Employee (retired)
on

great stuff!!!

Todd S.
LabVIEW Community Manager
National Instruments
Daikataro
Active Participant
Active Participant
on

Worked awesome, just one observation. You describe it as taking 2 Unsigned 16 bits numbers (U16) but the actual VI asks for 16 bits signed Integers (I16) and, when translated to double precision it gives an incorrect value. It worked great when translated from 2 U16 into a Single precision float. So if anyone using this notices discrepancies from source to result, try changing typecast from double to single.