LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

64-bit binary indicators

Hello there, fellow LabVIEWers! I'm in a bind that I hope that you can get me out of. I'm trying to take a 48 bit number and shift it to the left by 8 bits. Problem is, I can only view up to 32 bit numbers and whenever my value is higher than 4294967296 (which is 2 to the 32nd power), LabVIEW stops at that value. I need to view a number higher than 32 bits and so far, I haven't had much success than doing so. Please help!
0 Kudos
Message 1 of 4
(3,066 Views)
32 bit integers are a limitation of the operating system. To use numbers higher than 2^32, use double precision numbers. LabView's Logical Shift function really works on integers (regardless of the representation of the number you feed it), so you can't shift numbers bigger than 2^32.

Doing logical shifts is really like multiplying by powers of two: shifting a number left 8 bits is equivalent to multiplying by 2^8. Multiply by 2^n to shift left n bits. Dividing to shift right works up to a point: you need to decide what to do with fractions, like truncate.

If you use doubles for your numbers and multiply by powers of two, you can use (and display) numbers much higher than 2^32.
Message 2 of 4
(3,066 Views)
If you use integers with more than 32 bits, you have to use your own
representation. At the first shot I would use an array of U8...
In this case, shifting your number by 8 bits to the left is done with
appending a new U8 in the right place. In LSB notation you would
insert a zero at array index 0.

You could use doubles or extended floating point numbers to, but
especially on extended numbers you get problems with accuracy. (Just
look to your next source of information about floating point formats
according IEEE754 - I hope I got the correct norm).

If you only use binary indicators (as your topic says), why not use
an array of bits?

Best regards
Gerd Wieczorek
gerd.wieczorek@epost.de
0 Kudos
Message 3 of 4
(3,066 Views)
Azmat Bhatty wrote in message news:<50650000000800000070670000-1031838699000@exchange.ni.com>...
> Hello there, fellow LabVIEWers! I'm in a bind that I hope that you
> can get me out of. I'm trying to take a 48 bit number and shift it to
> the left by 8 bits. Problem is, I can only view up to 32 bit numbers
> and whenever my value is higher than 4294967296 (which is 2 to the
> 32nd power), LabVIEW stops at that value. I need to view a number
> higher than 32 bits and so far, I haven't had much success than doing
> so. Please help!

Is this 48 bit number for mathmatical operations, or do you just need
to display it on the front panel?

If you just need to display it, convert it to a hex or binary string
(format value.vi, and wire in %b for binary,
%x for hex), then a left
shift becomes a matter of splitting and rearranging the string.

If you need to do math on this number, then you are into much deeper
work, probably involving splitting the number up into 2 chunks and
calculating on each half.
0 Kudos
Message 4 of 4
(3,066 Views)