LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2's comp binary Exponent/Mantissa

 
How do I handle a 64 bit word where the exponent is at the beginning of the Binary?
 
I have 4 - 16 bit words that comprise a GPS Time stamp.
The format is as follows
 
Binary Format: SEEEEEEEEmmmmmmm....m
S: sign
E: 8 bit exponent
m: 55 bit mantissa
 
Exponent signal type:
Excess 128
MSB 2^7 
LSB 2^0
Resolution 1
 
Mantissa signal type:
Unsigned
MSB 2^-2
LSB 2^-56
Resolution 1.3878E-17
 
Any ideas out there?
0 Kudos
Message 1 of 5
(5,206 Views)
Hello jdam,

this looks like a IEEE 64-bit binary.
Try to read it as a DBL. I think it will turn out right the first time. If not try some of the read option (MSB/LSB difference)

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 2 of 5
(5,197 Views)

TonP wrote: Hello jdam, this looks like a IEEE 64-bit binary.

No, DBL has 11 bits in the exponent, not just 8. (SGL has an 8 bit exponent, but is only 32 bits long).

IEEE_floating-point_standard

LabVIEW Data Storage

It should not be too hard to implement this conversion using some masking, shifting and bit twiddling. Unfortunately, you loose 3 bits worth of resolution in the mantissa going to DBL, so you would need to go to EXT.

Message 3 of 5
(5,188 Views)

Altenbach,

Thank you for the input and congrats on surpassing the 4k mark. Easy to see why!

Fortunately this problem comes with an example that I can use to test out my vi.

The example is as follows.

Example: The number -5.25 represented in DBL

Sign                     Exponent (8 bits)                   Mantissa (55 bits)

1                          10000011              0101000000000000000000000000000000000000000000000000000

Exp = 10000011 = 131 dec = 131-128 = 3

Mantissa = -(2^-1 (hidden) + 2^-3 + 2^-5) = - (0.5 + 0.125 + 0.03125) = -0.65625

Decimal equiv = -0.65625 x 2^3 = -5.25

Your wisdomm is always appreciated.

 

0 Kudos
Message 4 of 5
(5,161 Views)

Altenbach,

Can you share some our your vast wisdom concerning binary data manipulation?

I'm still working the Satellite data messages and I've come across this problem.

Three (3) unsigned 16 bit words comprise the following three variables Mo (24 bits), af0 (11 bits) and af1 (11 bits)

Word 1 - Mo (Part A)      Word 2  -  Mo (Part B), af0 (Part A)           Word 3 - af1, af0 (Part B)

(Mo) Snnnnnnnnnnnnnnn    +   (Mo)  nnnnnnnn    (af0) Snnnnnnn        (af1) Snnnnnnnnnn   (af0) nnn

(last two bits of word 3 are set to logic 0 and not used)

Mo (LSB -23, MSB -1) resolution = 1.1921E-07

af0 (LSB -20, MSB -11) resolution = 9.536743E-07

af1 (LSB -38, MSB -29) resolution 3.637979E-12

Is there a way to manipulate the bits and use scaling to solve this problem? I'm having difficulty.

What would you suggest?

0 Kudos
Message 5 of 5
(5,114 Views)