Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
17 views

Number System

This document discusses number systems and binary codes. It defines digital systems and introduces different types of number systems including decimal, binary, octal, and hexadecimal. It explains the concepts of bases, positional notation, weights, and signed binary numbers. The document also covers conversion between these number systems, such as converting between decimal, binary, octal, and hexadecimal. It provides examples of converting numbers between different bases. Finally, it briefly introduces binary codes which are used to represent digital data.

Uploaded by

Estefen Ermias
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Number System

This document discusses number systems and binary codes. It defines digital systems and introduces different types of number systems including decimal, binary, octal, and hexadecimal. It explains the concepts of bases, positional notation, weights, and signed binary numbers. The document also covers conversion between these number systems, such as converting between decimal, binary, octal, and hexadecimal. It provides examples of converting numbers between different bases. Finally, it briefly introduces binary codes which are used to represent digital data.

Uploaded by

Estefen Ermias
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 76

Number System

Outlines

√ Digital Systems

√ Number System

√ Types of Number Systems

√ Conversion Among Bases


DIGITAL SYSTEMS
• Digital means electronic technology that generates, stores,

and processes data in terms of two states: +ve and -ve.


• digital system is a data technology that uses discrete
(discontinuous) values represented by high and low states
known as bits. By contrast, non-digital (or analog) systems
use a continuous range of values to represent information.
• Although it’s representations can be discrete(i.e, numbers,
letters or icons) or continuous, such as; sounds, images, and
others
Introduction
• Number system can be defined as the method or
format which is used for denoting a numerical value
• We are all familiar with the number system in which
an ordered set of ten symbols 0, 1, 2, 3, 4, 5, 6, 7, 8,
9 which are known as digits are used to specify any
number.
• Digital computer represent all kinds of data and
information in binary numbers
◦ Includes audio, graphics, video, text and numbers
 Total number of digits used in the number system is
called its base or radix
Con’t ...
• Positional Notation:
For example decimal numbering system uses the
base or radix as 10 whereas hexadecimal system
uses 16 as base
Example: 1234 = 1 (103) + 2 (102) + 3(101)
+4(100)
In this example, the base or radix used is 10
Con’t ...
•Weights:
In a number system weight denotes the
positional value of each digit in the
number.
For example, suppose to denote the number
3125 we can also write it as:
(3 * 1000) + (1 * 100) + (2 * 10) + (5 * 1)
Types of Number Systems
• There are various types of number system
√ Decimal Number System
√ Binary Number System
√ Octal Number System
√ Hexadecimal Number System
◦ Decimal number system is used in general
◦ Computers used binary number system
◦ Octal and hexadecimal number system are also used in
computer systems
Decimal Number System
• Decimal system consists of 10 digits
starting from 0 to 9. This number system
has ten as its base.
• Now consider the example 246.45, this
value is formed by adding each digit
which are multiplied by the base in the
power of digit position. It is represented as
follows
2 * 102 + 4 * 101 + 6 * 100 . 4 * 10-1 + 5
*10-2
Binary Number System
• It is the simplest form of number system.
It consists of only two digits in base
which are 0 and 1 or on and off
respectively
• Each single digit in the binary system is
called as a bit (i.e; 2-bit,4-bit, 8-bit(byte))
& etc.
Octal Number System

• It is one of the most commonly used number


system in computers.
• It is used in programming because of its
similarity to binary number system
• A single octal digit is equal to three binary
digits. Octal Number System uses the base as
8
For Example convert (23) 8 to decimal
equivalent
(23)8 = 2(81) + 3(80) = 19
Octal Number System ...
Convert Octal to Binary
1.(65)8=(?)2
2.(23)8=(?)2
Convert Binary to Octal
1.(1110)2=()8
2.(1011)2=()8
Hexadecimal Number System

• This number system is used for larger


numbers.
• Hexadecimal number system uses the
base as 16
• In hexadecimal number system the
number 0 to 9 are denoted normally then
the numbers 10 to 15 are denoted by
alphabets A through F respectively
Hexadecimal Number System ...
• Convert Hexdecimal number to Decimal
number
1.(AD)16=(?)10
2.(BC4)16=(?)10
SIGNED BINARY NUMBERS
• In mathematics, positive numbers are represented as
unsigned numbers. That is we do not put the +ve sign in
front of them to show that they are positive numbers.
• However, when dealing with negative numbers we do use
a -ve sign in front of the number to show that the number
is negative in value, so same is true with signed binary
numbers
• However, in digital circuits there is no provision made to
put a plus or even a minus sign to a number ...
Con’t ...
• For signed binary numbers the most
significant bit (MSB) is used as the sign.
• If the sign bit is “0” +ve, If the sign bit is
“1” then -ve.
• The remaining bits are used to represent
the magnitude of the binary number.
Conversion Among Bases
 The possibilities:

Decimal Octal

Binary Hexadecimal
Quick Example

2510 = 110012 = 318 = 1916

Base
Decimal to Decimal

Decimal Octal

