0% found this document useful (0 votes)
29 views83 pages

Mod 1

Uploaded by

Jagruti Chavan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views83 pages

Mod 1

Uploaded by

Jagruti Chavan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 83

Module 1 Computer Fundamentals

1.1 Introduction to Number System And Codes


Number System

◼ Number System is a method of representing Numbers on the Number Line with the help of a set of
Symbols and rules.
◼ Number System is used to perform mathematical computations
◼ The number system is used in the digital system for representing the information.
◼ Based on the base value and the number of allowed digits, number systems are of many types. The four
common types of Number System are:
◼ Decimal
◼ Binary
◼ Octal
◼ Hexadecimal
◼ In mathematics, a “base” - the number of different digits and letters that a system of counting uses to
represent numbers.
Number System
Number System


Number System

◼ Binary Number System:


◼ Number System with base value 2 is termed as Binary number system.
◼ It uses 2 digits i.e. 0 and 1 for the creation of numbers.
◼ The numbers formed using these two digits are termed as Binary Numbers.
◼ Binary number system is very useful in electronic devices and computer systems because it can be easily
performed using just two states ON and OFF i.e. 0 and 1.
◼ Decimal Numbers 0-9 are represented in binary as: 0, 1, 10, 11, 100, 101, 110, 111, 1000, and 1001
◼ E.g.
Number System


Number System

◼ Hexadecimal Number System:


◼ Number System with base value 16 is termed as Hexadecimal Number System.
◼ It uses 16 digits for the creation of its numbers.
◼ Digits from 0-9 are taken like the digits in the decimal number system but the digits from 10-15 are
represented as A-F i.e. 10 is represented as A, 11 as B, 12 as C, 13 as D, 14 as E, and 15 as F.
◼ Hexadecimal Numbers are useful for handling memory address locations.
◼ E.g.
Counting in Number System

◼ How to generate next number??


◼ You increase the digit on the left by 1 and make the right digit 0.
◼ Then go up to until you finish up all your symbols on the right side and when you hit the last symbol, again
increase the digit on the left by 1.
◼ Decimal counting:
◼ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, and so on
◼ Binary counting:
◼ 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 010, 1011, 1100, 1101, 1110, 1111, 10000, 10001, and so on
◼ Octal counting:
◼ 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16,17, 20, 21, and so on
◼ Hexadecimal counting:
◼ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10, 11, and so on
Module 1 Computer Fundamentals

1.2 Number System


Conversion of Number Systems
Conversion from Decimal Number System to Binary Number Systems

◼ Conversion of a number system means conversion from one base to another.


◼ Decimal to Binary Conversion:
◼ Follow the steps given below:
◼ Step 1: Divide the Decimal Number with the base of the number system to be
converted to. Here the conversion is to binary, hence the divisor will be 2.
◼ Step 2: The remainder obtained from the division will become the least
significant digit of the new number.
Conversion from Decimal Number System to Binary Number Systems

◼ Step 3: The quotient obtained from the division will become the next dividend
and will be divided by base i.e. 2.
◼ Step 4: The remainder obtained will become the second least significant digit
i.e. it will be added in the left of the previously obtained digit.
◼ The steps 3 and 4 are repeated until the quotient obtained becomes 0,
◼ The remainders obtained after each iteration are added to the left of the
existing digits.
Conversion from Decimal Number System to Binary Number Systems
Conversion from Decimal Number System to Binary Number Systems

Example 1: (152.25)10
Step 1: Divide the number 152 and its successive quotients with base 2.

Operation Quotient Remainder


152/2 76 0 (LSB) LSB
76/2 38 0
38/2 19 0
19/2 9 1
9/2 4 1
4/2 2 0
2/2 1 0
1/2 0 1 (MSB) MSB

(152)10=(10011000)2
Conversion from Decimal Number System to Binary Number Systems

Now, perform the multiplication of 0.25 and successive fraction with base 2.

Operation Result carry

0.25×2 0.50 0

0.50×2 0 1

(0.25)10=(.01)2

