Chapter 3 Number System and Codes. Decimal and Binary Numbers.
-
date post
22-Dec-2015 -
Category
Documents
-
view
274 -
download
5
Transcript of Chapter 3 Number System and Codes. Decimal and Binary Numbers.
Chapter 3Chapter 3
Number System and Number System and CodesCodes
Decimal and Binary Decimal and Binary NumbersNumbers
Decimal and Binary Decimal and Binary NumbersNumbers
Converting Decimal to Converting Decimal to BinaryBinary
1.Sum of powers of 2
Converting Decimal to Converting Decimal to BinaryBinary
1.Repeated Division
Binary Numbers and Binary Numbers and ComputersComputers
Hexadecimal NumbersHexadecimal Numbers
Converting decimal to Converting decimal to hexadecimalhexadecimal
Converting binary to Converting binary to hexadecimalhexadecimal
Converting hexadecimal to Converting hexadecimal to binarybinary??
Hexadecimal numbersHexadecimal numbers
Binary arithmeticBinary arithmetic
Binary additionBinary addition
Representing Integers with Representing Integers with binarybinary
Some of challenges:-Some of challenges:- Integers can be positive or negativeIntegers can be positive or negative Each integer should have a unique Each integer should have a unique
representationrepresentation The addition and subtraction should be The addition and subtraction should be
efficient.efficient.
Representing a positive Representing a positive numbersnumbers
Representing a negative Representing a negative numbers using Sign-numbers using Sign-Magnitude notationMagnitude notation
-5 = 1101 4-bits sign-manitude-55 =10110111 8-bits sign-
magnitude
11’’s Complements Complement
The 1’s complement representation The 1’s complement representation of the positive number is the same of the positive number is the same as sign-magnitude.as sign-magnitude. +84 = 01010100+84 = 01010100
11’’s Complements Complement
The 1’s complement representation The 1’s complement representation of the negative number uses the of the negative number uses the following rule:-following rule:- Subtract the magnitude from 2Subtract the magnitude from 2nn-1-1
For example:For example: -36 = ???-36 = ???
+36 = 0010 0100+36 = 0010 0100
11’’s Complements Complement
Example :-Example :- - 57- 57
+57 = 0011 1001+57 = 0011 1001 -57 = 1100 0110-57 = 1100 0110
Converting to decimal Converting to decimal formatformat
22’’s Complements Complement
For negative numbers:-
Subtract the magnitude from 2n. Or
Add 1 to the 1’s complement
ExampleExample
Convert to decimal valueConvert to decimal value
Positive values:- Positive values:- 0101 1001 = +890101 1001 = +89
Negative valuesNegative values
Two's Complement Arithmetic
Adding Positive Integers in 2's Complement Form
Overflow in Binary Addition
Overflow in Binary Addition
Overflow in Binary Addition
Overflow in Binary Addition
Adding Positive and Negative Integers in 2's
ComplementForm
Adding Positive and Negative Integers in 2's
ComplementForm
Subtraction of Positive and Negative Integers
Digital Codes
Binary Coded Decimal (BCD)
BCD
BCD
4221 Code
Gray Code
In pure binary coding or 8421 BCD then counting from 7 (0111) to 8 (1000) requires 4 bits to be changed simultaneously.
Gray coding avoids this since only one bit changes between subsequent numbers
Binary –to-Gray Code Conversion
Gray –to-Binary Conversion
Gray –to-Binary Conversion
The Excess-3- Code
ParityParity
The method of parity is widely used as The method of parity is widely used as a method of error detection.a method of error detection. Extar bit known as parity is added to data Extar bit known as parity is added to data
wordword The new data word is then transmitted.The new data word is then transmitted.
Two systems are used:Two systems are used: Even parity: the number of 1’s must be Even parity: the number of 1’s must be
even.even. Odd parity: the number of 1’s must be odd.Odd parity: the number of 1’s must be odd.
ParityParity
Example:Example:
Even Even ParityParity
Odd Odd parityparity
11001110011110011110010110010
11110111100111100111101111101
11000110000110000110001110001