Binary Hexadecimal
Weight

12510 => 5 x 100 = 5


2 x 101 = 20
1 x 102 = 100
125

Base
Binary to Decimal

Decimal Octal

Binary Hexadecimal
Binary to Decimal
 Technique
◦ Multiply each bit by 2n, where n is the “weight” of the bit
◦ The weight is the position of the bit, starting from 0 on the
right
◦ Add the results
Example

Bit “0”

1010112 => 1 x 20 = 1
1 x 21 =
2
0 x 22 =
0
1 x 23 =
8
0 x 24 =
0
1 x 25 =
32
Octal to Decimal

Decimal Octal

Binary Hexadecimal
Octal to Decimal
 Technique
◦ Multiply each bit by 8n, where n is the “weight” of the bit
◦ The weight is the position of the bit, starting from 0 on the
right
◦ Add the results
Example

7248 => 4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
46810
Hexadecimal to Decimal

Decimal Octal

Binary Hexadecimal
Hexadecimal to Decimal
 Technique
◦ Multiply each bit by 16n, where n is the “weight” of
the bit
◦ The weight is the position of the bit, starting from 0 on the
right
◦ Add the results
Example

ABC16 => C x 160 = 12 x 1 = 12


B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
274810
Decimal to Binary

Decimal Octal

Binary Hexadecimal
Decimal to Binary
 Technique
◦ Divide by two, keep track of the remainder
◦ First remainder is bit 0 (LSB, least-significant bit)
◦ Second remainder is bit 1
◦ Etc.
Example
12510 = ?2 2 125
2 62 1
2 31 0
2 15 1 12510 = 11111012
2 7 1
2 3 1
2 1 1
0 1
Octal to Binary

Decimal Octal

Binary Hexadecimal
Octal to Binary
 Technique
◦ Convert each octal digit to a 3-bit equivalent binary
representation
Example

7058 = ?2

7 0 5

111 000 101

7058 = 1110001012
Hexadecimal to Binary

Decimal Octal

Binary Hexadecimal
Hexadecimal to Binary
 Technique
◦ Convert each hexadecimal digit to a 4-bit equivalent binary
representation
Example

10AF16 = ?2

1 0 A F

0001 0000 1010 1111

10AF16 = 00010000101011112
Decimal to Octal

Decimal Octal

Binary Hexadecimal
Decimal to Octal
 Technique
◦ Divide by 8
◦ Keep track of the remainder
Example

123410 = ?8
8 1234
8 154 2
8 19 2
8 2 3
0 2

123410 = 23228
Decimal to Hexadecimal

Decimal Octal

Binary Hexadecimal
Decimal to Hexadecimal
 Technique
◦ Divide by 16
◦ Keep track of the remainder
Example

123410 = ?16

16 1234
16 77 2
16 4 13 = D
0 4

123410 = 4D216
Binary to Octal

Decimal Octal

Binary Hexadecimal
Binary to Octal
 Technique
◦ Group bits in threes, starting on right
◦ Convert to octal digits
Example
10110101112 = ?8

1 011 010 111

1 3 2 7

10110101112 = 13278
Binary to Hexadecimal

Decimal Octal

Binary Hexadecimal
Binary to Hexadecimal
 Technique
◦ Group bits in fours, starting on right
◦ Convert to hexadecimal digits
Example
10101110112 = ?16

10 1011 1011

2 B B

10101110112 = 2BB16
Octal to Hexadecimal

Decimal Octal

Binary Hexadecimal
Octal to Hexadecimal
 Technique
◦ Use binary as an intermediary
Example
10768 = ?16

1 0 7 6

001 000 111 110

2 3 E

10768 = 23E16
Hexadecimal to Octal

Decimal Octal

Binary Hexadecimal
Exercise – Convert ...

Hexa-
Decimal Binary Octal decimal
33
1110101
703
1AF
Exercise – Convert …
Hexa-
Decimal Binary Octal decimal
33 100001 41 21
117 1110101 165 75
451 111000011 703 1C3
431 110101111 657 1AF
Binary Codes
BINARY CODES
• The digital data is represented, stored and
transmitted as group of binary bits. This group
is also called as binary code.
• The binary code is represented by the number as
well as alphanumeric letter.
√ Advantages of Binary Code
• Suitable for the computer applications
• Suitable for the digital communications
• It make the analysis and designing of digital
circuits if we use the binary codes.
• Since only 0 & 1 are being used,
implementation becomes easy
Classification of binary codes
• Broadly categorized into following categories:
√ Weighted Codes
√ Non-Weighted Codes
√ Binary Coded Decimal
√ Alphanumeric Codes
√ Error Detecting Codes
√ Error Correcting Codes
Weighted Codes

• Those binary codes which obey the positional