(152.25)10 = =(10011000.01)2
Conversion from Decimal Number System to Octal Number Systems

◼ Decimal to Octal Conversion:


◼ Follow the steps given below:
◼ Step 1: Divide the Decimal Number with the base of the number system to be
converted to. Here the conversion is to octal, hence the divisor will be 8.
◼ Step 2: The remainder obtained from the division will become the least
significant digit of the new number.
Conversion from Decimal Number System to Octal Number Systems

◼ Step 3: The quotient obtained from the division will become the next
dividend and will be divided by base i.e. 8.
◼ Step 4: The remainder obtained will become the second least significant
digit i.e. it will be added in the left of the previously obtained digit.
◼ The steps 3 and 4 are repeated until the quotient obtained becomes 0.
◼ The remainders obtained after each iteration are added to the left of the
existing digits.
Conversion from Decimal Number System to Octal Number Systems
Conversion from Decimal Number System to Octal Number Systems
Conversion from Decimal Number System to Octal Number Systems

Example 1: (152.25)10
Step 1:
Divide the number 152 and its successive quotients with base 8.

Operation Quotient Remainder


152/8 19 0
19/8 2 3
2/8 0 2

(152)10=(230)8
Conversion from Decimal Number System to Octal Number Systems

Step 2:
Now perform the multiplication of 0.25 and successive fraction with base 8.

Operation Result Carry

0.25×8 0 2

(0.25)10=(0.2)8

(152.25)10 = (230.2)8
Conversion from Decimal Number System to Hexadecimal Number
Systems

◼ Decimal to Hexadecimal Conversion:


◼ Follow the steps given below:
◼ Step 1: Divide the Decimal Number with the base of the number system to be
converted to. Here the conversion is to Hex hence the divisor will be 16.
◼ Step 2: The remainder obtained from the division will become the least
significant digit of the new number.
◼ Step 3: The quotient obtained from the division will become the next dividend
and will be divided by base i.e. 16.
Conversion from Decimal Number System to Hexadecimal Number
Systems

◼ Step 4: The remainder obtained will become the second least significant digit
i.e. it will be added in the left of the previously obtained digit.
◼ The steps 3 and 4 are repeated until the quotient obtained becomes 0.
◼ The remainders obtained after each iteration are added to the left of the
existing digits.
Conversion from Decimal Number System to Hexadecimal Number
Systems
Conversion from Decimal Number System to Hexadecimal Number System
Conversion from Decimal Number System to Hexadecimal Number System
Example 1: (152.25)10
Step 1:
Divide the number 152 and its successive quotients with base 8.

Operation Quotient Remainder


152/16 9 8

9/16 0 9

(152)10=(98)16
Conversion from Decimal Number System to Hexadecimal Number System

Step 2:
Now perform the multiplication of 0.25 and successive fraction with base 16.

Operation Result carry


0.25×16 0 4

(0.25)10=(4)16

(152.25)10=(230.4)16
Conversion from Binary Number System to Decimal Number Systems

◼ Binary to Decimal Conversion:


◼ Follow the steps given below:
◼ Step 1: Multiply each digit of the Binary number with the place value
of that digit, starting from right to left i.e. from LSB to MSB.
◼ Step 2: Add the result of this multiplication and the decimal number
will be formed.
Conversion from Binary Number System to Decimal Number Systems
Conversion from Binary Number System to Decimal Number Systems
Binary to Decimal Conversion
(10110.001)2
=(1×24)+(0×23)+(1×22)+(1×21)+(0×20)+(0×2-1)+(0×2-2)+(1×2-3)

(10110.001)2
=(1×16)+(0×8)+(1×4)+(1×2)+(0×1)+ (0×1⁄2)+(0×1⁄4)+(1×1⁄8)

(10110.001)2 = 16+0+4+2+0+0+0+0.125

(10110.001)2 = (22.125 )10


Conversion from Binary Number System to Octal Number Systems

◼ Binary to Octal Conversion:


