Endianness

Bytes within larger Central Processing Unit (CPU) data formats—halfword, word, and doubleword—can be configured in either big-endian or little-endian order. Endianness defines the location of byte 0 within a larger data structure (in this tutorial, bits are always numbered with 0 on the right). Figures 50.15 and 50.16 (from Section 50 of the PIC32 MZ Family Reference Manual DS61192A) show the ordering of bytes within words and the ordering of words within multiple-word structures for both big-endian and little-endian configurations.

endianness.png

Endianness in MIPS CPUs is configurable at design. Byte ordering in PIC32MX MCUs is set as little-endian.

Endianness can vary between different computing systems.

Make sure that multi-byte quantities are converted to the correct endianness before transmission and/or consumption via appropriate PIC32 peripheral configuration (DMA, for example), or via software routines.

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.