Conceptual
Login

Byte Order and Bit Fields Inside a Register

A register is usually read as a whole 32-bit number, but its meaning is packed into individual bits and small groups of bits: bit 0 means busy, bits 8 to 15 hold a length, and so on. On top of that, the device and the processor may disagree about which end of a multi-byte value comes first, which is what little-endian and big-endian mean. Get either wrong and you set the wrong flag or write a number that arrives byte-reversed, with no error message to tell you.

Questions this Concept answers

  • Why does a byte-order mismatch between a device and the processor usually produce no error message at all?