◼ Follow the steps given below:
◼ Step 1: Divide the binary number into groups of three digits starting from right
to left i.e. from LSB to MSB.
◼ Step 2: Convert these groups into equivalent octal digits.
Conversion from Binary Number System to Octal Number Systems
Conversion from Binary Number System to Octal Number Systems
Conversion from Binary Number System to Octal Number
Systems
Example 1: (111110101011.0011)2
◼ 1. Firstly, we make pairs of three bits on both sides of the binary point.
111 110 101 011.001 1

◼ On the right side of the binary point, the last pair has only one bit. To make it a
complete pair of three bits, we added two zeros on the extreme side.
111 110 101 011.001 100

◼ 2. Then, we wrote the octal digits, which correspond to each pair.


(111110101011.0011)2=(7653.14)8
Conversion from Binary Number System to Hexadecimal Number Systems

◼ Binary to Hexadecimal Conversion:


◼ Follow the steps given below:
◼ Step 1: Divide the binary number into groups of four digits starting from right to
left i.e. from LSB to MSB.
◼ Step 2: Convert these groups into equivalent hex digits.
Conversion from Binary Number System to Hexadecimal Number Systems
Conversion from Binary Number System to Hexadecimal Number Systems
Binary to Hexadecimal Conversion

Example 1: (10110101011.0011)2
◼ 1. Firstly, we make pairs of four bits on both sides of the binary point.
111 1010 1011.0011
◼ On the left side of the binary point, the first pair has three bits. To make it a
complete pair of four bits, add one zero on the extreme side.
0111 1010 1011.0011
◼ 2. Then, we write the hexadecimal digits, which correspond to each pair.
(011110101011.0011)2=(7AB.3)16
Conversion from Octal Number System to Decimal Number Systems

◼ Octal to Decimal Conversion:


◼ Follow the steps given below:
◼ Step 1: Multiply each digit of the Octal number with the place value of that
digit, starting from right to left i.e. from LSB to MSB.
◼ Step 2: Add the result of this multiplication and the decimal number will be
formed.
Conversion from Octal Number System to Decimal Number Systems
Conversion from Octal Number System to Decimal Number Systems
Conversion from Octal Number System to Decimal
Number Systems
Example 1: (152.25)8
Step :
◼ We multiply each digit of 152.25 with its respective positional weight, and last we
add the products of all the bits with its weight.
(152.25)8=(1×82)+(5×81)+(2×80)+(2×8-1)+(5×8-2)
(152.25)8=64+40+2+(2×1⁄8)+(5×1⁄64)
(152.25)8=64+40+2+0.25+0.078125

(152.25)8=106.328125
Conversion from Octal Number System to Binary Number Systems

◼ Octal to Binary Conversion:


◼ Follow the steps given below:
◼ Step 1: Write each digit of the octal number separately.
◼ Step 2: Convert each digit into an equivalent group of three binary digits.
◼ Step 3: Combine these groups to form the whole binary number.
Conversion from Octal Number System to Binary Number Systems
Conversion from Octal Number System to Binary Number Systems
Conversion from Octal Number System to Binary Number Systems

Example 1: (152.25)8
◼ We write the three-bit binary digit for 1, 5, 2, and 5.

◼ (152.25)8 = ( 001 101 010 . 010 101 )2

◼ (152.25)8 = (001101010.010101)2
Conversion from Octal Number System to Hexadecimal Number Systems

◼ Octal to Hexadecimal Conversion:


◼ Follow the steps given below:
◼ Step 1: We need to convert the Octal number to Binary first. For that, follow the steps
given in the above conversion.
◼ Step 2: Now to convert the binary number to Hex number, divide the binary digits into
groups of four digits starting from right to left i.e. from LSB to MSB.
◼ Step 3: Add zeros prior to MSB to make it a proper group of four digits(if required)
◼ Step 4: Now convert these groups into their relevant decimal values.
◼ Step 5: For values from 10-15, convert it into Hex symbols i.e from A-F
Conversion from Octal Number System to Hexadecimal Number Systems
Conversion from Octal Number System to Hexadecimal Number Systems
Conversion from Octal Number System to Hexadecimal Number Systems
Conversion from Octal Number System to Hexadecimal Number Systems

