Tuesday, 29 November 2016

The Hexadecimal Number System


Hexadecimal number system uses 16 as its base or radix. The basic elements of this system consist of digits from 0 to 9 and alphabets A, B, C, D, E, and F. Letter A to F are assigned with values of 10 to 15. Thus A ≡ 10, B ≡ 11, C ≡ 12, D ≡ 13, E ≡ 14, and F ≡ 15. In terms of binary equivalents, A ≡ 1010, B ≡ 1011, C ≡ 1100, D ≡1101, E ≡ 1110, and F ≡ 1111. Hexadecimal system is used in microprocessors and microcontrollers to write their operating codes (op-codes). Since there are sixteen basic numbers to play with, instructions using hex are more compact than those the using decimal or binary number systems.   

The Binary Number System


In the binary number system, 0 and 1 are the basic elements. Since there are only two digits in this scheme, we say that its radix is 2. The entire number system is built upon based on these two numbers. We call 0 and 1 as binary digits or bits when they are used in the binary number system.  0 and 1, as stated above, can be used to represent any number in binary system.  For example, (1101)2 represents a binary number, where the digits 1, 1, 0, and 1, represent coefficients of appropriate powers of 2. Thus For example, 1101 is a short form of writing, whose expansion is:

            (1101)2 = (1*23) + (1*22) + (0*21) + (1*20)

Decimal equivalent of 1101)2 can be obtained by converting the powers of 2 to their respective decimal values. Thus

(1101)2 = (1*8) + (1*4) + (0*2) + 1 = 8 + 4+ 1 = (13)10

The procedure given above can be used to convert any binary number into its corresponding decimal number.

The Decimal Number System


The decimal number system is the most commonly and widely used number system. We have ten elemental numbers in this number system. They are, respectively, 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Since there are ten digits in this group, we say that the number system has a base or radix of 10. In the decimal number system, numbers greater than 9 are represented by repeatedly using these digits in a definite order. For example, let us consider the decimal number 123. This may be expressed in the form (123)10, where the subscript 10 represents the base or radix of number 123. It can be seen that 123 represents a short form of expressing numbers. This may  be expanded as:

 (123)10  = (1*102) + (2*101) + (3*100)

where digits 1, 2, and 3 are the coefficients of the appropriate powers of ten (i.e., 102, 101, and 100, respectively). Larger numbers can be expressed in similar fashion by writing them as coefficients of the powers of ten. In fact, in any number system, numbers are expressed as coefficients of appropriate powers of the radix of the system.