## Introduction

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).

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.)

Example UART Communication – LSB First 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.

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.

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.