Example 1: (152.25)8

Step 1:
◼ We write the three-bit binary digit for 1, 5, 2, and 5.

(152.25)8=(001101010.010101)2

152.25 = (001101010.010101)2
Conversion from Octal Number System to Hexadecimal Number Systems

◼ Step 2:
1. Now, we make pairs of four bits on both sides of the binary point.

0 0110 1010 . 0101 01

0000 0110 1010 . 0101 0100

2. Now, we write the hexadecimal digits, which correspond to each pair.

(0000 0110 1010.0101 0100)2 = (6A.54)16


Conversion from Hexadecimal Number System to Decimal Number
Systems

◼ Hexadecimal to Decimal Conversion:


◼ Follow the steps given below:
◼ Step 1: Write the decimal values of the symbols used in the Hex number i.e.
from A-F
◼ Step 2: Multiply each digit of the Hex number with its place value. starting from
right to left i.e. LSB to MSB.
◼ Step 3: Add the result of multiplications and the final sum will be the decimal
number.
Conversion from Hexadecimal Number System to Decimal Number
Systems
Conversion from Hexadecimal Number System to Decimal Number
Systems
Conversion from Hexadecimal Number System to Decimal Number
Systems

Example 1: (152A.25)16
◼ Step 1:

(152A.25)16=(1×163)+(5×162)+(2×161)+(A×160)+(2×16-1)+(5×16-2)
(152A.25)16=(1×4096)+(5×256)+(2×16)+(10×1)+(2×16-1)+(5×16-2)
(152A.25)16=4096+1280+32+10+(2×1⁄16)+(5×1⁄256)
(152A.25)16=5418+0.125+0.125
(152A.25)16=5418.14453125

(152A.25)16 = (5418.14453125)10
Conversion from Hexadecimal Number System to Binary Number Systems

◼ Hexadecimal to Binary Conversion:


◼ Follow the steps given below:

◼ Step 1: Convert the Hex symbols into its equivalent decimal values.
◼ Step 2: Write each digit of the Hexadecimal number separately.
◼ Step 3: Convert each digit into an equivalent group of four binary digits.
◼ Step 4: Combine these groups to form the whole binary number.
Conversion from Hexadecimal Number System to Binary Number Systems
Conversion from Hexadecimal Number System to Binary Number Systems
Conversion from Hexadecimal Number System to Binary Number Systems

◼ Example 1: (152A.25)16

◼ We write the four-bit binary digit for 1, 5, A, 2, and 5.

◼ (152A.25)16=(0001 0101 0010 1010.0010 0101)2

(152.25)16 = (1010100101010.00100101)2
Conversion from Hexadecimal Number System to Octal Number Systems

◼ Hexadecimal to Octal Conversion:


◼ Follow the steps given below:
◼ Step 1: We need to convert the Hexadecimal number to Binary first. For that, follow
the steps given in the above conversion.
◼ Step 2: Now to convert the binary number to Octal number, divide the binary digits
into groups of three digits starting from right to left i.e. from LSB to MSB.
◼ Step 3: Add zeros prior to MSB to make it a proper group of three digits(if required)
◼ Step 4: Now convert these groups into their relevant decimal values.
Conversion from Hexadecimal Number System to Octal Number Systems
Conversion from Hexadecimal Number System to Other Number Systems
Conversion from Hexadecimal Number System to Octal Number Systems
Conversion from Hexadecimal Number System to Octal Number Systems

Example 1: (152A.25)16
◼ Step 1:
◼ We write the four-bit binary digit for 1, 5, 2, A, and 5.

(152A.25)16=(0001 0101 0010 1010 . 0010 0101)2

◼ 152A.25 = (0011010101010 . 010101)2


Conversion from Hexadecimal Number System to Octal Number Systems

