Page 1 of 1

CANComms, Endianess and Bit Offsets

PostPosted: Tue Feb 09, 2021 9:47 am
by David Ferguson
Can someone please explain why the "bitoff" parameter passed to the various CANComms.Get<type>() functions does not represent the offset from the start of the buffer when the "bigendian" flag used on the RXOpenStandard() call is false.

I was surprised to find it inverted.

I think of Endianess relating to the byte order of multi-byte quantities, not the bit offset of a buffer. We still call byte offset 0 regardless of endianess, why wouldn't we refer to bit offset 0 as the same?

I wish the M1 Development manual explained this topic in the CANComms library discussion (or even the help in M1 Build for the functions).

Re: CANComms, Endianess and Bit Offsets

PostPosted: Fri Feb 12, 2021 4:38 pm
by adrian
We don't really have a proper document on how this works but I have a draft explanation that I use which I have attached.

Let me know if you have any other questions and I'll put it on the list to get added to the help or the Dev Manual.

Re: CANComms, Endianess and Bit Offsets

PostPosted: Sat Feb 13, 2021 3:13 am
by David Ferguson
Thank You!

That is exactly the info I need, and your examples are excellent. I need to add some bitfield stuff to the work I'm doing, and would have certainly been even more confused without this info.