Before proceeding to relationship between binary, decimal, octal and hexadecimal number system we need to understand the concept of Binary Number Formats.
Binary numbers are represent as a sequence of bits (bits is short for binary digits). We have defined boundaries for these bits. These boundaries are:
In any number base, we may add as many leading zeros as we wish without changing its value. However, we normally add leading zeros to adjust the binary number to a desired size boundary. For example we can represent the number five as:
The Bit:
- The smallest "unit" of data is defined as a single bit.
- With a single bit we can represent any two distinct items like true or false, on or off, male or female. right or wrong etc.
The Nibble:
- A nibble is a combination of four bits. It would be not be particularly interesting data structure except for two items: BCD (binary coded decimal) numbers and hexadecimal (base 16) numbers because it takes four bits to represent a single BCD or hexadecimal digit.
- With a nibble, we can represent upto 16 distinct values.
- The structure of nibble is as shown below; with b3 acting as MSB and b0 as LSB.
The Byte:
- A byte is a combination of 8-binary bits.
- The number of distinct values represented by a byte is 256, ranging from 00000000 to 11111111.
- The structure of a byte is shown below. Bit b7 is the MSB and b0 is the LSB.
- A byte contains two nibbles. Bits b0 to b3 comprise the low order nibble whereas bits b4 to b7 comprise the higher order nibble.
- Byte is the most important data structure. It is the smallest addressable datum (data item) in the microprocessor.
The Word:
- A word is a combination of 16 bits.
- Hence it consists of two bytes. The format of a word is shown below.
- Bits b0 through b7 form the lower order byte, whereas bits b8 through b15 form the higher order byte. We can also represent the word as combination of four nibbles.
Relation between Binary, Decimal, Octal and Hexadecimal Numbers
Hexadecimal numbers are compact and easy to read. It is very easy to convert numbers from binary system to hexadecimal system and vice versa, every nibble (4 bits) can be converted to a hexadecimal digit using the table shown below.
If the hexadecimal numbers are to be converted into binary then, each hex digit should be considered separately and converted into an equivalent 4 bit binary number as shown in table below:
Post a Comment