I have a block of data that came into a memory buffer from a serial port connected data acquisition device. The data consists of mixed types of data (Characters, HEX data, DECIMAL data, FLAGS, etc. all codded as hex or ASCII hex values) and the only control I have is to ask the device to send over it's data. Or take a configuration I send it.
I am reverse engineering the data fields and don't have them all figured out yet, but it looks like it came from a small micro-controller because there is no memory alignment padding, a data field may start in the high half of byte 341 and go for 6 nibbles (4 bit chunks) and then a new data element starts.
memory address-->
43683031313233343536436832373836323234EF.......
Meaning?
Channel: CH01
value: 123456
Channel: CH02
value: 786224
flag: 0xEF
etc.
Looks like they just dumped a data struct starting at the beginning to the end with no padding (in the devices struct) to align the data.
Is there an easy way to overlay my own struct and get it correctly aligned? Then, I could read the elements from the struct.
I started writing a parser that read the right number of bytes, split them into nibbles as needed and loaded the result into local variables, but there are a lot of them. And, as I said, I don't know what they all represent. I can also change the configuration of the device by writing the data back (with changes) if I have it in exactly the same format and aligned exactly the same. I'll start with just using the values and channel numbers and add to it as I figure out more.
Ideas?
mcb