Reading binary files, unflatten binary string 
Author Message
 Reading binary files, unflatten binary string

I am reading a binary file in labview and would like to convert the
data to numbers. The binary file is a report from an external
datalogger, WebDAQ/100 which ftps the report in binary format to a
file. LabVIEW reads this file (which is a .dat-file right now.
Anything else better?)
I've tried several Read file functions. One of them gives me a binary
string. Using the Unflatten from string from there causes problems...
I've tried different options for the TYPE-input, and they give
different answers, but none of them give the data which the datlgooger
i sending. How do I know that to put in the cluster on the type-input?
Or if it shouldn't be a cluster at all, what should it be? I really
hope someone can help me, because I'm feeling really desperate!!

-Frustrated student...



Fri, 09 Sep 2005 14:44:26 GMT  
 Reading binary files, unflatten binary string
You need to read and decode the binary data based on a description of
the binary format. I have not used WebDaq myself, but I found a
partial description at:

http://www.microdaq.com/product/data-aquisition/webdaqHELPmanual/inde...

The easiest would probably be to select the text format instead, then
the decoding would be more or less self-explanatory.

On the same site it is stated that there are examples on how to
retrieve report data into LabVIEW in the /prog/lv directory , you
might find info there on how to read the binary format.

See:

http://www.microdaq.com/product/data-aquisition/webdaqHELPmanual/prog...

If you save a report in both text and binary format you can compair
their contents and figure out the format. Uploading such a pair of
files here might enable some of us to help you.



Fri, 09 Sep 2005 19:48:24 GMT  
 Reading binary files, unflatten binary string

Hei Mads ;)

Thanks a bunch for answering my question :)

I've looked through the webDAQ's website more than once, but I just
can't find anything there that can help me now....

You're saying that I could just use the text format instead, and
that's what i did originally. I'm only trying to use the binary format
instead because I thought that everything would run faster. Do you
think that would help?

I've saved two files holding reports from the webDAQ. They are both
generated by one channel and the scannumbers and each of the file
contains 100scans. (Giving 200 numbers.) Does these files tell you
anything??

-Hope you can help me :)

Hilsen Margrete

  webdaq_bin2.txt
1K Download

  webdaq_text2.txt
< 1K Download


Sat, 10 Sep 2005 09:36:15 GMT  
 Reading binary files, unflatten binary string
The binary file looks like this:

B004 2020 2701 2020 2020 2020 2080 A643 2801 2020 2020 2020 2080 A643
2901 2020 2020 2020 2080 A643 2A01 2020 2020 2020 2080 A643 2B01 2020
2020 2020 2080 A643 2C01 2020 2020 2020 2080 A643 2D01 2020 2020 2020
2080 A643 2E01 2020 2020 2020 2080 A643 2F01 2020 2020 2020 2080 A643
3001 2020 2020 2020 2080 A643 3101 2020 2020 2020 2080 A643 3201 2020
2020 2020 2080 A643 3301 2020 2020 2020 2080 A643 3401 2020 2020 2020
2080 A643 3501 2020 2020 2020 2080 A643 3601 2020 2020 2020 2080 A643
3701 2020 2020 2020 2080 A643 3801 2020 2020 2020 2080 A643 3901 2020
Etc..

The section 2020202020202080A643 is repeated throughout the file, all
or parts of it is probably a delimiter. 20202020202020 equals 7 space
characters.so that is very likely a delimiter.

Now the numbers between the delimiter is:

2801
2901
2A01
2B01
2C01
etc

From the text file we saw that the log contains a scan number, a
number that increments by 1 for each new line

If the byte order is LSB first then the numbers above equals:

0128h = 296d
0129h =  297d
012Ah = 298d

etc.so this is probably the scan number.

In the text report the recorded value is constantly 333.

Perhaps this is the A643 part of the repeating string? If it has the
least significant bit first as well then the recorded value equals
43A6h = 17318. Could that be correct, or should the answer be 333 just
like in the text file?

It might be easier to decode the file if it contains samples of
different values.



Sat, 10 Sep 2005 18:31:38 GMT  
 Reading binary files, unflatten binary string
Hi :) Thanks again!!!!!

Both files are supposed to be identical. With the constant value of
333 in addition to a scan number. (The scan numbers might vary between
the files, but it's the same amount of data in both of them.) I
actually thought it would be easier to decode the file with constant
values because that way I know what I'm looking for...

However, I've actually kind of given up this option now and I'm trying
to solve my problem from the HW side. (Meaning that I won't need to
use the binary format, which makes evereything easier.)

Thank you very much for being such a big help! You're the best :D



Tue, 13 Sep 2005 09:51:28 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Reading a binary file / writing binary data to a file

2. Reading binary files (or strings)

3. convert binary number to binary string

4. Converting Binary To String (with out binary representation)

5. Converting VMS binary files to PC binary

6. Writing, reading, and splitting strings of binary

7. Writing, reading, and splitting strings of binary

8. search string in binary file

9. String substitution in large, binary files...

10. Search for a string in binary files

11. Hex String to Binary File?

12. binary file read/write acces

 

 
Powered by phpBB® Forum Software