Digital Electronics
5 NUMBER SYSTEM
5.1. NUMBER SYSTEM
5.1.1. Base (Radix)
Total number of digit used in the system
{Digit 0 – 9) {Digit – 0,1} {Digit 0 – 7} {digit 0 – 9, A – F}
Fig. 5.1.
5.1.2. Decimal Number System
… 104 103 102 101 100 10–1 10–2 10–3…
… a4 a3 a2 a1 a0 a–1 a–2 a–3 …
ai → Coefficient of decimal number system
10i → Weight of decimal number system
Example: - (501.23)10
102 101 100 10–1 10–2
5 0 1 2 3
Base Digit
2 0, 1
3 0, 1, 2
4 0, 1, 2, 3
5 0, 1, 2, 3, 4
6 0, 1, 2, 3,4,5
GATE WALLAH ELECTRONICS & COMMUNICATION HANDBOOK 5.1
Digital Electronics
7 0, 1, 2, 3, 4, 5, 6
8 0, 1, 2, 3, 4, 5, 6, 7
9 0, 1, 2, 3, 4, 5, 6, 7, 8
10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
11 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A
12 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B
13 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C
14 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D
15 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E
16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
5.1.3 Binary Number System (Base (Radix) = 2)
… 24 23 22 21 20 2–1 2–2 2–3 …
… a4 a3 a2 a1 a0 a–1 a–2 a–3 …
2 → Weight of Binary number system
i
ai → Coefficient of Binary number system {0, 1}
Example:- (101.11)2
22 21 20 2–1 2–2
1 0 1 1 1
5.1.4. Octal Number System (Base (Radix) = 8)
… 83 82 81 80 8–1 8–2 8–3…
… a3 a2 a1 a0 a–1 a–2 a–3…
8 → Weight of Octal number system
i
ai → Coefficient of Octal number system {0 -7}
Example:- (728.64)8
2
8 81 80 8–1 8–2
7 2 8 6 4
5.1.5 Hexadecimal Number System (Base (Radix) = 16):
… 163 162 161 160 16–1 16–2 16–3…
… a3 a2 a1 a0 a–1 a–2 a–3…
16i → Weight of Hexadecimal number system
ai → Coefficient of Hexadecimal number system {0 – 9, A–F}
Example: (A2C.F)16
162 161 160 16–1
A 2 C F
5.1.6. In base conversion 2 key points are there:
(A) Any base to Decimal conversion
(B) Decimal to any other base conversion
GATE WALLAH ELECTRONICS & COMMUNICATION HANDBOOK 5.2
Digital Electronics
(A) Any base to Decimal conversion:
a3 a2 a1 a0 . a1 a2 10
a 3 r3 a2 r2 a1 r1 a0 r0 a1 a2 r2
10
1
r
Case (1) : Binary to Decimal conversion
Ex. (1011.11)2 = ( )10
(1 23) (0 22) (1 21) (1 20) (1 21) (1 22)
8 0 2 1 0.5 0.2510
(11.75)10
Case (2) : Octal to Decimal conversion
Ex. (721.4)8 = ( )10
(782 ) (281) (180) (481)
10
448 16 1 0.510
(465.5)10
Case (3) : Hexadecimal to Decimal
conversion Ex. (A2B.C)16
=( )16
(A162 ) (2161) (B160 ) (C 161)
10
(10 256) (216) (111) (12161)
10
2560 32 11 0.7510
(2603.75)10
Case (4) : Base 5 to Decimal conversion
Ex. (432.22)5 = ( )10
(452 ) (351) (250 ) (251) (252)
10
100 15 2 0.4 0.0810
(117.48)10
(B) Decimal to any other Base conversion
GATE WALLAH ELECTRONICS & COMMUNICATION HANDBOOK 5.3
Digital Electronics
0 a1 a2 a3 r x0 x1 x2
0 x1 x2 r x1 x3 x4
0 x3 x4 r x2 x5 x6
a3 a2 a1 a0 a1 a2 a3 10 b3 b2 b1 b0 x0 x1 x2 r
Case (1) : Decimal to Binary Base conversion.
Ex.
Case (2) : Decimal to Octal Base conversion.
Ex.
Case (3): Decimal to Hexadecimal Base conversion.
Ex.
GATE WALLAH ELECTRONICS & COMMUNICATION HANDBOOK 5.4
Digital Electronics
5.2. Some Special Case
Case (1): Binary to Octal base conversion
Example: (10110111)2 = ( )8
Octal → means base 8
8 = 23
Every three digits of binary represent one digit of octal
010 110 111
2 6 7
Hence (10110111)2 = (267)8
Case (2): Binary to Hexadecimal base conversion
Example: (1011011)2 = ( )16
Hexadecimal → means base 16
16 = 24
Every four digits of binary represent one digit of Hexadecimal.
0101 1011
5 11(B)
Hence (1011011)2 = (5B)16
5.1.2. BCD (Binary Coded Decimal)
In this each digit of the decimal number is represented by its four-bit binary equivalent. It is also called natural BCD
or 8421 code. It is weighted code.
Excess – 3 Code: This is an non weighted binary code used for decimal digits. Its code assignment is obtained from
the corresponding value of BCD after the addition of 3.
BCO (Binary Coded Octal): In this each digit of the Octal number is represented by its three-bit binary equivalent.
BCH (Binary Coded Hexadecimal): In this each digit of the hexadecimal number is represented by its four bit
binary equivalent.
Decimal BCD 8421 Excess – 3 Octal digits BCO Hexadecimal BCH
Digits Digits
0 0000 0011 0 000 0 0000
1 0001 0100 1 001 1 0001
2 0010 0101 2 010 2 0010
3 0011 0110 3 011 3 0011
4 0100 0111 4 100 4 0100
5 0101 1000 5 101 5 0101
6 0110 1001 6 110 6 0110
7 0111 1010 7 111 7 0111
8 1000 1011 8 1000
GATE WALLAH ELECTRONICS & COMMUNICATION HANDBOOK 5.5
Digital Electronics
9 1001 1100 9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111
Don’t care values or unused states in BCD code are 1010, 1011, 1100, 1101, 1110, 1111.
Don’t care values or unused states in excess – 3 code are 0000, 0001, 0010, 1101, 1110, 1111.
The binary equivalent of a given decimal number is not equivalent to its BCD value.
Example: 2510 = 110012.
The BCD equivalent of decimal number 25 = 00100101 from the above example the BCD value of a given decimal number is
not equivalent to its straight binary value.
The BCO (Binary Coded Octal) value of a given Octal number is exactly equal to its straight binary value.
Example: 258 = 2110 = 0101012
The BCO Value of 258 is 010101.
From the above example, the BCO value of a given Octal number is same as binary equivalent of the same number.
The BCH (Binary Coded Hexadecimal) value of a given hexadecimal number is exactly equal to its straight binary.
Example: 2516 = 3710 = 1001012
The BCH value of hexadecimal number 2516 = 00100101.
From this example the above statement is true.
Binary Octal Decimal Hexadecimal
Complement r =2 r=8 r = 10 r = 16
(r – 1)’s 1’s 7’s 9’s 15’s
r’s Complement 2’s 8’s 10’s 16’s
Example: Add the two Binary numbers 1011012.
Augned 101101
addend 100111
1111
Sum 1010100
Example: Subtract the Binary number 1001112 from 1011012.
Minuend : 101101
Subtracted: 100111
Difference: 000110
GATE WALLAH ELECTRONICS & COMMUNICATION HANDBOOK 5.6
Digital Electronics
Example: Multiple the Binary number 10112 from 1012.
Multiplicand: 1011
Multiplier: X101
1011
0000
1011
+
Product: 110111
While storing the signed binary numbers in the internal registers of a digital computer} most significant bit position is always
reserved for sign bit and the remaining bits are used for magnitude.
Fig. 5.2.
When the binary number is positive, the sign is represented by '0’. When the number is negative, the sign is represented by ' 1’.
5.2.2. Fixed-Point Representation and Floating-Point Representation;
The representation of the decimal point (ordinary point) in a register is complicated by the fact that it is characterized by a
position between two flip- flops in the register.
There are two ways of specifying the position of the decimal point in a register.
(1) Fixed Point and
(2) Floating Point.
The fixed point method assumes that the decimal point (or binary point) is always fixed in one position. The two
positions most widely used are (1) a decimal point in the extreme left of the register to make the stored number a fraction, and
(2) a decimal point in the extreme right of the register to make the stored number an integer.
The floating-point representation uses a second register to store a number that designates the position of the decimal point in
the first register.
Positive numbers are stored in the registers of digital computer in sign magnitude form only.
Negative number can be represented in one of three possible ways.
1. Signed – magnitude representation.
2. Signed – 1’s complement representation.
3. Signed – 2’s complement representation.
Example: +9 9
Signed – magnitude 0 0001001 (a) 1 000 1001 signed – magnitude
(b) 1 111 0110 signed – 1’s complement
(c) 1 111 0111 signed – 2’s complement
GATE WALLAH ELECTRONICS & COMMUNICATION HANDBOOK 5.7
Digital Electronics
The 2’s complement of a given binary number can be formed by leaving all least significant zeros and the first non-zero digit
unchanged, and then replacing 1’s by 0’s and 0’s by 1’s in all other higher significant digits.
Example: The 2’s complement of 100110002 is 01101000.
Subtraction using 2’s complement: Represent the negative number in signed 2’s complement from, add the two numbers, including
their sign bit, and discard any carry out of the most significant bit.
Since negative numbers are represented in 2’s compliment form, negative results also obtained in signed 2’s compliment form.
Example: 1’s complement:
+ 6 0000110 6 1111001 + 6 0000110 – 6 1111001
+ 9 0001001 9 0001001 – 9 1110110 – 9 1110110
+ 15 0001111 +3 (i) 0000010 – 3 1111100 – 15 (1) 1101111
Carry + 1 Carry + 1
+ 3 0000011 1110000
carry carry
The advantage of signed 2’s complement representation over the signed 1’s compliment from (and the signed – magnitude form)
is that it contains only one type of zero.
The general form of floating – point number is mre. Where M = Mantissa, r = base, e = exponent.
Example: + 0.3574 × 105.
The mantissa can be a fixed point fraction or fixed point integer.
Normalization: Getting non-zero digit in the most significant digit position of the mantissa is called Normalization.
If the floating point number is normalized, more number of significant digits can be stored, as a result accuracy can
be improved.
A zero cannot be normalized because it does not contain a non-zero digit. The hexadecimal code is widely used in
digital systems because it is very convenient to enter binary data in a digital system using hexcode.
The parity of a digital word is used for detecting error in digital transmission. Hollerith code is used for punched
card data.
In weighted codes, each position of the number has specific weight. The decimal value of a weighted code number is
the algebraic sum of the weights of those positions in which 1's appears.
Most frequently used weighted codes are 8421, 2421 code, 5211 code and 8421 code.
Reflective Code: A code is called reflective or self-complimenting, if the code for 9 is the compliment for the code
for 0, code for 8 is the compliment from 1 and so on. 2421, 842′1′, 5211 are examples for reflected codes.
Sequential Code: A code is called sequential, if each successive code-is one binary number greater than its
preceding code.
Example: 8421
GATE WALLAH ELECTRONICS & COMMUNICATION HANDBOOK 5.8