I need to parse a csv file with bytes of hex values. I need to look for the x16,x16 (RS232 bisync) then grab the next 375 bytes which make up a message. Most of the files have bytes that are not aligned on the byte boundary of “x16,x16” (b00010110, b00010110) pattern (See file 1.txt). File 2.txt is more representative of the data I have to work with. I have NO choice on the data as it is produced by someone else – so I can’t change the collection method. The “x16,x16” is in the file, but it is not on the byte boundary. For example in the file “2.txt” “x16,x16” or “ b00010101,b00010101” is starts three bits past the xCE and xC2 swapped (xC2xCE) and concatenated (1100001011001110), using the
xC2 xCE
11000010 11001110 (first x16 sync)
x22 xC2
00100010 11000010 (second x16 sync)
x00 x22
00000000 00100010 (x01 soh)
x22 x00
00100010 00000000 (x10 dle)
xE0 x22
11100000 00100010 (x01 first half of message byte count)
xAE xE0
10101110 11100000 (x77 second half of message byte – x0177 = 375 bytes).
Any ideas on what would be the best way to approach doing this. I am very new to LV so any help is appreciated. I know I need to look at the hex data as binary to find the pattern, then shift the data by the number of bits it is offset. I then take the data and calculate all kinds of things from it. I am able to do this already (I know because I have files that I have recorded that are always aligned on the byte boundary). I am just stuck on what to do to convert the files generated by another group. Thanks! Please look at the attachments for clarification and data. PS - I'm not a student - I've just been struggling with it for a week.