LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read binary file

i have resived this binary file and i cant read it properly, i need your asistace in reding the file and telling me how.

this is what it contains:


The example file contains 2048 samples. We put the following test signals inside:
Analog input channel 1: One cycle sine wave over the full dynamic range of 12 bit.
Analog input channel 2: Two cycles of a sine wave over the full dynamic range of 12 bit.
Analog input channel 3: Signal starting at 0x000 and is increasing with every sample by one.
Analog input channel 4: Signal starting at 0xFFF and is decreasing with every sample by one.
Digital input channel 1: Digital signal which is toggling with the sample rate. Starting with 0.
Digital input channel 2: Digital signal which is toggling with the sample rate. Starting with 1.
 
 Measurement data file format
The filename is <8-digit-serialnumber>-<6-digit-treatmentnumber>.REC (e.g.
"12345678-123456.REC"). All measured data is stored binary in this file. The following
table shows the data structure in the measurement data file.
Position Data Format
Byte 1 Analog channel 1 LSB value ,value Sample 1 ,Bit 1-8: Corresponding to Bit 1-8 of 12-bit A/D
Byte 2 Analog channel 1 MSB value, Sample 1, Bit 1-4: Corresponding to Bit 9-12 of 12-bit A/D value, Bit 5-8: not used
Byte 3 Analog channel 2 LSB value ,Sample 1, Bit 1-8: Corresponding to Bit 1-8 of 12-bit A/D value
Byte 4 Analog channel 2 MSB value, Sample 1, Bit 1-4: Corresponding to Bit 9-12 of 12-bit A/D value, Bit 5-8: not used
Byte 5 Analog channel 3 LSB value, Sample 1, Bit 1-8: Corresponding to Bit 1-8 of 12-bit A/D value
Byte 6 Analog channel 3 MSB value, Sample 1, Bit 1-4: Corresponding to Bit 9-12 of 12-bit A/D value, Bit 5-8: not used
Byte 7 Analog channel 4 LSB value, Sample 1, Bit 1-8: Corresponding to Bit 1-8 of 12-bit A/D value
Byte 8 Analog channel 4 MSB value, Sample 1,Bit 1-4: Corresponding to Bit 9-12 of 12-bit A/D value, Bit 5-8: not used
Byte 9 Digital input values, Sample 1, Bit 1: Digital input 1 (high active), Bit 2: Digital input 2 (high active), Bit 3-8: not used
Byte 10 Analog channel 1 LSB value, Sample 2,Bit 1-8: Corresponding to Bit 1-8 of 12-bit A/D value
Byte 11 Analog channel 1 MSB value, Sample 2, Bit 1-4: Corresponding to Bit 9-12 of 12-bit A/D value, Bit 5-8: not used
Byte 12.....

 

 

 

i have try a lot of things by now and gut a mees, and the "read binary file' dont work so much here.

thank you.

Dana

 

 

 

0 Kudos
Message 1 of 12
(5,004 Views)

hello ,

 

you received or ou rezised ???  :smileywink:

 

i tilt for first, don't you know if it has been recorded with another labview application , in this case you just have to

request the format of cluster used for this record and "game is played"

 

other wise it may take multiple tries to approch used pattern,

 

i'll take an eye on but try to know from where this files provided , LV or other ?

 

@+

 

Tinnitus

 

 

CLAD / Labview 2011, Win Xp
------------------------------------------------------
Mission d'une semaine- à plusieurs mois laissez moi un MP...
RP et Midi-pyrénées .Km+++ si possibilité de télétravail

Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
Don't forget to valid a good answer / pensez à valider une réponse correcte
0 Kudos
Message 2 of 12
(4,987 Views)
You said you revised the binary file, which implies you were reading it at one point. What were you using to read the file? Were you using Read from Binary File or Read From Measurement File? What did you change from the original format? Read From Binary File will work, but you need to provide the correct datatype for each record, as indicated in the previous response. You also need to make sure you use the correct endianness.
Message 3 of 12
(4,983 Views)

The example file contains 2048 samples. We put the following test signals inside:

Analog input channel 1: One cycle sine wave over the full dynamic range of 12 bit.
Analog input channel 2: Two cycles of a sine wave over the full dynamic range of 12 bit.
Analog input channel 3: Signal starting at 0x000 and is increasing with every sample by one.
Analog input channel 4: Signal starting at 0xFFF and is decreasing with every sample by one.
Digital input channel 1: Digital signal which is toggling with the sample rate. Starting with 0.
Digital input channel 2: Digital signal which is toggling with the sample rate. Starting with 1.

 

also you said: one cycle ....but at witch sampling rate or how many data does it results for analog in chan 1 ?

same question for 2,,3,4 i don't understand Digital 1,2 definition ...

 

@+

 

Tinnitus

Message Edité par tinnitus le 12-25-2008 10:18 AM
CLAD / Labview 2011, Win Xp
------------------------------------------------------
Mission d'une semaine- à plusieurs mois laissez moi un MP...
RP et Midi-pyrénées .Km+++ si possibilité de télétravail

Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
Don't forget to valid a good answer / pensez à valider une réponse correcte
0 Kudos
Message 4 of 12
(4,968 Views)

hello you can try thing like that

 

i can't see sinus waves ?

 

@+

 

Tinnitus

 

 

 

CLAD / Labview 2011, Win Xp
------------------------------------------------------
Mission d'une semaine- à plusieurs mois laissez moi un MP...
RP et Midi-pyrénées .Km+++ si possibilité de télétravail

Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
Don't forget to valid a good answer / pensez à valider une réponse correcte
Message 5 of 12
(4,936 Views)
The sine waves are not there in the example file.  They are flat lines.  Attached is another example of how to do this with explicit parsing of the endianess (LabVIEW 7.1.1).  smercurio's example is far more succinct, efficient, and elegant.
Message 6 of 12
(4,907 Views)

hey

Can you tell me how you know which one of the bytes did you put with which one?

And way I can’t generate from that the digital channel?

0 Kudos
Message 7 of 12
(4,828 Views)

The byte order is determined by the information posted above about how the signal is saved.  The 16 bit data in the VI is unsigned, but it may be signed in the original.  The posted format is unclear on this.

 

Here is a direct, but inefficient, method to convert boolean arrays to  digital waveform datatypes, which can then be plotted.  This is done inefficiently so you can see the steps involved.  You could probably do this more efficiently as you read the data in.

 

Boolean Array to DWDT 

Message Edited by DFGray on 01-05-2009 08:44 AM
0 Kudos
Message 8 of 12
(4,762 Views)

 

tinnitus: your solution is the most accurate from all but I have problem with the digital signal it should be 2 channels of digital one that starts from 0 and follow 1 and the other that starts from 1 and flow 0  - what I get is only one channel that starts from 2 and flow 1.

What am I doing wrong? Can you help to get this 2 channels of digital signales?

 

 

Download All
0 Kudos
Message 9 of 12
(4,744 Views)

DFGray:

Thanks a lot I for this I approach but some of it don't give me the right data.

 

0 Kudos
Message 10 of 12
(4,731 Views)