weight principle.
• Each position of the number represents a
specific weight.
• In these codes each decimal digit is represented
by a group of four bits.
Non-Weighted Codes
• In this type of binary codes, the positional
weights are not assigned.
• The examples of non-weighted codes are
Excess-3 code and Gray code.
Excess-3 code:
• The Excess-3 code is also called as XS-3
code.
• It is non-weighted code used to express
decimal numbers
Con’t ...
• The Excess-3 code words are derived from
the 8421 BCD code words adding (0011)2
or (3)10 to each code word in 8421.
Gray Code:
• It is the non-weighted code and it is not
arithmetic codes. That means there are no
specific weights assigned to the bit
position.
• It has a very special feature that, only one
bit will change each time the decimal
number is incremented
BCD Code

• BCD stands for Binary Coded Decimal. It


combines some of the characteristics of
both the binary and decimal systems
• The BCD code represents the decimal
digits 0 through 9 with a four bit binary
code.
• It uses the standard 8421 position
weighing system of the pure Binary code.
For example, the number 834 in BCD
would be 1000 0011 0100.
BCD Code ...
• In the BCD, with four bits we can
represent sixteen numbers (0000 to 1111).
• But in BCD code only first ten of these
are used (0000 to 1001).
• The remaining six code combinations i.e.
1010 to 1111 are invalid in BCD
Advantages of BCD Codes
• It is very similar to decimal system
• We need to remember binary equivalent
of decimal numbers 0 to 9 only
Disadvantages of BCD Codes:
√ The addition and subtraction of BCD have
different rules
√ The BCD arithmetic is little more complicated.
√ BCD needs more number of bits than binary to
represent the decimal number.
Alphanumeric codes
• A binary digit or bit can represent only two
symbols as it has only two states '0' or '1'.
• But this is not enough for communication
between two computers
• So, more symbols are required to represent
26 alphabets with capital and small letters,
numbers from 0 to 9, punctuation marks and
other symbols.
• An alphanumeric code should at least
represent 10 digits and 26 letters of alphabet
Alphanumeric codes ...

The following three alphanumeric codes are very


commonly used for the data representation:
a. American Standard Code for Information
Interchange (ASCII) 7-bit.
b. Extended Binary Coded Decimal Interchange
Code (EBCDIC) 8-bit.
c. Five bit Baudot Code.
Error Codes:
• There are binary code techniques available to
detect and correct data during data transmission
Excess-3 to BCD Conversion

• Step 1 -- Subtract (0011)2 from each 4 bit of


excess-3 digit to obtain the corresponding BCD
code.
• Example − convert (10011010)XS-3 to BCD.
Given XS-3 number = 1 0 0 1 1 0 1 0
Subtract (0011)2 = 0 0 1 1 0 0 1 1
Result
(10011010)XS-3 = ( ? )BCD
COMPLIMENTS
• Compliments are used in digital
computers to simplify the subtraction
operation and for logical manipulation.
• Simplifying operations leads to simpler,
less expensive circuits to implement the
operations.
• There are 2 types of complements for
each base r system
• (1) The radix complement (r’s)
• (2) Diminished radix compliment r-1’s
Con’t ...
• The (r-1)'s Complement: Subtract each digit
of a number from (r-1)
Example: -
- 9's complement of 83510 is 16410
- 1's complement of 10102 is 01012(bit by bit
complement operation)
• The r's Complement: Add 1 to the low-order
digit of its (r-1)'s complement
Example:
- 10's complement of 83510 is 16410 + 1 = 16510
- 2's complement of 10102 is 01012 + 1 = 01102
Binary Subtraction Using 2's Complement

• Before we start binary subtraction, we


first need to understand what 1’s and 2’s
complement is.
• All information in the system memory is
stored in binary, meaning all integers are
stored in the memory in various
combinations of 0’s and 1’s.
• 1’s complement is taken by inverting all
the binary digits in the number, i.e.
replacing 0’s with 1’s and 1’s with 0’s.
Cont ...
• For example, the 1’s complement of
(100101)2 is (011010)2
• 2’s complement on the other hand enables
us to denote both positive numbers and
negative numbers in the binary system.
• The most significant bit in the 2’s
complement representation of a binary
number denotes its sign, i.e. whether it is
+ve or -ve.
Cont ...
• 2’s complement of a number can be found
by adding a 1 to the 1’s complement of a
number
From the example above, we find the 1’s
complement of (100101)2​to be (011010)2
Now, the 2’s complement of (100101)2​is
(011011)2
• A point to note is that 1’s and 2’s
complement are used to represent signed
numbers. ... MSB
Cont ...

• As we can see here, the number (−6)10 will be


denoted as (11010)2 and (6)10 will be denoted as
(00110)2
Cont ...
• In computers, subtraction of numbers is
done using addition of one number with
the 2’s complement of the other.
e.g: (X-Y) = X + (2’s complement of Y)
• Note: both the binary numbers must have
the same number of bits.
• If they do not, then we need to pad the
shorter number with 0’s to its left.
Cont ...
• The addition of binary bits is as follows:

• note: from the table above is that binary addition and


subtraction is the same as XOR operation.
Exercise
let us subtract 5 from 7; (hint: use binary
subtraction)

Ans: ?

You might also like