annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

binary file reading

Dear All,

 

I have Binary file. I want to read Bytes based on Patterns and each channel value (Byte values -- > Float conversion)  and storing it into Index array.

Please check the attachment for pattren format. 

Here, the biggest problem is we will get only pattern style, Based on pattern the data is already stored in Binary file just we need to read it means we need to set the Timestamp based on this.

 

Please give me some idea to read this kind of pattern files.

 

BR,

Guru

Munna
Scarica tutti
0 Kudos
Messaggio 1 di 21
4.336Visualizzazioni

Hi Munna,

 

that pattern is quite hard to understand. It seems there is some information missing…

 

In your pattern table the data size for e.g. ch1 is given as "1 byte", but in your time schedule you use two bytes for ch1. How are those "ch start position bytes" to be identified?

 


Byte values -- > Float conversion


 

How do you want to convert those bytes to Float (SGL or DBL)?

 


storing it into Index array


 

What is an "index array"?

 

It seems you have to create a table from your pattern which identifies the bytes in the file. That seems to be the trickiest part as in your pattern#2 example you already have made a mistake (for ch4 there is no marking at timestamp 70ms)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Messaggio 2 di 21
4.308Visualizzazioni

Dear GerdW,

 

Thank you so much for your reply.

 

1. In channel 1 Data Length is 1Byte. The 1st Byte is Indicator (It's generally 1 or 0). For example 1 FF 0 BF 40 4C FF ....

Here, 1st 1byte is Indicator for ch1 next one byte is Data i.e.. FF. After that 0 is again indicator for 2nd channel and data is BF404CFF. Like this we need to calculate.

 

2.


Byte values -- > Float conversion

 

Based on my requirement I will use SGL or DBL. Currently anything is ok.

 

3. Once data is converted  to Float value I have to store it into 2D- array.

    It means ch1 data in Index 0 (1D array) ch2 in Index 1 (1D Array) and so on.

 

4. Regarding pattern, sorry I missed ch4. Yes your right, I have to read the Bytes based on the Table because data is aligned based on this pattern.

 

Please let me know if you need any other Information.

 

BR,

Munna

Munna
0 Kudos
Messaggio 3 di 21
4.280Visualizzazioni

Hi Munna,

 

are those identifier bytes header unique for each channnel? It would be easier to parse the bytestream with unique identifiers (to get rid of that pattern table)…

 

I would store the channel data in an array of cluster of 1D array. This prevents hassle as 2D arrays have to have the same number of rows for each column - and your channel data clearly will result in different number of rows…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Messaggio 4 di 21
4.262Visualizzazioni

Dear GerdW,

 

Identifier Byte length is Always 1byte it's Only One or Zero. Suppose if, One is there then Next bytes having some Hex values if Zero is comming Next data Bytes having zeros.

 

For Example, 1 BF 00 00 00 00 00 1 CF 40 1 4C 50 00 00 00 00

 

Here,   1st 1 represents ch1 Byte Length (1Byte)=BF

           Next 00 Represents Ch2 and Byte Length (4Bytes)= 00 00 00 00

           Next 1 Represents Ch3 and Byte Length (2Bytes)= CF 40

           Next 1 Represents Ch4 and Byte Length (2Bytes)= 4C 50

           Next  00 Represents Ch2 and Byte Length (1Bytes)= 00

           Next  00 Represents Ch2 and Byte Length (1Bytes)= 00

 

If Identifier byte having Zero then we need to take the previous value for that channel.

 

Please let me know if it's not clear.

 

Thanks & Regards,

Guru

Munna
0 Kudos
Messaggio 5 di 21
4.246Visualizzazioni

Dear GerdW,

 

 

Please give me some sample VI about this problem.

 

BR,

Munna

Munna
0 Kudos
Messaggio 6 di 21
4.181Visualizzazioni

Hi Munna,

 

you can do it like this:

check.png

(Using InPlace structure…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Messaggio 7 di 21
4.166Visualizzazioni

Dear GerdW,

 

Thank you so much for your reply.

 

I understood your Sample VI.

 


My biggest problem is, I don't know how to make that table to read Bytes from File (as per time intervals). Please give me some idea about this.

 

Thanks & Regards,

Munna

Munna
0 Kudos
Messaggio 8 di 21
4.157Visualizzazioni

Hi Munna,

 

the idea is to create that table in the same way you did this in Excel. You created an overview of channel vs. time and then you parsed that overview to get the data order of your file.

 

Try to do the same with LabVIEW. Start with drawing a programming scheme (on paper!), then start to code in LabVIEW…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Messaggio 9 di 21
4.155Visualizzazioni

Dear GerdW,

 

Thank you so much for your suggentions and help.

 

I'm not getting any idea to make this Table in LabVIEW like Excel.

 

Can you give me some idea/sample VI, so that I will work on it.

 

Thanks & Regards,

Guru

Munna
0 Kudos
Messaggio 10 di 21
4.144Visualizzazioni