SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Downloaden Sie, um offline zu lesen
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 1
NUMBER SYSTEMS
"A set of values used to represent different quantities is known as Number System". For example, a
number system can be used to represent the number of students in a class or number of viewers watching a
certain TV program etc. The digital computer represents all kinds of data and information in binary
numbers. It includes audio, graphics, video, text and numbers. The total number of digits used in a number
system is called its base or radix. A value of each digit in a number can be determined using
 The digit
 The position of the digit in the number
 The base of the number system (where base is defined as the total number of digits available in the
number system).
Efficiency of Number System
 Number systems provide the basis for all operations in information processing systems.
 In a number system the information is divided into a group of symbols
 A group of bits which is used to represent the discrete elements of information is a symbol.
 The most common are the decimal, binary, octal, and hexadecimal systems.
Bits and Bytes
• A binary digit is a single numeral in a binary number.
• Each 1 and 0 in the number below is a binary digit:
– 1 0 0 1 0 1 0 1
• The term “binary digit” is commonly called a “bit.”
• Eight bits grouped together is called a “byte.”
Positional Number Systems
 We are all familiar with the traditional base-10 number system, which uses 10 digits (0 to 9) and in
which the positions increase in value by powers of 10 from right to left. For example, the number
487 is interpreted as 4 hundreds plus 8 tens plus 7 ones.
 Other number systems work similarly, using different numbers for their bases. In computer science
we are particularly interested in binary, octal, and hexadecimal systems, which are base 2, 8, and 16
respectively.
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 2
 The relationship between these number systems can be seen in the following table, where the zero
position refers to the rightmost digit of a number, and the ^ symbol represents exponentiation:
Position
Value in base:
10 2 8 16
0 10^0 = 1 2^0 = 1 8^0 = 1 16^0 = 1
1 10^1 = 10 2^1 = 2 8^1 = 8 16^1 = 16
2 10^2 = 100 2^2 = 4 8^2 = 64 16^2 = 256
3 10^3 = 1000 2^3 = 8 8^3 = 512 16^3 = 4,096
4 10^4 = 10,000 2^4 = 16 8^4 = 4,096 16^4 = 65,536
5 10^5 = 100,000 2^5 = 32 8^5 = 32,768 16^5 = 1,048,576
6 10^6 = 1,000,000 2^6 = 64 8^6 = 262,144 16^6 = 16,777,216
7 10^7 = 10,000,000 2^7 = 128 8^7 = 2,097152 16^7 = 268,435,456
Computer Number Systems
1. Binary Numbers
2. Decimal Numbers
3. Octal Numbers
4. Hexadecimal Numbers
1. Binary Numbers
Digital computer represents all kinds of data and information in the binary system. Binary Number
System consists of two digits 0 and 1. Its base is 2. Each digit or bit in binary number system can be 0 or 1.
A combination of binary numbers may be used to represent different quantities like 1001. The positional
value of each digit in binary number is twice the place value or face value of the digit of its right side. The
weight of each position is a power of 2.
Numbering of the digits
msb lsb
n-1 0
Where n is the number of digits in the number. (msb stands for most significant bit, lsb stands for least
significant bit).
Example
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 3
Binary Number: 101012
2. Decimal Number
The Decimal Number System consists of ten digits from 0 to 9. These digits can be used to represent any
numeric value. The base of decimal number system is 10. It is the most widely used number system. The
value represented by individual digit depends on weight and position of the digit.
The value of the number is determined by multiplying the digits with the weight of their position and
adding the results. This method is known as expansion method. The rightmost digit of number has the
lowest weight. This digit is called Least Significant Digit (LSD). The leftmost digit of a number has the
highest weight. This digit is called Most Significant Digit (MSD). For example, the decimal number 1234
consists of the digit 4 in the units position, 3 in the tens position, 2 in the hundreds position, and 1 in the
thousands position, and its value can be written as
(1x1000)+ (2x100) + (3x10) + (4xl)
(1x103
)+ (2x102
) + (3x101
) + (4xl00
)
1000 + 200 + 30 + 4
1234
Decimal to Binary conversion
Step – 1: Divide the decimal number to be converted by the value of the new base. In this case divide it by
2.
Step – 2: Record the remainder from Step – 1 as the rightmost digit.
Step – 3: Divide the quotient of the previous by the new base.
Step – 4: Record the remainder from Step – 3 as the next digit (to the left) of the new base number.
Step – 5: Bottom to top sequence of remainder will be the required converted number. Repeat Step – 3 &
Step – 4, recording remainders from right to left, until the quotient becomes less than the digit of new base
so that it cannot be divided.
Ex:
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 4
The fractional part is again multiplied by 2 and the process repeated.
Example: convert (0.68)10 to binary fraction.
0.68 * 2 = 1.36 integer part is 1
0.36 * 2 = 0.72 integer part is 0
0.72 * 2 = 1.44 integer part is 1
0.44 * 2 = 0.88 integer part is 0
Answer = 0. 1 0 1 0…..
Example: Convert (0.625)10
0.625 x 2 = 1.25(Product) Fractional part=0.25 Carry=1 (MSB)
0.25 x 2 = 0.50(Product) Fractional part = 0.50 Carry = 0
0.50 x 2 = 1.00(Product) Fractional part = 1.00 Carry = 1 (LSB)
The fractional part in the 3rd iteration becomes zero and hence we stop the multiplication iteration.
Carry from the 1st multiplication iteration becomes MSB and carry from 3rd iteration becomes LSB.
Hence, the fractional binary number of the given fractional decimal number (0.625)10 is (0.101)2.
Binary to Decimal Conversion
• Step 1: Multiply each bit by 2n
, where n is the “weight” of the bit
• Step 2: The weight is the position of the bit, starting from 0 on the right
 Step 3:Add the results
Ex: Convert the binary number 101012 to decimal.
Step Binary Number Decimal Number
Step 1 101012 ((1 x 24
) + (0 x 23
) + (1 x 22
) + (0 x 21
) + (1 x 20
))10
Step 2 101012 (16 + 0 + 4 + 0 + 1)10
Step 3 101012 2110
1. Convert (101.101)2
↑ ↑
MSB LSB
= 1 x 22
+ 0 x 21
+ 1 x 20
. 1 x 2-1
+ 0 x 2-2
+ 1 x 2-3
= 1 x 4 + 0 x 2 + 1 x 1. 1 x ( 1 / 2 ) + 0 x ( 1 / 4 ) + 1 x ( 1 / 8 )
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 5
= 4 + 0 + 1 . (1 / 2) + 0 + (1 / 8)
= 5. 0.5 + 0.125
= 5. 625
Therefore (1 0 1. 1 0 1)2 = (5.625)10
3. Convert (0.0001)2
= 0 x 20
. 0 x 2-1
+ 0 x 2-2
+ 0 x 2-3
+ 1 x 2-4
= 0 x 1. 0 x ( 1 / 2 ) + 0 x ( 1 / 4 ) + 0 x ( 1 / 8 ) + 1 x ( 1 / 16 )
= 0. 0 + 0 + 0 + (1 / 16)
= 0. 0.0625
= 0. 0625
Therefore (0. 0 0 0 1)2 = (0.0625)10
4. Convert (101010.1111)2
= 1 x 25
+ 0 x 24
+ 1 x 23
+ 0 x 22
+ 1 x 21
+ 0 x 20
. 1 x 2-1
+ 1 x 2-2
+ 1 x 2-3
+ 1 x 2-4
= 1 x 32 + 0 x 16 + 1 x 8 + 0 x 4 + 1 x 2 + 0 x 1. 1 x ( 1 / 2 ) + 1 x ( 1 / 4 ) + 1 x ( 1 / 8 ) + 1 x ( 1 / 16 )
= 32 + 0 + 8 + 0 + 2 + 0 . (1 / 2) + ( 1 / 4 ) + ( 1 / 8 ) + ( 1 / 16 )
= 32 + 8 + 2 . ( 0.5 ) + ( 0.25 ) + ( 0.125 ) + ( 0.0625 )
= 42. 9375
Therefore (1 0 1 0 1 0. 1 1 1 1)2 = (42.9375)10
1. Octal Number System
 Base or radix 8 number system.
 1 octal digit is equivalent to 3 bits.
 Octal numbers are 0 to7.
 Numbers are expressed as powers of 8.
 For example:

Octal to Binary
Converting from octal to binary is as easy as converting from binary to octal. Simply look up each octal
digit to obtain the equivalent group of three binary digits.
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 6
Octal: 0 1 2 3 4 5 6 7
Binary: 000 001 010 011 100 101 110 111
Octal to decimal
Example: convert (632)8 to decimal
= (6 x 82) + (3 x 81) + (2 x 80)
= (6 x 64) + (3 x 8) + (2 x 1)
= 384 + 24 + 2
= (410)10
Ex: (407.304)8
= 4 x 8 2
+ 0 x 8 1
+ 7 x 8 0
. 3 x 8 -1
+ 0 x 8 -2
+ 4 x 8 -3
= 4 x 8 2
+ 0 x 8 1
+ 7 x 8 0
. 3 x 8 -1
+ 0 x 8 -2
+ 4 x 8 -3
= 4 x 64 + 0 x 8 + 7 x 1.
3 x ( 1 / 8 ) + 0 x ( 1 / 64 ) + 4 x ( 1 / 512 )
= 256 + 0 + 7 . (0. 375) + (0) + (0. 0078125)
= (263 . 3828125)10
Decimal to octal
 To convert from decimal to octal, the successive-division procedure or the sum of weights procedure
