01-24-2019 11:03 PM
Hello,
I am receiving strings of bytes from a hardware using serial read function. Now I want to rearrange these values i.e. each 4 bytes should be arranged in 10-bit address and 20-bit data. Please find attached screen shot.
Thanks in advance.
01-25-2019 03:54 AM
Is there more to the message protocol than just the 4 bytes? It would be a bad protocol if that is all it is since it is easy to get out of sync and you will want some kind of data verification.
But assuming you have your 4 bytes, I would use Unflatten From String to cast the data to an I32 or U32. Then you can use some simple digital logic to get your two parts of data. Use AND to mask out all of the bits above bit 10 to get your address. Shift the bits to the right 10 times to get your data (should probably mask out the upper 2 bits first).
01-25-2019 03:59 AM
Hello,
I am reading device register values on each address and I want to know the data on each register.
SO, there are around 400 address of 10 bit having 20 bits of data. I want to arrange these 400 address and corresponding data.