## LSB - Least significant bit

## MSB - Most significant bit

## Bit Numbering:

There are 2 common bit numbering schemes LSB0 nad LSB1:

## LSB0:

Starts with LSB as 0 goes to MSB as 7

## LSB1:

Starts with LSB as 1 goes to MSB as 8

In other words:

- A bit has two values (on or off, 1 or 0)
- A byte is a sequence of 8 bits
- The "leftmost" bit in a byte is the biggest. So, the binary sequence 00001001 is the decimal number 9. 00001001 = (2
^{3}+ 2^{0}= 8 + 1 = 9). - For LSB0, Bits are numbered from right-to-left. Bit 0 is the rightmost and the smallest; bit 7 is leftmost and the largest
- For LSB1, Bits are numbered from right-to-left. Bit 1 is the rightmost and the smallest; bit 8 is leftmost and the largest

- The "leftmost" bit in a byte is the biggest. So, the binary sequence 00001001 is the decimal number 9. 00001001 = (2

The referring to the first bit or the last bit are not clear and are to be avoided. Likewise, The left most bit should always be referred to as "bit 7" instead of "the left most bit" etc.

# Byte Numbering:

Many will just count Bytes starting from the Left to Right. You will see people start with 1 or 0. So, in the following example, 02 is the first byte and could be referred to as Byte 0 or Byte 1. A C programer would probably refer to it as Byte 0 because that is the way memory is addressed in C. Someone that is not a C programmer might call it Byte 1. Byte 0 is probably more well accepted.

As for how to store a number or data in such a system, you have to know if it is stare Big Endian or Little Endian.

- Big endian machine: Stores data
**big-end first**. When looking at multiple bytes, the first byte (lowest address) is the biggest. - Little endian machine: Stores data
**little-end first**. When looking at multiple bytes, the first byte is**smallest**.

### For Example:

Byte Name: W X Y Z Location: 0 1 2 3 Value (hex): 0x12 0x34 0x56 0x78

- Big endian machine: An int is 4 bytes, and the first is the largest. I read 4 bytes (W X Y Z) and W is the largest. The number is 0x12345678.
- Little endian machine: Sure, an int is 4 bytes, but the first is smallest. I also read W X Y Z, but W belongs way in the back -- it's the littlest. The number is 0x78563412.