Bit order

from Wikipedia, the free encyclopedia
8-bit number, bit order from left to right; frequently
Same 8-bit number but with bit order from right to left; Rare

The bit order describes the order in which the bits of a data word are indexed . So whether

  • from left (low address, bit no. 0) to right (high address, bit no. x) or
  • from right (low address, bit no. 0) to left (high address, bit no. x).

This is important for B. in the hardware-related programming of microprocessors and in serial data transmission (bit-by-bit data transmission). In the case of the latter, the sequence in which the received bits are stored in the data word on the receiving side is also important. If the sequence is set incorrectly at the receiver, a transmitted data word '0110 1001' (decimal 105, hexadecimal  69 h ) becomes a data word '1001 0110' (decimal 150, hexadecimal 96 h ).

In addition to the bit order, the correct evaluation also depends on the bit value . It determines whether

  • the bit with no. 0 is the least significant and that with no. x is the most significant (LSB-0 bit numbering, least significant bit ), or
  • the bit with no. 0 is the most significant and that with no. x is the least significant (MSB-0 bit numbering, most significant bit ).

The two properties bit order and bit weight can occur in all 2 x 2 = 4 combinations.

example

In the description of a function of a 32-bit - the processor is that the bit number to be set. 5 It can be seen from the context or from other sections of the description that the number 0 is assigned to the least significant bit. Bit no. 5 therefore has the decimal value 32.

In the case of a processor with the most significant bit No. 31 on the far left (corresponds to Big-Endian for bytes ), the resulting value as a binary number would be:

00000000 00000000 00000000 00100000

and in hexadecimal notation:

00 h  00 h  00 h  20 h

In contrast, with a processor in which the most significant bit No. 31 is on the far right (corresponds to little-endian for the bytes ), the resulting value as a binary number would be:

00000100 00000000 00000000 00000000

and in hexadecimal notation:

02 h  00 h  00 h  00 h .

See also