LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Real48 format, what's the best way to convert it?

Hi everybody,
 
I am trying to convert a binary data file into a numeric array. The data file is composed of values in Real48 format (I
guess that's because the data file was produced by a program made in Borland's Delphi). I know that Real48-values are 6-byte
long, but I am not quite sure what's the easiest way to convert them to a LabVIEW numeric format. Should I convert them to
extended or double precision values and how should I do it? Thanks for your help/suggestions.
 
Sincerely,
 
Paul Perreijn
Biometrie, Hogeschool Zuyd
The Netherlands
0 Kudos
Message 1 of 11
(5,127 Views)

Hallo Paul,

I don't know any other way then splitting up the bits and use the 'Power of X' function and include the sign bit.

struct Real48 {
   int sign : 1;
   int mantissa : 39;
   int exponent : 8;
};

(From Apeldoorn)

0 Kudos
Message 2 of 11
(5,116 Views)
Are you sure it's real48. In Delphi real is double-type now (it was real48)
0 Kudos
Message 3 of 11
(5,111 Views)

Thanks for the suggestion, however could you give me some tips on how to write this in G, because I have never used C-code in LabVIEW (besides, I don't have a visual C compiler and as far as I know I need that to use a CIN)?

The format is indeed Real48, because for some odd reason the other programmer used an ancient version of Pascal. I'll ask him never to do that again Smiley Wink

 
Sincerely,
 
Paul Perreijn
Biometrie, Hogeschool Zuyd
The Netherlands
0 Kudos
Message 4 of 11
(5,096 Views)

I wasn't suggesting that you write it in C, how could you think of itSmiley Surprised

I will work on it but there are a few angle's. Can you send me a file with some data, would be nice if you know what in the file

You canb also look at this:  http://digital.ni.com/public.nsf/allkb/C3E8E433244565F086256F6B0058E073

If you want you can mail me the data  keeswe at zonnet

 

0 Kudos
Message 5 of 11
(5,089 Views)

Thanks K C,

Sorry for my misinterpretation, after a long day of debugging my head isn't always as clear as it was in the morning Smiley Sad Maybe it's because of the suggestion in an old NI forum thread to use a C routine.

Anyway, I'll try working with the example VI in the link that you gave me. To give you an example of the mess that I have to work with, there's an example of the datafiles that I have to translate in the attachment. If you open it in notepad, you can see clearly that it not only consists of raw bytes, but also contains strings. Some of the real48 values are at the following offset positions (from the beginning of the file): starting from byte 566 there should be three real48 values (according to my technical document 'rMin','rMax' and 'rMean'). This group is preceded by the ASCII string '0000003018'. The problem is that I have no idea what the values should be. I am trying to figure it out, but it's like searching for a needle in a haystack.

Paul

 

0 Kudos
Message 6 of 11
(5,082 Views)

whoops, I really should take some rest, I accidently replied to one of your older replies. Please read reply 6. Thanks.

Paul

/getting some strong coffee to keep me awake

0 Kudos
Message 7 of 11
(5,078 Views)

Goeiemorgen zegSmiley Surprisedziet er leuk uit.

Sorry guys but we're both Dutch (I think)

I will try to fing out if the data is actual Real48 data. I modified the VI at the previous link.

Get back to you....

0 Kudos
Message 8 of 11
(5,073 Views)

Hi,

The conversion is no problem. The data in the file is. Do you know anything about the figures. Positive/negative, range or whatever.

This is what I found so far.Smiley Surprised

Real48 conversions:

2 bytes before data:

1 = 5.894775E-39
2 = -2.000000E+0
3 = 9.949082E+9


2 bytes after data:

1 = 7.132135E+19
2 = 5.911912E-39
3 = 5.884521E+0


1 byte before and 1 after data:

1 = 1.030700E-38
2 = 5.877606E-39
3 = 9.730659E-27

But i can think of much more options to read the data. So do you have more data and/or files ?  Do the figures make any sense ?

Message Edited by K C on 10-27-2005 12:53 PM

0 Kudos
Message 9 of 11
(5,051 Views)

Hi K C,

Thanks, I'll try to check the conversion. If it's ok, I'll send my 'work in progress'-vi ('in het nederlands') and the documentation (in english) to your mailbox. Maybe that will clear things up. Again, many thanks.

Paul

P.S. Groeten uit Limburg Smiley Happy

0 Kudos
Message 10 of 11
(5,030 Views)