◼ Step 2:
3. Then, we make pairs of three bits on both sides of the binary point.
001 010 100 101 010.001 001 010

4. Then, we write the octal digit, which corresponds to each pair.


(001010100101010.001001010)2=(12452.112)8

◼ 152A.25 is 12452.112
Module 1 Computer Fundamentals

1.3 Codes
Binary Coded Decimal (BCD)

◼ Binary Coded Decimal, or BCD, is another process for converting decimal numbers into their
binary equivalents.
◼ It is a form of binary encoding where each digit in a decimal number is represented in the
form of bits.
◼ This encoding can be done in either 4-bit or 8-bit (usually 4-bit is preferred).
◼ It is a fast and efficient system that converts the decimal numbers into binary numbers as
compared to the existing binary system.
◼ These are generally used in digital displays where is the manipulation of data is quite a task.
◼ Many decimal values, have an infinite place-value representation in binary but have a finite
place-value in binary-coded decimal.
Binary Coded Decimal (BCD)

Decimal BCD
Number
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
Binary Coded Decimal (BCD)


Excess-3 Code

◼ Excess-3 binary code is a unweighted self-complementary BCD code used to represent the decimal
numbers.
◼ Self-Complementary property means that the 1’s complement of an excess-3 number is the excess-3
code of the 9’s complement of the corresponding decimal number.
◼ It plays an important role in arithmetic operations because it resolves deficiencies encountered when
we use the BCD code for adding two decimal digits whose sum is greater than 9.
◼ Excess-3 code of a decimal number can be obtained by adding 3 to each decimal digit or 0011 in each
4-bit BCD code of the decimal number.
Excess-3 Code

Decimal BCD Excess-3


Number Code Code
0 0000 0011
1 0001 0100
2 0010 0101
3 0011 0110
◼ 4 0100 0111
5 0101 1000
6 0110 1001
7 0111 1010
8 1000 1011
9 1001 1100
Gray Code

◼ Gray code also named as Reflected Binary Code (RBC)is an ordering the binary number system such
that the two successive values differ in only one bit.
◼ How to generate a Gray Code?
The prefix and reflect(Mirror) method are recursively used to generate the Gray code of a number
1. Find the number of bits required to represent a number.
2. Find the code for 0, i.e., 0000, which is the same as binary.

3. Take the previous code, i.e., 0000, and change the least significant bit of it.
4. Perform this process reclusively until all the codes are not uniquely identified.
5. If by changing the least significant bit,, find the same code obtained previously, then the second
least significant bit will be changed, and so on.
Gray Code
Start Mirror Prefix Mirror Prefix Mirror Prefix
Gray Code
0 0 00 00 000 000 0000
1 1 01 01 001 001 0001
1 11 11 011 011 0011
0 10 10 010 010 0010
1-bit 10 110 110 0110
2-bit 111 111 0111
11
01 101 101 0101
00 100 100 0100
100 1100
3-bit 101 1101
111 1111
110 1110
010 1010
011 1011
001 1001
Gray Code Generation 000 1000
(Mirror and Prefix Method) 4-bit
Decimal Binary 4-bit Gray
Number Code
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
10 1010 1111
11 1011 1110
12 1100 1010
13 1101 1011
14 1110 1001
15 1111 1000
ASCII Code
ASCII Code

◼ The ASCII characters are classified into the following groups:


ASCII Code

◼ Control Characters
◼ The non-printable characters used for sending commands to the PC or printer

◼ The character from 0 to 31 and 127 comes under control characters.

◼ Special Characters
◼ All printable characters that are neither numbers nor letters

◼ contain technical, punctuation, and mathematical characters with space also.

◼ The character from 32 to 47, 58 to 64, 91 to 96, and 123 to 126 comes under this
category.
ASCII Code

◼ Number Characters
◼ Contains ten Arabic numerals from 0 to 9.

◼ Letters Characters
◼ Two groups of letters are contained, i.e., the group of uppercase letters and the
group of lowercase letters.
◼ The range from 65 to 90 and 97 to 122 comes under this category.

You might also like