LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert 4 bytes array into double number

Dear
 
I would like to convert 4 bytes into a double(or long) number.
Please open my attachment which realized in two different methods.
In some cases, one of both was Okay but another gave a trouble.
Maybe, I didn't fully understand the calculation of bits.
Could you explain the different thing between two methods?
Thank you in advance.

(attachment : 7.1 LV file or the captured image of the block diagram)

메시지가 10-20-2005 03:07 AM에 labmaster에 의해 편집되었음

Download All
0 Kudos
Message 1 of 4
(9,957 Views)
Labmaster,
look at the two constants wired to the Typecasts: one is single data type (4 bytes) and the other is double (8 bytes if I'm not wrong); therefore the outputs are different...

bye,
manga
0 Kudos
Message 2 of 4
(9,927 Views)

As Manga already mentioned, your program is flawed.

A DBL is 8 bytes, but you only provide 4 bytes. Could it be you want to convert it to SGL or to a I32 or U32 integers instead? Maybe you want to cast it to an I32 followed by a plain conversion to DBL?

It really depends on the exact definition of the problem to determine the correct solution. Do you have a few input examples and the correct output you need for each set?

0 Kudos
Message 3 of 4
(9,906 Views)
Hi Labmaster,
    The attached VI shows one way of doing this (assuming I understood your question correcly).
Good Luck!
    Simon
Message 4 of 4
(9,874 Views)