Chapter 1 Number Systems and Code Systems
Chapter 1 Number Systems and Code Systems
CODE SYSTEMS 1
OBJECTIVES
10011
ADDITION SUBTRACTION
0+0 0 0-0 0
1-0 1
0+1 1
0-1 1 (borrow 1
1+0 1 to be 10)
1+1 0 carry 1 1-1 0
ADDITION
• Adding two binary numbers together is like adding decimal
numbers, except 1 + 1 = 10 (in binary, that is), so you have to
carry the one to the next column:
Ex 2
ex 1
0001
0001
+ 0001
+ 0100
----
----
0010 (1 plus 1 is 10, carry the 1
0101 (no carries to get this)
to the next column)
Ex 3 Ex 4
0011 0011
+ 0011 + 0101
---- ----
0110 1000 (carry in every column here)
(1 + 1 = 10, so carry; then 1 + 1
+ 1 = 11, so carry again)
SUBTRACTION 9
• any subtracting number that less than the
subtracted number must be lend from a digit,
which at a larger sequence.
example 1
1010
- 0111
----
0011 (0-1, borrow 1 )
ADDITON AND SUBTRACTION OF
BINARY NUMBER
EXAMPLE 1: 110002 + 111002
ADDITON AND SUBTRACTION OF
BINARY NUMBER
EXAMPLE 2: 1110002 - 0111112
EXCHANGING BINARY TO
DECIMAL
= 5.510
EXCHANGING BINARY TO
DECIMAL
101.0112 = (1x22)+(1x20)+(1x2-2)+(1x2-3)
= 4 + 1 + 0.25 + 0.125
= 5.37510
EXCHANGING DECIMAL TO
BINARY
Exchange 7510 to binary
2 75 Remainder
2 37 1
2 18 1
2 9 0
2 4 1
2 2 0
2 1 0
0 1
10010112
EXCHANGING DECIMAL TO
BINARY
Exchange 21.8410 to binary
2 21 Remainder 0.84 x 2 = 1.68
2 10 1
2 5 0 0.68 x 2 = 1.36
2 2 1
0.36 x 2 = 0.72
2 1 0
0 1
10101.1102
OCTAL NUMBER SYSTEMS
6 + 7 + 1 = 14 – 8 =
6 carry 1
1 1
5 + 7 + 1 = 13 – 8 = 4 + 7 = 11 – 8 =
5 6 48
5 carry 1 3 carry 1
+ 7 7 78
--------------
1 5 6 38
ADDITION
45678 12348
+ 65378 + 56738
133268 71278
SUBTRACTION
1+8-6=3
borrow 1
5 1
5-2=3 1+8-7=2
6 2 18 borrow 1
- 2 6 78
--------------
3 3 28
SUBTRACTION
45578 35678
- 26648 - 26548
16738 07138
EXCHANGING OCTAL TO DECIMAL
8 60 0
8 7 4
0 7
7408
EXCHANGING DECIMAL TO OCTAL
Exchange 953.4510 to octal
8 953 Remainder
0.45 x 8 = 3.60
8 119 1
8 14 7 0.60 x 8 = 4.80
8 1 6 0.80 x 8 = 6.40
0 1
1671.3468
EXCHANGING OCTAL TO BINARY
5748 = 1011111002
EXCHANGING BINARY TO OCTAL
Divide 3 bit each
starting from LSB
111110011112 = 37178
HEXADECIMAL NUMBER SYSTEMS
B = 11, 11 + 7 + 1 =
19 – 16 = 3 carry 1
C = 12, 12 + 7 + 1 = 1 1
20 – 16 = 4 carry 1
C B A 16 A = 10, 10 + 7 = 17
+ 7 7 7 16 – 16 = 1 carry 1
--------------
1 4 3 1 16
ADDITION
4EA716 ABCD16
+ AF5916 + 567316
FE0016 1024016
SUBTRACTION
1 + 16 - 6 = 11 = B
borrow 1
5 1
5-2=3 6 2 1 16 1 + 16 - 7 = 10 = A
borrow 1
- 2 6 7 16
--------------
3 B A 16
SUBTRACTION
4EA716 ABCD16
- 2F5916 - 567316
1F4E16 555A16
EXCHANGING HEXADECIMAL TO
DECIMAL
= 700.082
EXCHANGING DECIMAL TO
HEXADECIMAL
Exchange 74510to Hexadecimal
16 745 Remainder
16 46 9
16 2 E
0 2
2E916
EXCHANGING DECIMAL TO
HEXADECIMAL
Exchange 953.4510 to Hexadecimal
16 59 9 0.20 x 16 = 3.20
16 3 B
0.20 x 16 = 3.20
0 3
3B9.73316
EXCHANGING HEXADECIMAL TO
BINARY
4 bit each
9EF16 9 E F
1001 1110 1111
9EF16 = 1001111011112
EXCHANGING BINARY TO
HEXADECIMAL
Divide 4 bit each
starting from LSB
111110011112 = 7CF16
EXERCISE
(OBE : DISCUSSION)
1. Convert into decimal
a. 1100102
b. 3258
c. BC6916
2. Arithmetic operations
a. 110012 + 10102
b. 2658 + 3128
c. 124B16 + 235D16
d. 101102 – 11002
e. 5678 – 2368
f. DB316 – A2316
ANSWER
2. Arithmetic operations
a. 1000112
b. 5778
c. 35A816
d. 10102
e. 3318
f. 39016
SIGNED NUMBER
1001 1010
Convert
0110 0101 0 to 1
1 to 0
2’S COMPLIMENT
1st step
2nd step
+ 1
--------------
0110 0110 Answer
ARITHMETIC (ADDITION)
IMPORTANT NOTES!!!
1. Positive number :
Change to 8 bit binary number
20 + (-10)
2. Negative number :
a. Change to 8 bit binary number
a) 20 = 0 0001 0100 b. Change to 1’s compliment
c. Change to 2’s compliment
c)
1 1111 0011
+ 1 1111 0101
bit to be --------------
ignore 1 1 1110 1000
ARITHMETIC (SUBTRACTION)
(+13) - (+11)
c)
0 0000 1101
- 0 0000 1011
--------------
0 0000 0010
ARITHMETIC (SUBTRACTION)
(-15) - (-20)
c)
1 1111 0001
- 1 1111 1100
--------------
0 0000 0101
B. BINARY CODED DECIMAL (BCD)
4 bit each
42310 4 2 3
0100 0010 0011
90510 BCD
9 0 5
1001 0000 0101
Binary Hex 0 1 2 3 4 5 6 7
2 o’clock
2 sp o ’ c l o c k
Bin 011 010 110 010 110 110 110 110 110
0010 0000 1111 0111 0011 1100 1111 0011 1011
Hex 32 20 6F 27 63 6C 6F 63 6B
GRAY CODE