in reply to Understanding endianness of a number

Endianness is just what order the bytes of a multi byte number are stored in. E.g. int 4660 can be stored as 0x12 at the lower memory address and 0x34 at the higher one, or vice versa. It can also refer to the order of transmission of bits in a byte over a serial link, but typically it's the bytes of a word. An easy mnemonic is little endian = "little end first", i.e. LSB first (at the lowest address). Big endian = "big end first", i.e. MSB first (lowest address). See Endianness
  • Comment on Re: Understanding endianness of a number

Replies are listed 'Best First'.
Re^2: Understanding endianness of a number
by stevieb (Canon) on Jul 23, 2017 at 19:59 UTC

    Thanks AnonyMonk,

    In this case, it definitely is related to data transmission over the wire. Arduino's Wire library's Wire.write() method sends the data back big endian. This confused me when I first ran into it, as my 2-byte word was backwards when I re-assembled the bytes.

    What caused me further confusion, was that I kept relating endianness with what I've been learning for the past year dealing with hardware registers. For some reason, I wasn't correlating that we're dealing (usually) with *bytes* with endianness, not specifically bits as dealt with in hardware registers regarding LSB and MSB etc.

    Little end first, big end first :)