Beruflich Dokumente
Kultur Dokumente
Lecture 3
Signed Numbers
Converting signed binaries to decimals can easily be achieved by
assigning a negative value to the weight of the sign bit and
summing all the weights containing logic 1.
4
1
2 1
1 0
+4 +2
= -58
Solve this..
Determine the decimal values of the following
signed 8-bit data when they are 1s complement and 2s
complement form
(a) 000101112 & 111010002
Answer :
-8 ~ +7
Unsign
Sign
Binary
Unsign
Sign
0000
1000
-8
0001
1001
-7
0010
1010
10
-6
0011
1011
11
-5
0100
1100
12
-4
0101
1101
13
-3
0110
1110
14
-2
0111
1111
15
-1
Signed Numbers
Arithmetic Operations - Addition
Add the 2 signed numbers and discard any
final carry bit
Example:
11111011 + 11110111
11111011
+ 11110111
Discard carry bit 1 11110010
Example:
00001000 00000011
minuend
00001000
- 00000011
subtrahend
00001000
+ 11111101
1 00000101
Discard carry
2s
complement
of
subtrahend
3
x
B
x
4
x
F
x
15,18310
830 / 16
51 / 16
3 / 16
= 51 R 14
=3R3
=0R3
E in Hex
33E16
Example
Convert 0101011010101110011010102 to hex
using the 4-bit substitution code :
Solve this..
a) Convert hexadecimal number 2316, 8D16
and EB16 to decimal
b) Convert decimal number 5210, 28410 and
289010 to hexadecimal
c) Convert hexadecimal number 3816 and
5C816 to binary
d) Convert binary number 1110 and 10111
to hexadecimal
82
81
80
Positional Values
Products
384 + 40 + 3
42710
Example
Convert 42710 to its octal equivalent
427 / 8
53 / 8
6/8
= 53 R 3
=6R5
=0R6
LSB
MSB
6538
Example
Convert 6538 to binary
6
Substitute
numbers with
3-binary digits
Example
Convert the binary numbers 110101 to octal
1 1 0 1 0 1
6
658
Solve this..
a) Convert octal number 648, 5578 and
10248 to decimal
b) Convert decimal number 4610, 10010 and
21910 to octal
c) Convert octal number 1018 and 3218 to
binary
d) Convert binary number 101010 and
110111 to octal
Digital Codes
Example
Convert 15 to BCD.
1
0001
5
0101BCD
Example:
0011
+0100
0111
Example:
1001
+
0100
1101
+
0110
00010011
1
Decimal
Binary
Gray
Code
0000
0000
0001
0001
0010
0011
0011
0010
0100
0110
0101
0111
0110
0101
Gray Codes
Solve this..
(a) Convert binary number 11111 to gray code.
Answer : ?