01 Lecture BinarySystems
01 Lecture BinarySystems
01 Lecture BinarySystems
Binary Systems
CEN - 220 1
Outline
1.1. Digital Systems
1.2. Binary Numbers
1.3. Number Base Conversions
1.4. Octal and Hexadecimal Numbers
1.5. Complements
1.6. Signed Binary Numbers
1.7. Binary Codes
1.8. Binary Storage and Registers
1.9. Binary Logic
CEN - 220 2
1.1. Digital Systems
What is Discrete Information?
CEN - 220 3
1.1. Digital Systems
Binary Signal
CEN - 220 4
1.2. Binary Numbers
Decimal Numbers:
7,392 7 Thousands plus 3 hundreds plus 9 tens plus
2 units.
7 x 103 + 3 x 102 + 9 x 101 + 2 x 100
Convention:
Only write coefficient and deduce the power of 10 from their
position.
Coefficients have 10 different values (0-9).
a5a4a3a2a1a0.a-1a-2a-3
105a5+104a4+103a3+102a2+101a1+100a0. 10-1a-1+10-2a-2+10-3a-3
Decimal System is said to be of ‘Base’ or ‘Radix’, 10
CEN - 220 5
GENERAL formula to convert to decimal
CEN - 220 6
1.2. Binary Numbers
Binary Numbers:
Coefficients have only two possible
values (0-1).
Number represented as a combination
of 0s and 1s.
1011
Octal Numbers:
Coefficients have only eight
possible values (0-7).
Hexadecimal Numbers:
Coefficients have only sixteen
possible values (0-F).
CEN - 220 7
1.3. Number Base Conversions
Conversion of numbers with both, integer
and fractional part.
Convert the integer and fraction part
separately
Combine the two answers
(41.6875)10=(101001.1011)2
CEN - 220 8
1.4. Octal and Hexadecimal Numbers
Conversion between
Binary-Octal-
Hexadecimal
Binary-Octal
23 = 8, and 24 = 16
Each octal digital
corresponds to three
binary digits
Each Hexadecimal
digital corresponds to
four binary digits
CEN - 220 9
1.4. Octal and Hexadecimal Numbers
Conversion from binary to octal
CEN - 220 10
1.5. Complements
Complements are used in digital computers for:
Simplifying the subtraction operations
Logical manipulation
Two types of complements for any base-r number
r’s complement
(r-1)’s complement
For binary numbers:
2’s complement
1’s complement
For decimal numbers:
10’s complement
9’s complement
CEN - 220 11
1.5. Complements
Radix-1’s (r-1) Complements
(r-1)’s complement of a number N is defined as
(rn-1)-N
N The number
n number of digits number N has.
For decimal numbers, r = 10, and r-1 = 9
So 9’s complement of a decimal ‘N’ number is (10n-1-N)
If n=4, 104 -1=9,999
Therefore, 9’s complement is subtracting each digital from
9.
1’s complement of a binary number ‘N’ is (2n-1-N) Easy to
implement in
1’s complement is subtracting each digit from 1. digital logic
CEN - 220 12
1.5. Complements
Radix’s (r’s) Complements
r’s complement of a number N is defined as
rn-N
N The number
n number of digits number N has.
For decimal numbers, r = 10
So 10’s complement of a decimal number ‘N’ is (10n-N)
Can be obtained by adding 1 to 9’s complement.
CEN - 220 13
1.5. Complements
Subtraction with r’s Complements:
The subtraction of two n-digit unsigned numbers M-N in
base r can be done as follows:
I. Add the minuend, M, to the r’s complement of the
subtrahend, N.
This performs M + (rn-N)= M- N +rn
II. If M >= N, the sum will produce an end carry, rn, which
can be discarded; what is left is the result M-N
III. IF M<N, the sum does not produce an end carry and is
equal to rn- (N-M), which is the r’s complement of (N-M).
To obtain the answer in a familiar form, take the r’s
complement of the sum and place a negative sign in
front.
CEN - 220 14
1.5. Complements
CEN - 220 15
1.5. Complements
CEN - 220 16
1.5. Complements
CEN - 220 17
1.5. Complements
Subtraction with (r-1)’s Complements:
Subtraction of unsigned numbers can also be done
by means of the (r - 1)>s complement.
Remember that the (r - 1)>s complement is one less than
the r’s complement.
Because of this, the result of adding the minuend to
the complement of the subtrahend produces a sum
that is one less than the correct difference when an
end carry occurs.
Removing the end carry and adding 1 to the sum is
referred to as an end‐around carry.
CEN - 220 18
1.5. Complements
CEN - 220 19
1.6. Signed Binary Numbers
Positive numbers can be represented as
unsigned numbers
How to represent Negative Numbers?
Ordinary arithmetic represent negative number by a ‘-’
sign
Computers must represent every information as a
binary bit
A sign is represented by placing a 0, or 1 at the most
significant bit position of a binary number
0 positive number
1 Negative Number
CEN - 220 20
1.6. Signed Binary Numbers
Consider Number ‘9’
+9 is represented as 00001001
-9 is represented as 10001001
Highlighted bit is a signed bit
Signed magnitude convention
CEN - 220 21
1.6. Signed Binary Numbers
CEN - 220 22
1.6. Signed Binary Numbers
Arithmetic Subtraction
Take the 2’s complement of the subtrahend (including
the sign bit) and add it to the minuend (including the
sign bit).
A carry out of the sign‐bit position is discarded.
CEN - 220 23
1.6. Signed Binary Numbers
Negative numbers must be in 2’s
complement form
CEN - 220 24
1.7. Binary Codes
BCD value 12-bits, Equivalent binary 8-
bits
1 8 5
BCD Addition
--When the binary sum is <= 1001 (without a carry),
the corresponding BCD digit is correct.
--when the binary sum is >= 1010, the addition of 6
= (0110)2 to the binary sum converts it to the
correct digit and also produces a carry as required.
16 - 10 = 6.
CEN - 220 25
1.7. Binary Codes
Carry
Two n-digit
BCD Addition
& Subtraction
CEN - 220 26
1.7. Binary Codes
1. BCD, 2421, 84-2-1 are examples of weighted codes. 84-2-1 can represent negative numbers as well.
2. Excess-3 is obtained from corresponding binary number plus 3.
3. 2421 and Exess-3 are self complementary codes. The 9’s complement is obtained by directly
changing 1’s to 0’s and 0’s to 1’s
CEN - 220 27
1.7. Binary Codes
CEN - 220 28
1.7. Binary Codes
CEN - 220 29
CEN - 220 30
1.9. Binary Logic
AND Operation
Represented by a dot “.”
OR Operation
Represented by a plus sign “+”
Not Operation
Represented by a Prime “ ’ ” or overbar
CEN - 220 31
1.9. Binary Logic
Binary Logic Deals with variables that takes on two discrete values and operations that assume
logical meaning.
CEN - 220 32