can be used
Ex: Convert (177)10 to octal
177 / 8 = 22 remainder is 1
22 / 8 = 2 remainder is 6
2 / 8 = 0 remainder is 2
Answer = 2 6 1
Binary to octal
 group the binary positions in groups of three
 Convert the following binary numbers into octal: a) 10110111 b) 01101100
 Solution
 10110111 = 010 110 111 = 267
 01101100 = 001 101 100 = 154
2. Hexa decimal number system
 Base or radix 16 number system.
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 7
 1 hex digit is equivalent to 4 bits.
 Numbers are 0, 1, 2…..8, 9, A, B, C, D, E, and F.
 B is 11, E is 14.
 Numbers are expressed as powers of 16.
Hex to binary
 replace each hexadecimal number with four equivalent binary numbers even if the number can be
represented by less than four bits
 Convert the following hexadecimal number into binary: a) A2E b)60F
 Solution:
 a) (A2E)16 = 1010 0010 1110
= (101000101110)2
 b) (60F)16 = 0110 0000 1111 = (011000001111)2
Binary to hexadecimal
 grouping the binary positions in groups of four
 Convert the following binary numbers into hexadecimal: a) 10101111 b) 01101100
 Solution:
 10110111 = 1011 0111 = (B 7)16
 01101100 = 0110 1100 = (6 C)16
Hex to decimal
 To convert from hexadecimal to decimal, (multiply by weighting factors).
 Convert (7AD) 16 to decimal.
 Solution:
 (7AD)16 = 7 x 162
+ 10 x 161
+ 13 x 160
= (1965)10
Decimal to hex
 To convert from decimal to hexadecimal, the successive-division procedure or the sum of weights
procedure can be used.
 Convert the following decimal numbers to hexadecimal: a) (596)10 b) (100)10
 Solution:
 596 ÷ 16 = 37 remainder 4
37 ÷ 16 = 2 remainder 5
2 ÷ 16 = 0 remainder 2
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 8
Answer=254
 1000 ÷ 16 = 62 remainder 8
62 ÷ 16 = 3 remainder 14
3 ÷ 16 = 0 remainder 3
Answer= 3E8
Conversion Table
Decimal Binary Octal 3-bit String Hexa-decimal 4-bit String
0 0 0 000 0 0000
1 1 1 001 1 0001
2 10 2 010 2 0010
3 11 3 011 3 0011
4 100 4 100 4 0100
5 101 5 101 5 0101
6 110 6 110 6 0110
7 111 7 111 7 0111
8 1000 10 - 8 1000
9 1001 11 - 9 1001
10 1010 12 - A 1010
11 1011 13 - B 1011
12 1100 14 - C 1100
13 1101 15 - D 1101
14 1110 16 - E 1110
15 1111 17 - F 1111
Fig 1.1 Number system conversion
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 9
BINARY ADDITION & SUBSTRACTION
Rules for Addition
 0 + 0 = 0
 0 + 1 = 1
 1 + 0 = 1
 1 + 1 = 0, and carry 1 to the next more significant bit
For example,
00011010 + 00001100 = 00100110
0 0 0 1 1 0 1 0 = 26(base 10)
+ 0 0 0 0 1 1 0 0 = 12(base 10)
0 0 1 0 0 1 1 0 = 38(base 10)
00010011 + 00111110 = 01010001
0 0 0 1 0 0 1 1 = 19(base 10)
+ 0 0 1 1 1 1 1 0 = 62(base 10)
0 1 0 1 0 0 0 1 = 81(base 10)
The rules of binary addition (without carries) are the same as the truths of the XOR gate.
Rules of Binary Subtraction
 0 - 0 = 0
 0 - 1 = 1, and borrow 1 from the next more significant bit
 1 - 0 = 1
 1 - 1 = 0
For example,
00100101 - 00010001 = 00010100
0 0 10 0 1 0 1 = 37(base 10)
- 0 0 0 1 0 0 0 1 = 17(base 10)
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 10
BINARY MULTIPLICATION & DIVISION
Rules of Binary Multiplication
 0 x 0 = 0
 0 x 1 = 0
 1 x 0 = 0
 1 x 1 = 1, and no carry or borrow bits
For example,
00101001 × 00000110 = 11110110 0 0 1 0 1 0 0 1 = 41(base 10)
× 0 0 0 0 0 1 1 0 = 6(base 10)
0 0 0 0 0 0 0 0
0 0 1 0 1 0 0 1
0 0 1 0 1 0 0 1
0 0 1 1 1 1 0 1 1 0 = 246(base 10)
00010111 × 00000011 = 01000101 0 0 0 1 0 1 1 1 = 23(base 10)
× 0 0 0 0 0 0 1 1 = 3(base 10)
0 0 0 1 0 1 1 1
0 0 0 1 0 1 1 1
0 0 0 1 0 1 0 0 = 20(base 10)
00110011 - 00010110 = 00011101
0 0 1 1 0 0 1 1 = 51(base 10)
- 0 0 0 1 0 1 1 0 = 22(base 10)
0 0 0 1 1 1 0 1 = 29(base 10)
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 11
0 0 1 0 0 0 1 0 1 = 69(base 10)
Note: The rules of binary multiplication are the same as the truths of the AND gate.
Another Method: Binary multiplication is the same as repeated binary addition; add the multiplicand to
itself the multiplier number of times.
For example,
00001000 × 00000011 = 00011000
0 0 0 0 1 0 0 0 = 8(base 10)
0 0 0 0 1 0 0 0 = 8(base 10)
+ 0 0 0 0 1 0 0 0 = 8(base 10)
0 0 0 1 1 0 0 0 = 24(base 10)
Binary Division
For example,
Fig 1.2 example for binary division
REPRESENTATION OF SIGNED NUMBERS
 There are three basic ways to represent signed numbers:
 Sign-magnitude.
 1’s complement.
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 12
 2’s complement.
Sign-Magnitude
 The number consists of two parts:
 the MSB (most significant bit) represents the sign
 The other bits represent the magnitude of the number.
 If the sign bit is 1 the number is negative and if it is 0 the number is positive
Examples
I. -30 = 1 0011110 (The leftmost 1 indicates that the number is negative. The remaining 7-bits
carry the magnitude of 30).
II. 30 = 0 0011110 (The only difference between –30 and +30 is the sign bit because the
magnitude bits are similar in both numbers.).
III. -121 = 1 1111001.
IV. 99 = 0 1100011
1’s Complement
 Negative numbers are represented in 1’s complement format.
 positive numbers are represented as the positive sign-magnitude numbers
Examples
 30 = 00011110
 -30 = 11100001
 the number equals the 1’s complement of 30
 121 = 01111001
 -121 = 10000110
 the number equals the 1’s complement of 121
 99 = 01100011
2’s Complement
 The two’s complement of a binary integer is the 1’s complement of the number plus 1.”
 Thus if m is the 2’s complement of n, then: m = n + 1.
Examples:
n = 0101 0100, then m = 1010 1011 + 1 = 1010 1100
n = 0101 1111, then m = 1010 0000 + 1 = 1010 0001
n = 0111 1111, then m = 1000 0000 + 1 = 1000 0001
n = 0000 0001, then m = 1111 1110 + 1 = 1111 1111
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 13
 To convert a negative decimal number to 2 To convert a negative decimal number to 2 s’
complement binary: complement binary:
i. Convert the decimal number to a positive binary number.
ii. Take the 1’s complement of that binary number and add 1.
• Ex
– 50: 50 = 0011 0010; 1’s C. = 1100 1101; 2’s C. = 1100 1110.
– 127: 127 = 0111 1111; 1’s C. = 1000 0000; 2’s C. = 1000 0001.
– 1: 1 = 0000 0001; 1’s C. = 1111 1110; 2’s C. =1111 1111
ADDITION AND SUBTRACTION USING 2’S AND I’S COMPLEMENT
 1’s and 2’s complement allow the Representation of Negative numbers (-) in binary.
1's complement
 The 1's complement of a binary number is found by simply changing all 1s to 0s and all 0s to 1s.
 Examples
The 1’s complement of 10001111 = 01110000.
The 1’s complement of 01101100 = 10010011.
The 1’s complement of 00110011 = 11001100.
2's complement
 The 2's complement of a binary number is found by adding 1 to the LSB of the 1’s complement.
 Another way of obtaining the 2’s complement of a binary number is to start with the LSB (the
rightmost bit) and leave the bits unchanged until you find the first 1. Leave the first 1 unchanged
and complement the rest of the bits (change 0 to 1 and 1 to 0).
 Example
 The 2’s complement of 10001111 = 01110000 +1 = 01110001
 The 2’s complement of 01101100 = 10010011 + 1 =10010100
 The 2’s complement of 00110011 = 11001100 + 1 = 11001101
