Skip to Main Content

Introduction


? This article assumes a familiarity with number systems (Decimal / Hexadecimal) – if you are not already familiar with number systems then please read our article on the topic first.

In computing, the smallest number unit is usually the Byte (8-bits). Technically the smallest unit is the Bit (1 or 0, True or False), but in terms of representing what we would usually call numbers then the Byte is the smallest building block. Larger numbers are created by using multiple bytes, and communication protocols typically use the byte as the smallest unit of data transfer.

Bit Significance


If we consider a binary number, for example ‘10000001’, then the bits at either end of the binary sequence have special names – the bit on the far right is called the Least Significant Bit (LSB) and the bit on the far left is called the Most Significant Bit (MSB).

Listing of the bits in a byte illustrating MSB and LSB.

The bit on the far-right has the decimal value 1, and the bit on the far-left has the decimal value 128 (giving the total value of this byte as 129) – the bit on the left has the greatest (most) value, and the bit on the right has the smallest (least) value.

With serial communications protocols, data can be transmitted either LSB First or MSB First. The UART and USB protocols transmit data LSB first; whilst the I2C and CAN protocols transmit data MSB first. SPI can be set to use either option, but typically MSB first is used. (For more information on the various communications protocols please see our dedicated articles on the topics.)

Illustration of a UART protocol data stream. Example UART Communication – LSB First Illustration of an I2C protocol data stream. Example I2C Communication – MSB First

Endianness


When multiple bytes are combined in memory to represent larger numbers (16-bit, 32-bit, 64-bit, etc), then there is a choice regarding how to arrange those multiple bytes in memory.

Comparison of data storage in big endian vs little endian. 4 Bytes used to represent a 32-bit number.

Little-Endian is by far the most commonly used option. With this option the byte value positions in memory stay the same as the number-of-bytes used to represent the number grows.

Comparison of data storage of different sized numbers in big endian vs little endian.

? The terminology Endianness stems from the 1726 novel Gulliver’s Travels, in which there is a conflict between sects of Lilliputians depending on whether they break the shell of a boiled egg from the little end or from the big end.

All content Copyright Labcenter Electronics Ltd. 2024. Please acknowledge Labcenter copyright on any translation and provide a link to the source content on www.labcenter.com with any usage.

Advanced Simulation

Learn more about our built in graphing and advanced simulation features. Harness the mixed-mode simulation engine in Proteus to quickly test your analogue or digital circuitry directly on the schematic.

Ask an Expert Icon Ask An Expert

Have a Question? Ask one of Labcenters' expert technical team directly.

Find the right package for you

Product Wizard Try Proteus