Addition of 2’s complement binary numbers
Subtraction
 There are two possibilities
a) M>=N
b) M<N
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 14
 If M>=N then follow the given steps
Steps
1: Add the minuend M to the r’s complement of the subtrahend N
2: inspect the result obtained in step 1 for an end carry
a) If an end carry occurs discard it.
b) If an end carry doesn’t occur, take the r’s complement of the number obtained in step 1
and place a negative sign in front.
 If M<N then follow the above steps with given additional steps
3. Answer is obtained by taking a r’s compliment of obtained sum and adding a negative sign
Subtraction using 1's complement
The method of binary subtraction becomes very easy with the help of 1's complement. Now let us look at
an example to understand subtraction using 1's complement. –
Suppose A = (0 1 0 1)2
And B = (0 0 1 1)2
And we want to find out A - B
For this first we have to calculate 1's complement of B
1's complement of B = 1 1 0 0
Now we have to add the result with A
Now in the result we can see that there is an overflowing bit which we have to add with the remaining
result
This is the desired result. And when there will not be any overflowing digit the result obtained in the
previous stage will be the answer.
Subtraction using 2’s complement
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 15
One of the most popular applications of 2's complement is the subtraction of binary numbers using 2's
complement method. This method is preferred because here subtraction can be done by doing additions.
With an example we will be able to grasp the method at once.
We want to do 7 - 12
Step1
Taking 2's complement of minuend (12) which is = 1 1 1 1 0 1 0 0
Step 2
Adding the result with binary equivalent of 7
So the subtraction method using 2's complement method is hereby explained.
Binary codes
• Digital data is represented, stored and transmitted as group of binary bits.
• This group is called binary code.
• The binary code can be used for represent the number as well as alphanumeric letters.
1. Weighted Binary Systems- Weighted binary codes are those which obey the positional weighting
principles, each position of the number represents a specific weight.
2. Non Weighted Codes- Non weighted codes are codes that are not positionally weighted. That is,
each position within the binary number is not assigned a fixed value.
Binary Coded Decimal (BCD)
 Represent each decimal digit as a 4-bit binary code.
 Binary-Coded Decimal is a weighted code because each decimal digit can be obtained from its code
word by assigning a fixed weight to each code-word bit.
 The weights for the BCD bits are 8, 4, 2, and 1, and for this reason the code is sometimes called the
8421 code.
 Examples:
(234)10 = (0010 0011 0100)BCD
(7093)10 = (0111 0000 1001 0011)BCD
(1000 0)BCD = (86)10
(1001 (1001 0100 0111 0010)BCD = (9472)10
Notes: BCD is not equivalent to binary.
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 16
Example: (234)10 = (11101010)2
GRAY Code
• It is called cyclic or reflected code.
• In this code each code group does not differ from its neighbor in more than one bit.
• This code is used for input and output devices in digital system.
Decimal Binary Gray Code Decimal Binary Gray code
0 0000 0000 8 1000 1100
1 0001 0001 9 1001 1101
2 0010 0011 10 1010 1111
3 0011 0010 11 1011 1110
4 0100 0110 12 1100 1010
5 0101 0111 13 1101 1011
6 0110 0101 14 1110 1001
7 0111 0100 15 1111 1000
Fig 1.2 GRAY code system
Binary into Gary Code
The following Method can be used
1. Write down binary form of the given decimal number.
2. Write MSB as such.
3. Then XOR the binary digit from left to right at the adjacent position.
4. Discard carry if any.
5. Write the digit which comes after addition.
Fig 1.3 binary –gray conversion
Gray – binary
• Method:
1. Write the given grey code.
2. Write the MSB bit as such.
3. XOR this bit to the second left most bit, write the result, and discard carry.
4. Add this result to the next left most bit diagonally.
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 17
Fig 1.4 Gray –Binary conversion
Excess -3 Code
 This counting system starts from a count of binary three (0011) then counts up.
Fig 1.5 excess 3 code
Alphanumeric Codes
 Apart from numbers, computers also handle textual data.
 Character set frequently used includes:
alphabets: ‘A’ .. ‘Z’, and ‘a’ .. ‘z’
digits: ‘0’ .. ‘9’
special symbols: ‘$’, ‘.’, ‘,’, ‘@’, ‘*’, …
 Alphanumeric codes are codes used to encode the characters of alphabets in addition to the decimal
digits. They are used primarily for transmitting data between computers and its I/O devices.
 Usually, these characters can be represented using 7 or 8 bits.
ASCII
 The most commonly used character code is ASCII (the American Standard Code for Information
Interchange).
 ASCII represents each character with a 7-bit string, yielding a total of 128 characters.
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 18
 The code contains the uppercase and lower case alphabet, numeral, punctuation, and various
nonprinting control characters.
 7-bit, plus a parity bit for error detection (odd/even parity).
Character ASCII Code
0 0110000
1 0110001
. . . . . .
9 0111001
: 0111010
A 1000001
B 1000010
. . . . . .
Z 1011010
[ 1011011
 1011100
Fig 1.6 ASCII code example
EBCDIC
 Extended Binary Coded Decimal Interchange Code (EBCDIC) is an 8-bit character encoding.
Error Detection Codes
 Errors can occur data transmission. They should be detected, so that re-transmission can be
requested. With binary numbers, usually single-bit errors occur.
Example: 0010 erroneously transmitted as 0011, or 0000, or 0110, or 1010.
 Error-detecting codes normally add extra information to the data. In general, error-detecting codes
contains redundant code. That is a code that uses n-bit strings need not contain 2n
valid code words.
 An error-detecting code has the property that corrupting or garbling a code word will likely produce
a bit string that is not a code word. Thus errors in a bit string can be detected by a simple rule - if it
is not a code word it contains an error.
 Commonly used error detecting codes area.
a. parity code
b. Checksums
c. Block Parity
a. Parity bit.
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 19
 Even parity: additional bit supplied to make total number of ‘1’s even.
 Odd parity: additional bit supplied to make total number of ‘1’s odd.
Fig 1.7 Parity Check
Error correcting Code
 Hamming code is a set of error-correction code s that can be used to detect and correct bit errors
that can occur when computer data is moved or stored.
 The key to the Hamming Code is the use of extra parity bits to allow the identification of a single
error. Create the code word as follows:
1. Mark all bit positions that are powers of two as parity bits. (Positions 1, 2, 4, 8, 16, 32, 64, etc.)
2. All other bit positions are for the data to be encoded. (Positions 3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15,
17, etc.)
3. Each parity bit calculates the parity for some of the bits in the code word. The position of the parity
bit determines the sequence of bits that it alternately checks and skips.
Position 1: check 1 bit, skip 1 bit, check 1 bit, skip 1 bit, etc. (1,3,5,7,9,11,13,15,...)
Position 2: check 2 bits, skip 2 bits, check 2 bits, skip 2 bits, etc. (2,3,6,7,10,11,14,15,...)
Position 4: check 4 bits, skip 4 bits, check 4 bits, skip 4 bits, etc.
(4,5,6,7,12,13,14,15,20,21,22,23,...)
Position 8: check 8 bits, skip 8 bits, check 8 bits, skip 8 bits, etc. (8-15,24-31,40-47,...)
Position 16: check 16 bits, skip 16 bits, check 16 bits, skip 16 bits, etc. (16-31,48-63,80-95,...)
Position 32: check 32 bits, skip 32 bits, check 32 bits, skip 32 bits, etc. (32-63,96-127,160-191,...)
etc.
4. Set a parity bit to 1 if the total number of ones in the positions it checks is odd. Set a parity bit to 0
if the total number of ones in the positions it checks is even.
MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17
Dept. of Computer Science And Applications, SJCET, Palai Page 20
 Here is an example:
A byte of data: 10011010
Create the data word, leaving spaces for the parity bits: _ _ 1 _ 0 0 1 _ 1 0 1 0
Calculate the parity for each parity bit (a ? represents the bit position being set):
Position 1 checks bits 1, 3, 5, 7, 9, 11:
? _ 1 _ 0 0 1 _ 1 0 1 0. Even parity so set position 1 to a 0: 0 _ 1 _ 0 0 1 _ 1 0 1 0
Position 2 checks bits 2, 3, 6, 7, 10, 11:
0 ? 1 _ 0 0 1 _ 1 0 1 0. Odd parity so set position 2 to a 1: 0 1 1 _ 0 0 1 _ 1 0 1 0
Position 4 checks bits 4, 5, 6, 7, 12:
0 1 1 ? 0 0 1 _ 1 0 1 0. Odd parity so set position 4 to a 1: 0 1 1 1 0 0 1 _ 1 0 1 0
Position 8 checks bits 8, 9, 10, 11, 12:
0 1 1 1 0 0 1 ? 1 0 1 0. Even parity so set position 8 to a 0: 0 1 1 1 0 0 1 0 1 0 1 0
Code word: 011100101010.
 Finding and fixing a bad bit
The above example created a code word of 011100101010. Suppose the word that was
received was 011100101110 instead. Then the receiver could calculate which bit was wrong and
correct it. The method is to verify each check bit. Write down all the incorrect parity bits. Doing so,
you will discover that parity bits 2 and 8 are incorrect. It is not an accident that 2 + 8 = 10, and that
bit position 10 is the location of the bad bit. In general, check each parity bit, and add the positions
that are wrong, this will give you the location of the bad bit.

Weitere ähnliche Inhalte

Was ist angesagt?

Binary octal
Binary octalBinary octal
Binary octaldrdipo4
 
Number System & Data Representation
Number System & Data RepresentationNumber System & Data Representation
Number System & Data RepresentationPhillip Glenn Libay
 
Number systems and conversions
Number systems and conversionsNumber systems and conversions
Number systems and conversionsSusantha Herath
 
Decimal to binary number
Decimal to binary numberDecimal to binary number
Decimal to binary numberguestd8696a
 
Introduction to binary number system
Introduction to binary number systemIntroduction to binary number system
Introduction to binary number systemVikas Dongre
 
Binary Conversion
Binary ConversionBinary Conversion
Binary ConversionRey Belen
 
Binary Slides
Binary Slides Binary Slides
Binary Slides jnoles
 
Chapter 10: Error Correction and Detection
Chapter 10: Error Correction and DetectionChapter 10: Error Correction and Detection
Chapter 10: Error Correction and DetectionJeoffnaRuth
 
Booth's Multiplication Algorithm.pptx
Booth's Multiplication Algorithm.pptxBooth's Multiplication Algorithm.pptx
Booth's Multiplication Algorithm.pptxSMohiuddin1
 
Introduction to mathematical control theory - Dr. Purnima Pandit
Introduction to mathematical control theory - Dr. Purnima PanditIntroduction to mathematical control theory - Dr. Purnima Pandit
Introduction to mathematical control theory - Dr. Purnima PanditPurnima Pandit
 
Number system
Number systemNumber system
Number systemSajib
 
Number system utm notes
Number system utm notesNumber system utm notes
Number system utm notesKurenai Ryu
 

Was ist angesagt? (20)

Binary arithmetic
Binary arithmeticBinary arithmetic
Binary arithmetic
 
Binary octal
Binary octalBinary octal
Binary octal
 
Number System & Data Representation
Number System & Data RepresentationNumber System & Data Representation
Number System & Data Representation
 
Number systems and conversions
Number systems and conversionsNumber systems and conversions
Number systems and conversions
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Decimal to binary number
Decimal to binary numberDecimal to binary number
Decimal to binary number
 
Introduction to binary number system
Introduction to binary number systemIntroduction to binary number system
Introduction to binary number system
 
Binary to Decimal Conversion
Binary to Decimal ConversionBinary to Decimal Conversion
Binary to Decimal Conversion
 
Binary Conversion
Binary ConversionBinary Conversion
Binary Conversion
 
Binary Slides
Binary Slides Binary Slides
Binary Slides
 
Chapter 10: Error Correction and Detection
Chapter 10: Error Correction and DetectionChapter 10: Error Correction and Detection
Chapter 10: Error Correction and Detection
 
Booth's Multiplication Algorithm.pptx
Booth's Multiplication Algorithm.pptxBooth's Multiplication Algorithm.pptx
Booth's Multiplication Algorithm.pptx
 
01.number systems
01.number systems01.number systems
01.number systems
 
Introduction to mathematical control theory - Dr. Purnima Pandit
Introduction to mathematical control theory - Dr. Purnima PanditIntroduction to mathematical control theory - Dr. Purnima Pandit
Introduction to mathematical control theory - Dr. Purnima Pandit
 
Binary number systems
Binary number systemsBinary number systems
Binary number systems
 
Slide03 Number System and Operations Part 1
Slide03 Number System and Operations Part 1Slide03 Number System and Operations Part 1
Slide03 Number System and Operations Part 1
 
Binary Arithmetic Operations
Binary Arithmetic OperationsBinary Arithmetic Operations
Binary Arithmetic Operations
 
Number system
Number systemNumber system
Number system
 
Number system
Number systemNumber system
Number system
 
Number system utm notes
Number system utm notesNumber system utm notes
Number system utm notes
 

Andere mochten auch

Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1Deepak John
 
Distributed computing bsics
Distributed computing bsicsDistributed computing bsics
Distributed computing bsicsDeepak John
 
Network and Computer security
Network and Computer securityNetwork and Computer security
Network and Computer securityDeepak John
 
Module 2 instruction set
Module 2 instruction set Module 2 instruction set
Module 2 instruction set Deepak John
 
Internet and search engine
Internet and search engineInternet and search engine
Internet and search engineDeepak John
 
Computer security module 2
Computer security module 2Computer security module 2
Computer security module 2Deepak John
 
Computer oganization input-output
Computer oganization input-outputComputer oganization input-output
Computer oganization input-outputDeepak John
 
Module 4 netwok layer,routing ,vlan,x.25doc
Module 4 netwok layer,routing ,vlan,x.25docModule 4 netwok layer,routing ,vlan,x.25doc
Module 4 netwok layer,routing ,vlan,x.25docDeepak John
 
Module 2 logic gates
Module 2  logic gatesModule 2  logic gates
Module 2 logic gatesDeepak John
 
Computer Networks- Introduction and Data Link Layer
Computer Networks- Introduction and Data Link LayerComputer Networks- Introduction and Data Link Layer
Computer Networks- Introduction and Data Link LayerDeepak John
 
Analysis and design of algorithms part2
Analysis and design of algorithms part2Analysis and design of algorithms part2
Analysis and design of algorithms part2Deepak John
 
Computer organization memory
Computer organization memoryComputer organization memory
Computer organization memoryDeepak John
 
Computer security module 3
Computer security module 3Computer security module 3
Computer security module 3Deepak John
 
Real Time Systems
Real Time SystemsReal Time Systems
Real Time SystemsDeepak John
 
Module 4 registers and counters
Module 4 registers and counters Module 4 registers and counters
Module 4 registers and counters Deepak John
 
Computer networks lan
Computer networks lanComputer networks lan
Computer networks lanDeepak John
 
Computer security module 4
Computer security module 4Computer security module 4
Computer security module 4Deepak John
 
Analysis and design of algorithms part 4
Analysis and design of algorithms part 4Analysis and design of algorithms part 4
Analysis and design of algorithms part 4Deepak John
 
Distributed computing
Distributed computingDistributed computing
Distributed computingDeepak John
 

Andere mochten auch (19)

Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1
 
Distributed computing bsics
Distributed computing bsicsDistributed computing bsics
Distributed computing bsics
 
Network and Computer security
Network and Computer securityNetwork and Computer security
Network and Computer security
 
Module 2 instruction set
Module 2 instruction set Module 2 instruction set
Module 2 instruction set
 
Internet and search engine
Internet and search engineInternet and search engine
Internet and search engine
 
Computer security module 2
Computer security module 2Computer security module 2
Computer security module 2
 
Computer oganization input-output
Computer oganization input-outputComputer oganization input-output
Computer oganization input-output
 
Module 4 netwok layer,routing ,vlan,x.25doc
Module 4 netwok layer,routing ,vlan,x.25docModule 4 netwok layer,routing ,vlan,x.25doc
Module 4 netwok layer,routing ,vlan,x.25doc
 
Module 2 logic gates
Module 2  logic gatesModule 2  logic gates
Module 2 logic gates
 
Computer Networks- Introduction and Data Link Layer
Computer Networks- Introduction and Data Link LayerComputer Networks- Introduction and Data Link Layer
Computer Networks- Introduction and Data Link Layer
 
Analysis and design of algorithms part2
Analysis and design of algorithms part2Analysis and design of algorithms part2
Analysis and design of algorithms part2
 
Computer organization memory
Computer organization memoryComputer organization memory
Computer organization memory
 
Computer security module 3
Computer security module 3Computer security module 3
Computer security module 3
 
Real Time Systems
Real Time SystemsReal Time Systems
Real Time Systems
 
Module 4 registers and counters
Module 4 registers and counters Module 4 registers and counters
Module 4 registers and counters
 
Computer networks lan
Computer networks lanComputer networks lan
Computer networks lan
 
Computer security module 4
Computer security module 4Computer security module 4
Computer security module 4
 
Analysis and design of algorithms part 4
Analysis and design of algorithms part 4Analysis and design of algorithms part 4
Analysis and design of algorithms part 4
 
Distributed computing
Distributed computingDistributed computing
Distributed computing
 

Ähnlich wie Module 1 number systems and code1

FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...Arti Parab Academics
 
DATA REPRESENTATION.pptx
DATA REPRESENTATION.pptxDATA REPRESENTATION.pptx
DATA REPRESENTATION.pptxMamataAnilgod
 
Chapter two FHI.pptx
Chapter two FHI.pptxChapter two FHI.pptx
Chapter two FHI.pptxODAATUBE1
 
Data repersentation.
Data repersentation.Data repersentation.
Data repersentation.Ritesh Saini
 
1.Digital Electronics overview & Number Systems.pptx
1.Digital Electronics overview & Number Systems.pptx1.Digital Electronics overview & Number Systems.pptx
1.Digital Electronics overview & Number Systems.pptxLibanMohamed26
 
Logic Circuits Design - "Chapter 1: Digital Systems and Information"
Logic Circuits Design - "Chapter 1: Digital Systems and Information"Logic Circuits Design - "Chapter 1: Digital Systems and Information"
Logic Circuits Design - "Chapter 1: Digital Systems and Information"Ra'Fat Al-Msie'deen
 
Number system and their conversion
Number system and their conversionNumber system and their conversion
Number system and their conversionRam Pratap Singh
 
Chapter 1 digital design.pptx
Chapter 1 digital design.pptxChapter 1 digital design.pptx
Chapter 1 digital design.pptxAliaaTarek5
 
Number system computer fundamental
 Number  system computer fundamental  Number  system computer fundamental
Number system computer fundamental Aman anand kumar
 
Number system by ammar nawab
Number system by ammar nawabNumber system by ammar nawab
Number system by ammar nawabAmmar_n
 

Ähnlich wie Module 1 number systems and code1 (20)

DCF QNA edited
DCF QNA editedDCF QNA edited
DCF QNA edited
 
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
 
Number system
Number systemNumber system
Number system
 
Digital Electronics Notes.pdf
Digital Electronics Notes.pdfDigital Electronics Notes.pdf
Digital Electronics Notes.pdf
 
DATA REPRESENTATION.pptx
DATA REPRESENTATION.pptxDATA REPRESENTATION.pptx
DATA REPRESENTATION.pptx
 
DLD-Introduction.pptx
DLD-Introduction.pptxDLD-Introduction.pptx
DLD-Introduction.pptx
 
Data representation in computers
Data representation in computersData representation in computers
Data representation in computers
 
Chapter two FHI.pptx
Chapter two FHI.pptxChapter two FHI.pptx
Chapter two FHI.pptx
 
Data repersentation.
Data repersentation.Data repersentation.
Data repersentation.
 
1.Digital Electronics overview & Number Systems.pptx
1.Digital Electronics overview & Number Systems.pptx1.Digital Electronics overview & Number Systems.pptx
1.Digital Electronics overview & Number Systems.pptx
 
Logic Circuits Design - "Chapter 1: Digital Systems and Information"
Logic Circuits Design - "Chapter 1: Digital Systems and Information"Logic Circuits Design - "Chapter 1: Digital Systems and Information"
Logic Circuits Design - "Chapter 1: Digital Systems and Information"
 
Number system and their conversion
Number system and their conversionNumber system and their conversion
Number system and their conversion
 
Chapter 1 digital design.pptx
Chapter 1 digital design.pptxChapter 1 digital design.pptx
Chapter 1 digital design.pptx
 
Number Systems
Number SystemsNumber Systems
Number Systems
 
Okkkkk
OkkkkkOkkkkk
Okkkkk
 
Chapter 1
Chapter   1Chapter   1
Chapter 1
 
Number system computer fundamental
 Number  system computer fundamental  Number  system computer fundamental
Number system computer fundamental
 
Number system
Number system  Number system
Number system
 
Number_Systems (2).ppt
Number_Systems (2).pptNumber_Systems (2).ppt
Number_Systems (2).ppt
 
Number system by ammar nawab
Number system by ammar nawabNumber system by ammar nawab
Number system by ammar nawab
 

Mehr von Deepak John

Network concepts and wi fi
Network concepts and wi fiNetwork concepts and wi fi
Network concepts and wi fiDeepak John
 
Web browser week5 presentation
Web browser week5 presentationWeb browser week5 presentation
Web browser week5 presentationDeepak John
 
Information management
Information managementInformation management
Information managementDeepak John
 
It security,malware,phishing,information theft
It security,malware,phishing,information theftIt security,malware,phishing,information theft
It security,malware,phishing,information theftDeepak John
 
Email,contacts and calendar
Email,contacts and calendarEmail,contacts and calendar
Email,contacts and calendarDeepak John
 
introduction to computers
 introduction to computers introduction to computers
introduction to computersDeepak John
 
Registers and counters
Registers and counters Registers and counters
Registers and counters Deepak John
 
Module 4 network and computer security
Module  4 network and computer securityModule  4 network and computer security
Module 4 network and computer securityDeepak John
 
Network and computer security-
Network and computer security-Network and computer security-
Network and computer security-Deepak John
 
Module 2 network and computer security
Module 2 network and computer securityModule 2 network and computer security
Module 2 network and computer securityDeepak John
 
Computer security module 1
Computer security module 1Computer security module 1
Computer security module 1Deepak John
 
Combinational and sequential logic
Combinational and sequential logicCombinational and sequential logic
Combinational and sequential logicDeepak John
 
Module 5 high speed swan,atm,transport layer
Module 5 high speed swan,atm,transport layerModule 5 high speed swan,atm,transport layer
Module 5 high speed swan,atm,transport layerDeepak John
 
Module 3 wlan,bluetooth vlan
Module 3 wlan,bluetooth vlanModule 3 wlan,bluetooth vlan
Module 3 wlan,bluetooth vlanDeepak John
 
Module 2 lan,data link layer
Module 2 lan,data link layerModule 2 lan,data link layer
Module 2 lan,data link layerDeepak John
 
Module 1 computer networks imtroduction,data link layer
Module 1  computer networks imtroduction,data link layerModule 1  computer networks imtroduction,data link layer
Module 1 computer networks imtroduction,data link layerDeepak John
 
Computer networks network layer,routing
Computer networks network layer,routingComputer networks network layer,routing
Computer networks network layer,routingDeepak John
 
Computer networks high speed swan,atm,frame realy
Computer networks high speed swan,atm,frame realyComputer networks high speed swan,atm,frame realy
Computer networks high speed swan,atm,frame realyDeepak John
 
Computer networks wireless lan,ieee-802.11,bluetooth
Computer networks  wireless lan,ieee-802.11,bluetoothComputer networks  wireless lan,ieee-802.11,bluetooth
Computer networks wireless lan,ieee-802.11,bluetoothDeepak John
 

Mehr von Deepak John (20)

Network concepts and wi fi
Network concepts and wi fiNetwork concepts and wi fi
Network concepts and wi fi
 
Web browser week5 presentation
Web browser week5 presentationWeb browser week5 presentation
Web browser week5 presentation
 
Information management
Information managementInformation management
Information management
 
It security,malware,phishing,information theft
It security,malware,phishing,information theftIt security,malware,phishing,information theft
It security,malware,phishing,information theft
 
Email,contacts and calendar
Email,contacts and calendarEmail,contacts and calendar
Email,contacts and calendar
 
Module 1 8086
Module 1 8086Module 1 8086
Module 1 8086
 
introduction to computers
 introduction to computers introduction to computers
introduction to computers
 
Registers and counters
Registers and counters Registers and counters
Registers and counters
 
Module 4 network and computer security
Module  4 network and computer securityModule  4 network and computer security
Module 4 network and computer security
 
Network and computer security-
Network and computer security-Network and computer security-
Network and computer security-
 
Module 2 network and computer security
Module 2 network and computer securityModule 2 network and computer security
Module 2 network and computer security
 
Computer security module 1
Computer security module 1Computer security module 1
Computer security module 1
 
Combinational and sequential logic
Combinational and sequential logicCombinational and sequential logic
Combinational and sequential logic
 
Module 5 high speed swan,atm,transport layer
Module 5 high speed swan,atm,transport layerModule 5 high speed swan,atm,transport layer
Module 5 high speed swan,atm,transport layer
 
Module 3 wlan,bluetooth vlan
Module 3 wlan,bluetooth vlanModule 3 wlan,bluetooth vlan
Module 3 wlan,bluetooth vlan
 
Module 2 lan,data link layer
Module 2 lan,data link layerModule 2 lan,data link layer
Module 2 lan,data link layer
 
Module 1 computer networks imtroduction,data link layer
Module 1  computer networks imtroduction,data link layerModule 1  computer networks imtroduction,data link layer
Module 1 computer networks imtroduction,data link layer
 
Computer networks network layer,routing
Computer networks network layer,routingComputer networks network layer,routing
Computer networks network layer,routing
 
Computer networks high speed swan,atm,frame realy
Computer networks high speed swan,atm,frame realyComputer networks high speed swan,atm,frame realy
Computer networks high speed swan,atm,frame realy
 
Computer networks wireless lan,ieee-802.11,bluetooth
Computer networks  wireless lan,ieee-802.11,bluetoothComputer networks  wireless lan,ieee-802.11,bluetooth
Computer networks wireless lan,ieee-802.11,bluetooth
 

Kürzlich hochgeladen

Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsPooky Knightsmith
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 

Kürzlich hochgeladen (20)

Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young minds
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 

Module 1 number systems and code1

  • 1. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 1 NUMBER SYSTEMS "A set of values used to represent different quantities is known as Number System". For example, a number system can be used to represent the number of students in a class or number of viewers watching a certain TV program etc. The digital computer represents all kinds of data and information in binary numbers. It includes audio, graphics, video, text and numbers. The total number of digits used in a number system is called its base or radix. A value of each digit in a number can be determined using  The digit  The position of the digit in the number  The base of the number system (where base is defined as the total number of digits available in the number system). Efficiency of Number System  Number systems provide the basis for all operations in information processing systems.  In a number system the information is divided into a group of symbols  A group of bits which is used to represent the discrete elements of information is a symbol.  The most common are the decimal, binary, octal, and hexadecimal systems. Bits and Bytes • A binary digit is a single numeral in a binary number. • Each 1 and 0 in the number below is a binary digit: – 1 0 0 1 0 1 0 1 • The term “binary digit” is commonly called a “bit.” • Eight bits grouped together is called a “byte.” Positional Number Systems  We are all familiar with the traditional base-10 number system, which uses 10 digits (0 to 9) and in which the positions increase in value by powers of 10 from right to left. For example, the number 487 is interpreted as 4 hundreds plus 8 tens plus 7 ones.  Other number systems work similarly, using different numbers for their bases. In computer science we are particularly interested in binary, octal, and hexadecimal systems, which are base 2, 8, and 16 respectively.
  • 2. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 2  The relationship between these number systems can be seen in the following table, where the zero position refers to the rightmost digit of a number, and the ^ symbol represents exponentiation: Position Value in base: 10 2 8 16 0 10^0 = 1 2^0 = 1 8^0 = 1 16^0 = 1 1 10^1 = 10 2^1 = 2 8^1 = 8 16^1 = 16 2 10^2 = 100 2^2 = 4 8^2 = 64 16^2 = 256 3 10^3 = 1000 2^3 = 8 8^3 = 512 16^3 = 4,096 4 10^4 = 10,000 2^4 = 16 8^4 = 4,096 16^4 = 65,536 5 10^5 = 100,000 2^5 = 32 8^5 = 32,768 16^5 = 1,048,576 6 10^6 = 1,000,000 2^6 = 64 8^6 = 262,144 16^6 = 16,777,216 7 10^7 = 10,000,000 2^7 = 128 8^7 = 2,097152 16^7 = 268,435,456 Computer Number Systems 1. Binary Numbers 2. Decimal Numbers 3. Octal Numbers 4. Hexadecimal Numbers 1. Binary Numbers Digital computer represents all kinds of data and information in the binary system. Binary Number System consists of two digits 0 and 1. Its base is 2. Each digit or bit in binary number system can be 0 or 1. A combination of binary numbers may be used to represent different quantities like 1001. The positional value of each digit in binary number is twice the place value or face value of the digit of its right side. The weight of each position is a power of 2. Numbering of the digits msb lsb n-1 0 Where n is the number of digits in the number. (msb stands for most significant bit, lsb stands for least significant bit). Example
  • 3. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 3 Binary Number: 101012 2. Decimal Number The Decimal Number System consists of ten digits from 0 to 9. These digits can be used to represent any numeric value. The base of decimal number system is 10. It is the most widely used number system. The value represented by individual digit depends on weight and position of the digit. The value of the number is determined by multiplying the digits with the weight of their position and adding the results. This method is known as expansion method. The rightmost digit of number has the lowest weight. This digit is called Least Significant Digit (LSD). The leftmost digit of a number has the highest weight. This digit is called Most Significant Digit (MSD). For example, the decimal number 1234 consists of the digit 4 in the units position, 3 in the tens position, 2 in the hundreds position, and 1 in the thousands position, and its value can be written as (1x1000)+ (2x100) + (3x10) + (4xl) (1x103 )+ (2x102 ) + (3x101 ) + (4xl00 ) 1000 + 200 + 30 + 4 1234 Decimal to Binary conversion Step – 1: Divide the decimal number to be converted by the value of the new base. In this case divide it by 2. Step – 2: Record the remainder from Step – 1 as the rightmost digit. Step – 3: Divide the quotient of the previous by the new base. Step – 4: Record the remainder from Step – 3 as the next digit (to the left) of the new base number. Step – 5: Bottom to top sequence of remainder will be the required converted number. Repeat Step – 3 & Step – 4, recording remainders from right to left, until the quotient becomes less than the digit of new base so that it cannot be divided. Ex:
  • 4. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 4 The fractional part is again multiplied by 2 and the process repeated. Example: convert (0.68)10 to binary fraction. 0.68 * 2 = 1.36 integer part is 1 0.36 * 2 = 0.72 integer part is 0 0.72 * 2 = 1.44 integer part is 1 0.44 * 2 = 0.88 integer part is 0 Answer = 0. 1 0 1 0….. Example: Convert (0.625)10 0.625 x 2 = 1.25(Product) Fractional part=0.25 Carry=1 (MSB) 0.25 x 2 = 0.50(Product) Fractional part = 0.50 Carry = 0 0.50 x 2 = 1.00(Product) Fractional part = 1.00 Carry = 1 (LSB) The fractional part in the 3rd iteration becomes zero and hence we stop the multiplication iteration. Carry from the 1st multiplication iteration becomes MSB and carry from 3rd iteration becomes LSB. Hence, the fractional binary number of the given fractional decimal number (0.625)10 is (0.101)2. Binary to Decimal Conversion • Step 1: Multiply each bit by 2n , where n is the “weight” of the bit • Step 2: The weight is the position of the bit, starting from 0 on the right  Step 3:Add the results Ex: Convert the binary number 101012 to decimal. Step Binary Number Decimal Number Step 1 101012 ((1 x 24 ) + (0 x 23 ) + (1 x 22 ) + (0 x 21 ) + (1 x 20 ))10 Step 2 101012 (16 + 0 + 4 + 0 + 1)10 Step 3 101012 2110 1. Convert (101.101)2 ↑ ↑ MSB LSB = 1 x 22 + 0 x 21 + 1 x 20 . 1 x 2-1 + 0 x 2-2 + 1 x 2-3 = 1 x 4 + 0 x 2 + 1 x 1. 1 x ( 1 / 2 ) + 0 x ( 1 / 4 ) + 1 x ( 1 / 8 )
  • 5. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 5 = 4 + 0 + 1 . (1 / 2) + 0 + (1 / 8) = 5. 0.5 + 0.125 = 5. 625 Therefore (1 0 1. 1 0 1)2 = (5.625)10 3. Convert (0.0001)2 = 0 x 20 . 0 x 2-1 + 0 x 2-2 + 0 x 2-3 + 1 x 2-4 = 0 x 1. 0 x ( 1 / 2 ) + 0 x ( 1 / 4 ) + 0 x ( 1 / 8 ) + 1 x ( 1 / 16 ) = 0. 0 + 0 + 0 + (1 / 16) = 0. 0.0625 = 0. 0625 Therefore (0. 0 0 0 1)2 = (0.0625)10 4. Convert (101010.1111)2 = 1 x 25 + 0 x 24 + 1 x 23 + 0 x 22 + 1 x 21 + 0 x 20 . 1 x 2-1 + 1 x 2-2 + 1 x 2-3 + 1 x 2-4 = 1 x 32 + 0 x 16 + 1 x 8 + 0 x 4 + 1 x 2 + 0 x 1. 1 x ( 1 / 2 ) + 1 x ( 1 / 4 ) + 1 x ( 1 / 8 ) + 1 x ( 1 / 16 ) = 32 + 0 + 8 + 0 + 2 + 0 . (1 / 2) + ( 1 / 4 ) + ( 1 / 8 ) + ( 1 / 16 ) = 32 + 8 + 2 . ( 0.5 ) + ( 0.25 ) + ( 0.125 ) + ( 0.0625 ) = 42. 9375 Therefore (1 0 1 0 1 0. 1 1 1 1)2 = (42.9375)10 1. Octal Number System  Base or radix 8 number system.  1 octal digit is equivalent to 3 bits.  Octal numbers are 0 to7.  Numbers are expressed as powers of 8.  For example:  Octal to Binary Converting from octal to binary is as easy as converting from binary to octal. Simply look up each octal digit to obtain the equivalent group of three binary digits.
  • 6. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 6 Octal: 0 1 2 3 4 5 6 7 Binary: 000 001 010 011 100 101 110 111 Octal to decimal Example: convert (632)8 to decimal = (6 x 82) + (3 x 81) + (2 x 80) = (6 x 64) + (3 x 8) + (2 x 1) = 384 + 24 + 2 = (410)10 Ex: (407.304)8 = 4 x 8 2 + 0 x 8 1 + 7 x 8 0 . 3 x 8 -1 + 0 x 8 -2 + 4 x 8 -3 = 4 x 8 2 + 0 x 8 1 + 7 x 8 0 . 3 x 8 -1 + 0 x 8 -2 + 4 x 8 -3 = 4 x 64 + 0 x 8 + 7 x 1. 3 x ( 1 / 8 ) + 0 x ( 1 / 64 ) + 4 x ( 1 / 512 ) = 256 + 0 + 7 . (0. 375) + (0) + (0. 0078125) = (263 . 3828125)10 Decimal to octal  To convert from decimal to octal, the successive-division procedure or the sum of weights procedure can be used Ex: Convert (177)10 to octal 177 / 8 = 22 remainder is 1 22 / 8 = 2 remainder is 6 2 / 8 = 0 remainder is 2 Answer = 2 6 1 Binary to octal  group the binary positions in groups of three  Convert the following binary numbers into octal: a) 10110111 b) 01101100  Solution  10110111 = 010 110 111 = 267  01101100 = 001 101 100 = 154 2. Hexa decimal number system  Base or radix 16 number system.
  • 7. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 7  1 hex digit is equivalent to 4 bits.  Numbers are 0, 1, 2…..8, 9, A, B, C, D, E, and F.  B is 11, E is 14.  Numbers are expressed as powers of 16. Hex to binary  replace each hexadecimal number with four equivalent binary numbers even if the number can be represented by less than four bits  Convert the following hexadecimal number into binary: a) A2E b)60F  Solution:  a) (A2E)16 = 1010 0010 1110 = (101000101110)2  b) (60F)16 = 0110 0000 1111 = (011000001111)2 Binary to hexadecimal  grouping the binary positions in groups of four  Convert the following binary numbers into hexadecimal: a) 10101111 b) 01101100  Solution:  10110111 = 1011 0111 = (B 7)16  01101100 = 0110 1100 = (6 C)16 Hex to decimal  To convert from hexadecimal to decimal, (multiply by weighting factors).  Convert (7AD) 16 to decimal.  Solution:  (7AD)16 = 7 x 162 + 10 x 161 + 13 x 160 = (1965)10 Decimal to hex  To convert from decimal to hexadecimal, the successive-division procedure or the sum of weights procedure can be used.  Convert the following decimal numbers to hexadecimal: a) (596)10 b) (100)10  Solution:  596 ÷ 16 = 37 remainder 4 37 ÷ 16 = 2 remainder 5 2 ÷ 16 = 0 remainder 2
  • 8. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 8 Answer=254  1000 ÷ 16 = 62 remainder 8 62 ÷ 16 = 3 remainder 14 3 ÷ 16 = 0 remainder 3 Answer= 3E8 Conversion Table Decimal Binary Octal 3-bit String Hexa-decimal 4-bit String 0 0 0 000 0 0000 1 1 1 001 1 0001 2 10 2 010 2 0010 3 11 3 011 3 0011 4 100 4 100 4 0100 5 101 5 101 5 0101 6 110 6 110 6 0110 7 111 7 111 7 0111 8 1000 10 - 8 1000 9 1001 11 - 9 1001 10 1010 12 - A 1010 11 1011 13 - B 1011 12 1100 14 - C 1100 13 1101 15 - D 1101 14 1110 16 - E 1110 15 1111 17 - F 1111 Fig 1.1 Number system conversion
  • 9. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 9 BINARY ADDITION & SUBSTRACTION Rules for Addition  0 + 0 = 0  0 + 1 = 1  1 + 0 = 1  1 + 1 = 0, and carry 1 to the next more significant bit For example, 00011010 + 00001100 = 00100110 0 0 0 1 1 0 1 0 = 26(base 10) + 0 0 0 0 1 1 0 0 = 12(base 10) 0 0 1 0 0 1 1 0 = 38(base 10) 00010011 + 00111110 = 01010001 0 0 0 1 0 0 1 1 = 19(base 10) + 0 0 1 1 1 1 1 0 = 62(base 10) 0 1 0 1 0 0 0 1 = 81(base 10) The rules of binary addition (without carries) are the same as the truths of the XOR gate. Rules of Binary Subtraction  0 - 0 = 0  0 - 1 = 1, and borrow 1 from the next more significant bit  1 - 0 = 1  1 - 1 = 0 For example, 00100101 - 00010001 = 00010100 0 0 10 0 1 0 1 = 37(base 10) - 0 0 0 1 0 0 0 1 = 17(base 10)
  • 10. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 10 BINARY MULTIPLICATION & DIVISION Rules of Binary Multiplication  0 x 0 = 0  0 x 1 = 0  1 x 0 = 0  1 x 1 = 1, and no carry or borrow bits For example, 00101001 × 00000110 = 11110110 0 0 1 0 1 0 0 1 = 41(base 10) × 0 0 0 0 0 1 1 0 = 6(base 10) 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 1 1 1 0 1 1 0 = 246(base 10) 00010111 × 00000011 = 01000101 0 0 0 1 0 1 1 1 = 23(base 10) × 0 0 0 0 0 0 1 1 = 3(base 10) 0 0 0 1 0 1 1 1 0 0 0 1 0 1 1 1 0 0 0 1 0 1 0 0 = 20(base 10) 00110011 - 00010110 = 00011101 0 0 1 1 0 0 1 1 = 51(base 10) - 0 0 0 1 0 1 1 0 = 22(base 10) 0 0 0 1 1 1 0 1 = 29(base 10)
  • 11. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 11 0 0 1 0 0 0 1 0 1 = 69(base 10) Note: The rules of binary multiplication are the same as the truths of the AND gate. Another Method: Binary multiplication is the same as repeated binary addition; add the multiplicand to itself the multiplier number of times. For example, 00001000 × 00000011 = 00011000 0 0 0 0 1 0 0 0 = 8(base 10) 0 0 0 0 1 0 0 0 = 8(base 10) + 0 0 0 0 1 0 0 0 = 8(base 10) 0 0 0 1 1 0 0 0 = 24(base 10) Binary Division For example, Fig 1.2 example for binary division REPRESENTATION OF SIGNED NUMBERS  There are three basic ways to represent signed numbers:  Sign-magnitude.  1’s complement.
  • 12. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 12  2’s complement. Sign-Magnitude  The number consists of two parts:  the MSB (most significant bit) represents the sign  The other bits represent the magnitude of the number.  If the sign bit is 1 the number is negative and if it is 0 the number is positive Examples I. -30 = 1 0011110 (The leftmost 1 indicates that the number is negative. The remaining 7-bits carry the magnitude of 30). II. 30 = 0 0011110 (The only difference between –30 and +30 is the sign bit because the magnitude bits are similar in both numbers.). III. -121 = 1 1111001. IV. 99 = 0 1100011 1’s Complement  Negative numbers are represented in 1’s complement format.  positive numbers are represented as the positive sign-magnitude numbers Examples  30 = 00011110  -30 = 11100001  the number equals the 1’s complement of 30  121 = 01111001  -121 = 10000110  the number equals the 1’s complement of 121  99 = 01100011 2’s Complement  The two’s complement of a binary integer is the 1’s complement of the number plus 1.”  Thus if m is the 2’s complement of n, then: m = n + 1. Examples: n = 0101 0100, then m = 1010 1011 + 1 = 1010 1100 n = 0101 1111, then m = 1010 0000 + 1 = 1010 0001 n = 0111 1111, then m = 1000 0000 + 1 = 1000 0001 n = 0000 0001, then m = 1111 1110 + 1 = 1111 1111
  • 13. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 13  To convert a negative decimal number to 2 To convert a negative decimal number to 2 s’ complement binary: complement binary: i. Convert the decimal number to a positive binary number. ii. Take the 1’s complement of that binary number and add 1. • Ex – 50: 50 = 0011 0010; 1’s C. = 1100 1101; 2’s C. = 1100 1110. – 127: 127 = 0111 1111; 1’s C. = 1000 0000; 2’s C. = 1000 0001. – 1: 1 = 0000 0001; 1’s C. = 1111 1110; 2’s C. =1111 1111 ADDITION AND SUBTRACTION USING 2’S AND I’S COMPLEMENT  1’s and 2’s complement allow the Representation of Negative numbers (-) in binary. 1's complement  The 1's complement of a binary number is found by simply changing all 1s to 0s and all 0s to 1s.  Examples The 1’s complement of 10001111 = 01110000. The 1’s complement of 01101100 = 10010011. The 1’s complement of 00110011 = 11001100. 2's complement  The 2's complement of a binary number is found by adding 1 to the LSB of the 1’s complement.  Another way of obtaining the 2’s complement of a binary number is to start with the LSB (the rightmost bit) and leave the bits unchanged until you find the first 1. Leave the first 1 unchanged and complement the rest of the bits (change 0 to 1 and 1 to 0).  Example  The 2’s complement of 10001111 = 01110000 +1 = 01110001  The 2’s complement of 01101100 = 10010011 + 1 =10010100  The 2’s complement of 00110011 = 11001100 + 1 = 11001101 Addition of 2’s complement binary numbers Subtraction  There are two possibilities a) M>=N b) M<N
  • 14. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 14  If M>=N then follow the given steps Steps 1: Add the minuend M to the r’s complement of the subtrahend N 2: inspect the result obtained in step 1 for an end carry a) If an end carry occurs discard it. b) If an end carry doesn’t occur, take the r’s complement of the number obtained in step 1 and place a negative sign in front.  If M<N then follow the above steps with given additional steps 3. Answer is obtained by taking a r’s compliment of obtained sum and adding a negative sign Subtraction using 1's complement The method of binary subtraction becomes very easy with the help of 1's complement. Now let us look at an example to understand subtraction using 1's complement. – Suppose A = (0 1 0 1)2 And B = (0 0 1 1)2 And we want to find out A - B For this first we have to calculate 1's complement of B 1's complement of B = 1 1 0 0 Now we have to add the result with A Now in the result we can see that there is an overflowing bit which we have to add with the remaining result This is the desired result. And when there will not be any overflowing digit the result obtained in the previous stage will be the answer. Subtraction using 2’s complement
  • 15. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 15 One of the most popular applications of 2's complement is the subtraction of binary numbers using 2's complement method. This method is preferred because here subtraction can be done by doing additions. With an example we will be able to grasp the method at once. We want to do 7 - 12 Step1 Taking 2's complement of minuend (12) which is = 1 1 1 1 0 1 0 0 Step 2 Adding the result with binary equivalent of 7 So the subtraction method using 2's complement method is hereby explained. Binary codes • Digital data is represented, stored and transmitted as group of binary bits. • This group is called binary code. • The binary code can be used for represent the number as well as alphanumeric letters. 1. Weighted Binary Systems- Weighted binary codes are those which obey the positional weighting principles, each position of the number represents a specific weight. 2. Non Weighted Codes- Non weighted codes are codes that are not positionally weighted. That is, each position within the binary number is not assigned a fixed value. Binary Coded Decimal (BCD)  Represent each decimal digit as a 4-bit binary code.  Binary-Coded Decimal is a weighted code because each decimal digit can be obtained from its code word by assigning a fixed weight to each code-word bit.  The weights for the BCD bits are 8, 4, 2, and 1, and for this reason the code is sometimes called the 8421 code.  Examples: (234)10 = (0010 0011 0100)BCD (7093)10 = (0111 0000 1001 0011)BCD (1000 0)BCD = (86)10 (1001 (1001 0100 0111 0010)BCD = (9472)10 Notes: BCD is not equivalent to binary.
  • 16. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 16 Example: (234)10 = (11101010)2 GRAY Code • It is called cyclic or reflected code. • In this code each code group does not differ from its neighbor in more than one bit. • This code is used for input and output devices in digital system. Decimal Binary Gray Code Decimal Binary Gray code 0 0000 0000 8 1000 1100 1 0001 0001 9 1001 1101 2 0010 0011 10 1010 1111 3 0011 0010 11 1011 1110 4 0100 0110 12 1100 1010 5 0101 0111 13 1101 1011 6 0110 0101 14 1110 1001 7 0111 0100 15 1111 1000 Fig 1.2 GRAY code system Binary into Gary Code The following Method can be used 1. Write down binary form of the given decimal number. 2. Write MSB as such. 3. Then XOR the binary digit from left to right at the adjacent position. 4. Discard carry if any. 5. Write the digit which comes after addition. Fig 1.3 binary –gray conversion Gray – binary • Method: 1. Write the given grey code. 2. Write the MSB bit as such. 3. XOR this bit to the second left most bit, write the result, and discard carry. 4. Add this result to the next left most bit diagonally.
  • 17. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 17 Fig 1.4 Gray –Binary conversion Excess -3 Code  This counting system starts from a count of binary three (0011) then counts up. Fig 1.5 excess 3 code Alphanumeric Codes  Apart from numbers, computers also handle textual data.  Character set frequently used includes: alphabets: ‘A’ .. ‘Z’, and ‘a’ .. ‘z’ digits: ‘0’ .. ‘9’ special symbols: ‘$’, ‘.’, ‘,’, ‘@’, ‘*’, …  Alphanumeric codes are codes used to encode the characters of alphabets in addition to the decimal digits. They are used primarily for transmitting data between computers and its I/O devices.  Usually, these characters can be represented using 7 or 8 bits. ASCII  The most commonly used character code is ASCII (the American Standard Code for Information Interchange).  ASCII represents each character with a 7-bit string, yielding a total of 128 characters.
  • 18. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 18  The code contains the uppercase and lower case alphabet, numeral, punctuation, and various nonprinting control characters.  7-bit, plus a parity bit for error detection (odd/even parity). Character ASCII Code 0 0110000 1 0110001 . . . . . . 9 0111001 : 0111010 A 1000001 B 1000010 . . . . . . Z 1011010 [ 1011011 1011100 Fig 1.6 ASCII code example EBCDIC  Extended Binary Coded Decimal Interchange Code (EBCDIC) is an 8-bit character encoding. Error Detection Codes  Errors can occur data transmission. They should be detected, so that re-transmission can be requested. With binary numbers, usually single-bit errors occur. Example: 0010 erroneously transmitted as 0011, or 0000, or 0110, or 1010.  Error-detecting codes normally add extra information to the data. In general, error-detecting codes contains redundant code. That is a code that uses n-bit strings need not contain 2n valid code words.  An error-detecting code has the property that corrupting or garbling a code word will likely produce a bit string that is not a code word. Thus errors in a bit string can be detected by a simple rule - if it is not a code word it contains an error.  Commonly used error detecting codes area. a. parity code b. Checksums c. Block Parity a. Parity bit.
  • 19. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 19  Even parity: additional bit supplied to make total number of ‘1’s even.  Odd parity: additional bit supplied to make total number of ‘1’s odd. Fig 1.7 Parity Check Error correcting Code  Hamming code is a set of error-correction code s that can be used to detect and correct bit errors that can occur when computer data is moved or stored.  The key to the Hamming Code is the use of extra parity bits to allow the identification of a single error. Create the code word as follows: 1. Mark all bit positions that are powers of two as parity bits. (Positions 1, 2, 4, 8, 16, 32, 64, etc.) 2. All other bit positions are for the data to be encoded. (Positions 3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, etc.) 3. Each parity bit calculates the parity for some of the bits in the code word. The position of the parity bit determines the sequence of bits that it alternately checks and skips. Position 1: check 1 bit, skip 1 bit, check 1 bit, skip 1 bit, etc. (1,3,5,7,9,11,13,15,...) Position 2: check 2 bits, skip 2 bits, check 2 bits, skip 2 bits, etc. (2,3,6,7,10,11,14,15,...) Position 4: check 4 bits, skip 4 bits, check 4 bits, skip 4 bits, etc. (4,5,6,7,12,13,14,15,20,21,22,23,...) Position 8: check 8 bits, skip 8 bits, check 8 bits, skip 8 bits, etc. (8-15,24-31,40-47,...) Position 16: check 16 bits, skip 16 bits, check 16 bits, skip 16 bits, etc. (16-31,48-63,80-95,...) Position 32: check 32 bits, skip 32 bits, check 32 bits, skip 32 bits, etc. (32-63,96-127,160-191,...) etc. 4. Set a parity bit to 1 if the total number of ones in the positions it checks is odd. Set a parity bit to 0 if the total number of ones in the positions it checks is even.
  • 20. MODULE 1 MCA-102 DIGITAL SYSTEMS & LOGIC DESIGN ADMN 2014-‘17 Dept. of Computer Science And Applications, SJCET, Palai Page 20  Here is an example: A byte of data: 10011010 Create the data word, leaving spaces for the parity bits: _ _ 1 _ 0 0 1 _ 1 0 1 0 Calculate the parity for each parity bit (a ? represents the bit position being set): Position 1 checks bits 1, 3, 5, 7, 9, 11: ? _ 1 _ 0 0 1 _ 1 0 1 0. Even parity so set position 1 to a 0: 0 _ 1 _ 0 0 1 _ 1 0 1 0 Position 2 checks bits 2, 3, 6, 7, 10, 11: 0 ? 1 _ 0 0 1 _ 1 0 1 0. Odd parity so set position 2 to a 1: 0 1 1 _ 0 0 1 _ 1 0 1 0 Position 4 checks bits 4, 5, 6, 7, 12: 0 1 1 ? 0 0 1 _ 1 0 1 0. Odd parity so set position 4 to a 1: 0 1 1 1 0 0 1 _ 1 0 1 0 Position 8 checks bits 8, 9, 10, 11, 12: 0 1 1 1 0 0 1 ? 1 0 1 0. Even parity so set position 8 to a 0: 0 1 1 1 0 0 1 0 1 0 1 0 Code word: 011100101010.  Finding and fixing a bad bit The above example created a code word of 011100101010. Suppose the word that was received was 011100101110 instead. Then the receiver could calculate which bit was wrong and correct it. The method is to verify each check bit. Write down all the incorrect parity bits. Doing so, you will discover that parity bits 2 and 8 are incorrect. It is not an accident that 2 + 8 = 10, and that bit position 10 is the location of the bad bit. In general, check each parity bit, and add the positions that are wrong, this will give you the location of the bad bit.