0% found this document useful (0 votes)
11 views33 pages

Lecture 2 - Number Systems

The document provides an overview of various number systems including decimal, binary, octal, and hexadecimal, detailing their characteristics and applications. It includes mathematical operations such as addition, multiplication, and division specific to binary numbers, along with conversion methods between different number systems. Additionally, it covers coding systems like binary codes and alphanumeric codes, emphasizing their relevance in computing.

Uploaded by

Glenn Virrey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views33 pages

Lecture 2 - Number Systems

The document provides an overview of various number systems including decimal, binary, octal, and hexadecimal, detailing their characteristics and applications. It includes mathematical operations such as addition, multiplication, and division specific to binary numbers, along with conversion methods between different number systems. Additionally, it covers coding systems like binary codes and alphanumeric codes, emphasizing their relevance in computing.

Uploaded by

Glenn Virrey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

NUMBER

SYSTEM
Chapter 1 NUMBER SYSTEM

TABLE OF CONTENTS

Introduction ……………………………………………………………………………………. 2
Kinds of Number System ……………………………………………………………………………… 3
Decimal Number System …………………………………………………………………… 3
Binary Number System ……………………………………………………………………… 3
Octal Number System ………………………………………………………………………... 4
Hexadecimal Number System …………………………………………………………….. 4
Mathematical Operation ………………………………………………………………………………. 6
Addition of Binary Numbers ……………………………………………………………… 6
Multiplication of Binary Numbers ……………………………………………………… 7
Division of Binary Numbers ……………………………………………………................ 8
Addition of Octal and Hexadecimal Numbers ……………………………………… 10
Multiplication of Octal and Hexadecimal Numbers ……………………………… 11
Division of Octal and Hexadecimal Numbers ………………………………………. 13
Addition and Multiplication Table for Binary,
Octal and Hexadecimal Number System ………………………................. 16
Complement ………………………………………………………………………………………………... 18
Radix complement (r's) complement …………………………………………………. 18
Diminished Radix Complement (r -1)’s complement …………………………... 19
Subtraction using r's complement Method ……………………………..………….. 19
Subtraction using (r - 1)'s complement Method ………………………………..... 20
Conversion …………………………………………………………………………………………………. 22
Binary, Octal, Hexadecimal to Decimal Conversion ………………………….…. 22
Decimal to Binary, Octal, Hexadecimal Conversion …………………………..… 23
Binary to Octal and Hexadecimal Conversion ………………………….…………. 24
Octal and Hexadecimal to Binary Conversion ……………………………….……. 24
Codes ……………………………………………………………………………………….…………..…….. 25
Binary Codes ………………………………………………………………….………………… 25
Other 4-Bit Code, Excess-3 Code ……………………………………............. 25
Five-bit Code, More than 5 – bit code ……………………………………… 26
Alphanumeric Code ………………………………………………………………………..… 27
ASCII ………………………………………………………………………………….….. 27
EBCIDIC ………………………………………………………………………………… 30
Parity Code …………………………………………………………………………………..….. 32

1
Chapter 1 NUMBER SYSTEM

NTRODUCTION
Since childhood, we have learned to do our computations using the numbers
0 - 9, the digits of the decimal number system. In fact, we are so accustomed to
working with decimal numbers

that we hardly think about their use. We pay monthly bills, and even solve algebra
homework with the aid of the decimal number system.

But decimal number system is not the only type of number system, these also
includes the binary, octal, and hexadecimal number system.

Decimal number system is easier for humans to handle mainly because we


have ten fingers. While it is fine for us to use ten digits for our computations, computers do
not have this luxury. Every computer processor is made of millions of tiny switches that
can be turned off or on. Since these switches only have two states, it makes sense for a
computer to perform its computations with a number system that only has two digits: the
binary number system. These digits (0 and 1) are called bits and correspond to the off/on
positions of the switches in the computer processor.

While the binary number system is very important because of its connection
with computers, it is not the only other number system of importance. The octal number
system is a base-8 number system and uses the digits 0 - 7 to represent numbers. The
hexadecimal number system is a base-16 number system and uses the digits 0 - 9 along
with the letters A - F to represent numbers.

2
Chapter 1 NUMBER SYSTEM

INDS OF NUMBER SYTEM


Decimal Number System
The decimal number system (also called base ten or
occasionally denary) has ten as its base. It is the most widely used numerical
base by modern civilizations.

Decimal notation often refers to a base-10 positional notation such as the Hindu-
Arabic numeral system; however, it can also be used more generally to refer to non-
positional systems such as Roman or Chinese numerals which are also based on powers of
ten.

This kind of number system uses the values from 0-9 and also these are the regular
numbers that we used.

Binary numbers or base-2 numeral system


It represents numeric values using two symbols: 0and 1. More specifically, the
usual base-2 system is a positional notation with a radix of 2. Some applications of this
number system are computers and computer based devices such as mobile phone because
of its straightforward implementation in digital electronic circuitry using logic gates. Each
binary digit is called a bit.
Decimal Binary Count
Count 16s 8s 4s 2s 1s
0 0
1 1
2 1 0
3 1 1
4 1 0 0
5 1 0 1
6 1 1 0
7 1 1 1
8 1 0 0 0
9 1 0 0 1
10 1 0 1 0
11 1 0 1 1
3
Chapter 1 NUMBER SYSTEM

12 1 1 0 0
13 1 1 0 1
14 1 1 1 0
15 1 1 1 1
16 1 0 0 0 0
17 1 0 0 0 1
18 1 0 0 1 0
19 1 0 0 1 1
Value 24 23 22 21 20
Powers of 2
Table 1 Counting in binary and decimal

Counting in binary is illustrated in Fig. 1. The binary number is shown on the right
with its decimal equivalent. Notice that every bit place has its corresponding value. The
least significant (LSB) is the 1s place. In other words, if a 1 appears in the right column, a 1
is added to the binary count. The second place is the 2s place, means that whenever there is
1 in the second 2 is added to the binary count. Hence, each place value can be simplified as
2n, where n is the place of the digit starting with 0.

Octal numeral system

The octal numeral system is the base-8 number system, meaning eight symbols are
used to represent all the quantities. It uses the values from 0 to 7.

Octal 0 1 2 3 4 5 6 7 10 11 12… 17 20… 30… 77 100

Decimal 0 1 2 3 4 5 6 7 8 9 10… 15 16… 24… 63 64

Table 2 Counting in Octal and decimal

Hexadecimal Numbers

Hexadecimal numbers system or base-16 number system has a radix of 16. It uses
values from 0-15 where values from 10-15 are represented by A-F. The usefulness in
converting directly from a 4-bit binary number is one of its advantages.

4
Chapter 1 NUMBER SYSTEM

Each hexadecimal digit represents four binary digits (bits) which also a nibble,
which half of an octet or a byte (8 binary digits or bits). The primary use of a hexadecimal
notation is a human-friendly representation of binary-coded values in computing and
digital electronics. For example, byte values can range from 0 to 255 (decimal), but may be
simply and more conveniently represented as two hexadecimal digits in the range 00 to FF.
Hexadecimal is also commonly used to represent computer memory addresses.

Decimal Binary Hexadecimal Decimal Binary Hexadecimal


0 0000 0 16 10000 10
1 0001 1 17 10001 11
2 0010 2 18 10010 12
3 0011 3 19 10011 13
4 0100 4 20 10100 14
5 0101 5 21 10101 15
6 0110 6 22 10110 16
7 0111 7 23 10111 17
8 1000 8 24 11000 18
9 1001 9 25 11001 19
10 1010 A 26 11010 1A
11 1011 B 27 11011 1B
12 1100 C 28 11100 1C
13 1101 D 29 11101 1D
14 1110 E 30 11110 1E
15 1111 F 31 11111 1F
Table 3 Counting in decimal binary and hexadecimal number systems

Notice that the hexadecimal equivalent of the decimal 16 is 10, simply because it
uses the place value idea. The first hexadecimal digit has 160 values, the second has 161,
and the third has 162, and so on. The 1 (in 1016) stands for 16 units, while the 0 stands for
zero units.

5
Chapter 1 NUMBER SYSTEM

ATHEMATICAL OPERATION
Addition of Binary Numbers
Addition of binary numbers is the same and simpler compared to
adding decimal numbers

PROCEDURE:

1) Align the least significant bit of the binary numbers.


2) Add each of the aligned bits.
3) If there is a carry, add it to the next bit position.

Example:

100110101 + 110011100

1) Align LSBs

1 0 0 1 1 0 1 0 1
+ 1 1 0 0 1 1 1 0 0

2) Add the aligned bits

1 0 0 1 1 0 1 0 1 a) 1 + 0 = 1
+ 1 1 0 0 1 1 1 0 0 b) 0 + 0 = 0
0 1

3) Add the carry to the next bit position


1 1
1 0 0 1 1 0 1 0 1 c) 1 + 1 = 10, write 0 then carry 1
+ 1 1 0 0 1 1 1 0 0 d) 1 + 0 + 1 = 10, write 0 then carry 1
0 0 0 1

6
Chapter 1 NUMBER SYSTEM

1 1 1 1
1 0 0 1 1 0 1 0 1
+ 1 1 0 0 1 1 1 0 0
1 0 1 1 0 1 0 0 0 1 Result

Multiplication of Binary Numbers


Multiplication of binary numbers is the same and simpler compared to multiplying
decimal numbers

PROCEDURE:

1) Align the least significant bit of the binary numbers.


2) Focusing on the multiplier, multiply the least significant bit to every bit of the
multiplicand.
3) Place the product in the same position where the bit is multiplied.
4) Go to the next least significant bit and repeat steps (3) and (4).
5) After multiplying, add all the bits.

Example:

10101 x 11100

1) Align LSBs

1 0 1 0 1 Multiplicand
x 1 1 1 0 0 Multiplier

2) Multiply the LSB of the multiplier to the multiplicand

1 0 1 0 1
x 1 1 1 0 0 10101x0=00000

3) Place the product in position

1 0 1 0 1
x 1 1 1 0 0
0 0 0 0 0

7
Chapter 1 NUMBER SYSTEM

4) Go to the next position and repeat (3) and (4)

1 0 1 0 1
x 1 1 1 0 0
0 0 0 0 0
0 0 0 0 0
1 0 1 0 1
1 0 1 0 1
1 0 1 0 1

5) Add

1 0 1 0 1
x 1 1 1 0 0
0 0 0 0 0
0 0 0 0 0
1 0 1 0 1
1 0 1 0 1
1 0 1 0 1
1 0 0 1 0 0 1 1 0 0

Division of Binary Numbers


Division of binary numbers is the same and simpler compared to dividing decimal
numbers

PROCEDURE:

1) Count the number of bits of the divisor (Let n be the number of bits of divisor).
2) If the first n bits of the dividend are equal or greater than the n bits of the
divisor, write 1 at the nth bit, otherwise, write 0 then bring down the next bit.
3) Multiply the bit quotient to the divisor and then subtract it to the n or (n + 1) bits
that are used in step (2).
4) After subtracting, bring down the next bits to make n bits again then repeat steps
(2) and (3).

8
Chapter 1 NUMBER SYSTEM

Example:

1011001 ÷ 101
1) Count the bits of the divisor.

n=3

2) Compare
1
101 1 0 1 1 0 0 1 101 = 101, Quotient = 1

3) Multiply and subtract

1
101 1 0 1 1 0 0 1
- 1 0 1
0 0 0

4) Bring down

1 0 0 0 1 Quotient
101 1 0 1 1 0 0 1
- 1 0 1
1 0 0 101 > 100
- 0 0 0
1 0 0 1 101 < 1001
- 1 0 1
1 0 0 Remainder

All operations were used in binary system. Other number systems like
octal and hexadecimal number system have the same procedure like the
binary number system but with an additional step if dealing with carry.

9
Chapter 1 NUMBER SYSTEM

Addition of Octal and Hexadecimal Numbers

Example:
17458 + 23648

Add like decimal number system

1 7 4 5
+ 2 3 6 4
9 if the sum is greater than the base number system,
subtract the base number to the sum then add 1 to
the next position.
1
1 7 4 5
+ 2 3 6 4
9
- 8
1

1 1
1 7 4 5
+ 2 3 6 4 Repeat procedure
1 1 1
- 8
3

1 1 1
1 7 4 5
+ 2 3 6 4
4 3 3 1 Result

10
Chapter 1 NUMBER SYSTEM

Example:
45AC16 + 12E316

4 5 A C
+ 1 2 E 3
15 15 in Hexadecimal character is “F”

1
4 5 A C
+ 1 2 E 3
8 F

1
4 5 A C
+ 1 2 E 3
5 8 8 F Result

Multiplication of Octal and Hexadecimal Numbers

Example:
748 x 258

7 4 carry
x 2 5
20 20 – 2(8) = 4, carry 2

2
7 4
x 2 5
37 4 37 – 4(8) = 5, carry 4

11
Chapter 1 NUMBER SYSTEM

7 4
x 2 5
4 5 4
8 8 – 1(8) = 0, carry 1

7 4
x 2 5
4 5 4
14 8 14 – 1(8) = 6, carry 1

7 4
x 2 5
4 5 4
1 6 8 Add

7 4
x 2 5
4 5 4
1 6 8
13 4 13 – 1(8) = 5, carry 1

7 4
x 1 2 5
4 5 4
1 6 8
11 5 4 11 – 1(8) = 3, carry 1

7 4
x 1 2 5
1 4 5 4

1 6 8
2 3 5 4 Result

12
Chapter 1 NUMBER SYSTEM

Division of Octal and Hexadecimal Numbers

Example:
42718 ÷ 168

16 4 2 7 1 428 = 3410, 168 = 1410


3410 ÷ 1410 = 210 , disregard
remainder 210 = 28

2
16 4 2 7 1 28 x 168 = 348
- 3 4 428 – 348 = 68
6 7

2
16 4 2 7 1
- 3 4
6 7 678 = 5510, 168 = 1410
5510 ÷ 1410 = 310 , disregard
remainder
310 = 38

2 3
16 4 2 7 1
- 3 4
6 7 38 x 168 = 528
-5 2 678 – 528 = 158
1 5 1

13
Chapter 1 NUMBER SYSTEM

2 3
16 4 2 7 1
- 3 4
6 7
-5 2
1 5 1 1518 = 10510, 168 = 1410
10510 ÷ 1410 = 710 , disregard
remainder
710 = 78

2 3 7 Quotient
16 4 2 7 1
- 3 4
6 7
-5 2
1 5 1 78 x 168 = 1428
-1 4 2
7 Remainder

Example:
FFFF16 ÷ 2116

21 F F F F FF16 = 25510, 2116 = 3310


25510 ÷ 3310 = 710 , disregard
remainder
710 = 716

7
21 F F F F 716 x 2116 = E716
- E 7 FF16 – E716 = 1816
1 8 F

7
21 F F F F
- E 7
1 8 F 18F16 = 39910, 2116 = 3310
18F10 ÷ 3310 = 1210 , disregard
remainder
1210 = C16

14
Chapter 1 NUMBER SYSTEM

7 C
21 F F F F
- E 7
1 8 F C16 x 2116 = 18C16
-1 8 C 18F16 – 18C16 = 316
3 F

7 C
21 F F F F
- E 7
1 8 F
-1 8 C
3 F 3F16 = 6310, 218 = 3310
6310 ÷ 3310 = 110 , disregard
remainder
110 = 116

7 C 1 Quotient
21 F F F F
- E 7
1 8 F
-1 8 C
3 F 116 x 2116 = 2116
-2 1 3F16 – 2116 = 1E16
1 E Remainder

15
Chapter 1 NUMBER SYSTEM

Addition and Multiplication Table for Binary, Octal and Hexadecimal


Number System

Binary Number System

+ 0 1 x 0 1
0 0 1
0 0 0
1 1 10
1 0 1

Octal Number System

+ 0 1 2 3 4 5 6 7
0 0 1 2 3 4 5 6 7
1 1 2 3 4 5 6 7 10
2 2 3 4 5 6 7 10 11
3 3 4 5 6 7 10 11 12
4 4 5 6 7 10 11 12 13
5 5 6 7 10 11 12 13 14
6 6 7 10 11 12 13 14 15
7 7 10 11 12 13 14 15 16

x 0 1 2 3 4 5 6 7
0 0 0 0 0 0 0 0 0
1 0 1 2 3 4 5 6 7
2 0 2 4 6 10 12 14 16
3 0 3 6 11 14 17 22 25
4 0 4 10 14 20 24 30 34
5 0 5 12 17 24 31 36 43
6 0 6 14 22 30 36 44 52
7 0 7 16 25 34 43 52 61

16
Chapter 1 NUMBER SYSTEM

Hexadecimal Number System

+ 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 0 1 2 3 4 5 6 7 8 9 A B C D E F
1 1 2 3 4 5 6 7 8 9 A B C D E F 10
2 2 3 4 5 6 7 8 9 A B C D E F 10 11
3 3 4 5 6 7 8 9 A B C D E F 10 11 12
4 4 5 6 7 8 9 A B C D E F 10 11 12 13
5 5 6 7 8 9 A B C D E F 10 11 12 13 14
6 6 7 8 9 A B C D E F 10 11 12 13 14 15
7 7 8 9 A B C D E F 10 11 12 13 14 15 16
8 8 9 A B C D E F 10 11 12 13 14 15 16 17
9 9 A B C D E F 10 11 12 13 14 15 16 17 18
A A B C D E F 10 11 12 13 14 15 16 17 18 19
B B C D E F 10 11 12 13 14 15 16 17 18 19 1A
C C D E F 10 11 12 13 14 15 16 17 18 19 1A 1B
D D E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C
E E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D
F F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E

17
Chapter 1 NUMBER SYSTEM

OMPLEMENT
Complements are used for simplifying the operation of subtraction in
number system and also for logical manipulation. There are two types of
complements for binary as well as decimal number system which are radix
complement and diminished radix complement.
The r’s complement is known as 2's complement and (r-1)’s
complement is 1's complement for a Binary System. For Decimal Number System, radix
complement is known as 10's complement and Diminished Radix Complement (r-1)’s
complement is 9's Complement.

Radix complement (r's) complement

If we are given any number N having digits n in base r system, then r's complement
can be defined as rn-N for N not equal to zero and for N=0.

Example:
10’s complement of 45678
rn-N = 105-45678 = 54322
10’s complement of 0.22393
rn-N = 100-0.22393 = 0.77607
2’s complement of (10100)
rn-N = 25-(10100) = 100000-10100 = 1100

For the first given example, the 10's complement of 45678 is obtained by using the
formula rn-N. The small n indicates the number of significant digits in the given N and r is
the base number which is 10.

18
Chapter 1 NUMBER SYSTEM

Diminished Radix Complement (r -1)’s complement

If we are given any number N having digits n in base r system, then (r-1)’s
complement can be defined as rn-r-m-N.

Example:
9’s complement of 45678
rn-r-m-N = 105 – 100 – 45678 = 54321
9’s complement of 0.22393
rn-r-m-N = 100 – 10-5 – 0.22393 = 0.77607
1’s complement of (10100)
rn-r-m-N = 25 – 20 – (10100)
= 100000 – 000001 – 010100
= 1011

For the first given example, the 9’s complement of 45678 is obtained using the
formula of the (r-1)’s complement which is rn-r-m-N. The m indicates the fraction part of
the given N and the small letter n is the number of significant digits. Applying the formula
will give us the answer that must be the difference of 10’s complement minus 1.

Subtraction using r's complement Method

If you want to subtract two numbers in example a number S (subtrahend) from M


(minuend) using r’s complement. A certain rules must be followed:
1. The minuend M must be in its complements form and the subtraction operation
will be change to addition.
2. A carry in the sum of S and M has a meaning. If a carry occurs, ignore it and take
only the rest for the answer and if there is no carry, take the r’s complement of
the result and place a negative sign in front for the answer.

19
Chapter 1 NUMBER SYSTEM

Example 1: Solve 6482710 - 4820310


r’s complement of M = 105 – 48203 = 51797
64827
+ 51797
116624
Answer: 16624

Example 2: Solve 4820310 - 6482710


r’s complement of M = 105 – 64827 = 35173
48203
+ 35173
83376
For an answer with no carry, take the complement of it and put a negative sign on
the final answer.
105 – 83376 = 16624
Answer: -16624

Example 3: Solve 1101002


-1010112
r’s complement of 101011 = 010101
110100
+ 010101
10010012
Answer: 1001

Subtraction using (r - 1)'s complement Method

If you want to subtract two numbers in example a number S (subtrahend) from M


(minuend) using (r-1)’s complement. These rules must be followed.
1. The minuend M must be in its complements form and the subtraction operation
will be change to addition.

20
Chapter 1 NUMBER SYSTEM

2. A carry in the sum of S and M has a meaning. If a carry occurs, bring it down add
it to get the true answer and if there is no carry, take the (r-1)’s complement of
the result and place a negative sign in front for the answer.

Example 1: Solve 6482710 - 4820310


(r-1)’s complement of M = 105 – 100 - 48203 = 51796
64827
+51796
116623
+ 1
16624
Answer: 16624

Example 2: Solve 4820310 - 6482710


(r-1)’s complement of M = 105 – 100 - 64827 = 35172
48203
+35172
83375
For an answer with no carry, take the complement of it and put a negative sign on
the final answer.
105 – 100 - 83375 = 16624
Answer: -16624

Example 3: Solve 1101002


-1010112
(r-1)’s complement of 101011 = 010100
110100
+010100
10010002
+ 1
1001
Answer: 1001

21
Chapter 1 NUMBER SYSTEM

ONVERSION
Number systems can be converted to another number system
with different radix as long as their numerical/decimal values remains the
same. For example, 208 and 100002 are equivalent since they have the same
numerical/decimal value of 16.

Binary, Octal, Hexadecimal to Decimal Conversion


Conversion of base r to decimal is done by getting the weighted sum of the power
series. See the following examples for the procedure on how it is done.

Example 1: Convert 10001002 to decimal.


10001002 = 1x26 + 0x25 + 0x24 + 0x23 + 1x22 + 0x21 + 0x20
= 64 + 0 + 0 +0 + 4 + 0 + 0
10001002 = 6810

Example 2: Convert 6328 to decimal.


6328 = 6x82 + 3x81 + 2x80
= 384 + 24 + 2
6328 = 41010

Example 3: Convert F4C16 to decimal.


F4C16 = Fx162 + 4x161 + Cx160
= 15x162 + 4x161 + 12x160
= 3840 + 64 + 12
F4C16 = 391610

Example 4: Convert 1011.1012 to decimal.


10001002 = 1x23 + 0x22 + 1x21 + 1x20 + 1x2-1 + 0x2-2 + 1x2-3
= 8 + 0 + 2 + 1 + 0.5 + 0 + 0.125
10001002 = 11.62510

22
Chapter 1 NUMBER SYSTEM

Decimal to Binary, Octal, Hexadecimal Conversion


Conversion of decimal numbers to base r numbers is done by dividing the number
and all the successive quotients by r and then accumulating the remainder. See the
following examples for this procedure.
Example 5: Convert 6810 to binary.
68/2 = 34 remainder 0
34/2 = 17 remainder 0
17/2 = 8 remainder 1
8/2 = 4 remainder 0
4/2 = 2 remainder 0
2/2 = 1 remainder 0
1/2 = 0 remainder 1
6810 = 10001002

Example 6: Convert 17710 to octal.


177/8 = 22 remainder 1
22/8 = 2 remainder 6
2/8 = 0 remainder 2
17710 = 2618

Example 7: Convert 476810 to hexadecimal.


4768/16 = 298 remainder 0
298/16 = 18 remainder 10 (A)
18/16 = 1 remainder 2
1/16 = 0 remainder 1
476810 = 12A016

If the decimal has a radix point and contains a fractional or decimal part, we use
successive multiplication by r of the decimal part and carried out the integer part and
placed it after the radix point.

23
Chapter 1 NUMBER SYSTEM

Example 8: Convert 0.6810 to binary.


0.68 x 2 = 1.36, integer part is 1
0.36 x 2 = 0.72, integer part is 0
0.72 x 2 = 1.44, integer part is 1
0.44 x 2 = 0.88, integer part is 0
0.6810 = 0.1010…2

Binary to Octal and Hexadecimal Conversion


Conversion of binary numbers to octal or hexadecimal requires grouping of the bits
of the binary. For binary to octal conversion, group the binary numbers into 3 bits. For
binary to hex, group the binary numbers into 4 bits. Then get the weighted sum of the
grouped bits. Remember that the grouping starts with the least significant bit (LSB) to the
most significant bit (MSB). If the number of bits is not a multiple of 3, for octal, or 4, for
hexadecimal, prefix the number with 0’s.

Example 9: Convert 111001112 to octal.


111001112 = 0112|1002|1112
= 3|4|7
111001112 = 3478

Example 10: Convert 110001010100001112 to hexadecimal.


110001010100001112 = 00012|10002|10102|10002|01112
= 1|8|A|8|7
110001010100001112 = 18A8716

Octal and Hexadecimal to Binary Conversion


The process of converting octal and hexadecimal to binary is just the reverse of
converting the binary to octal and hexadecimal. For octal to binary, convert each octal digit
into a group of 3 binary digits. For hex to binary, convert each hex digit into a group of 4
binary digits.

24
Chapter 1 NUMBER SYSTEM

Example 11: Convert 6738 to binary.


673.1248 = 68|78|38
= 110|111|011
673.1248 = 1101110112
Example 12: Convert 374F16 to binary.
374F16 = 316|716|416|F16
= 0011|0111|0100|1111
374F16 = 00110111010011112

ODES
Code is a set of symbols with specific meaning used for representing
something. The most common and frequently used codes in digital
electronics are the Binary Codes, Alphanumeric Codes, and Parity Codes.

BINARY CODES
The baseline of all programming language. It is considered as the back end of all
computer functioning. Objects are represented using the binary number system, which has
only two values, either 1 or 0.

DECIMAL BINARY
Base - 10 Base - 2
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001

25
Chapter 1 NUMBER SYSTEM

10 1010
11 1011
12 1100
13 1101
14 1110
15 1111

Other 4 – Bit Code

DECIMAL 5421 2*421 7421 74(21)’


0 0000 0000 0000 0000
1 0001 0001 0001 0111
2 0010 0010 0010 0110
3 0011 0011 0011 0101
4 0100 0100 0100 0100
5 1000 1011 0101 1010
6 1001 1100 0110 1001
7 1010 1101 1000 1000
8 1011 1110 1001 1111
9 1100 1111 1010 1110

EXCESS – THREE CODE (+3 for BCD)

DECIMAL EXCESS – 3 CODE


0 0011
1 0100
2 0101
3 0110
4 0111
5 1000
6 1001
7 1010
8 1011
9 1100

26
Chapter 1 NUMBER SYSTEM

5 – BIT CODE

DECIMAL 2 – OUT – OF – 5 SHIFT COUNTER 51111


0 00011 00000 00000
1 00101 10000 00001
2 00110 11000 00011
3 01001 11100 00111
4 01010 11110 01111
5 01100 11111 10000
6 10001 01111 11000
7 10010 00111 11100
8 10100 00011 11110
9 11000 00001 11111

MORE THAN 5 – BIT CODE

DECIMAL BIQUINARY RING COUNTER


50 43210 9876543210
0 01 00001 0000000001
1 01 00010 0000000010
2 01 00100 0000000100
3 01 01000 0000001000
4 01 10000 0000010000
5 10 00001 0000100000
6 10 00010 0001000000
7 10 00100 0010000000
8 10 01000 0100000000
9 10 10000 1000000000

ALPHANUMERIC CODES
A code where both numbers and letters are utilized to represent the decimal digits 0
– 9. There are several types of alphanumeric code, two of them are:

A. ASCII

27
Chapter 1 NUMBER SYSTEM

Stands for “American Standard Code for Information Interchange”. It is a seven – bit
code, thus allowing a total of 128 different combinations. An additional bit is usually
added and it is always set to 0 or 1 or used as a parity bit
CHAR BINARY OCTAL DECIMAL HEXADECIMAL DESCRIPTION
00100000 040 32 20 space
! 00100001 041 33 21 exclamation mark
" 00100010 042 34 22 double quotes
# 00100011 043 35 23 number sign
$ 00100100 044 36 24 dollar sign
% 00100101 045 37 25 percent sign
& 00100110 046 38 26 ampersand
' 00100111 047 39 27 single quote
( 00101000 050 40 28 opening parenthesis
) 00101001 051 41 29 closing parenthesis
* 00101010 052 42 2A asterisk
+ 00101011 053 43 2B plus sign
, 00101100 054 44 2C comma
- 00101101 055 45 2D minus sign, hyphen
. 00101110 056 46 2E period, dot
/ 00101111 057 47 2F division sign, slash
0 00110000 060 48 30 zero
1 00110001 061 49 31 one
2 00110010 062 50 32 two
3 00110011 063 51 33 three
4 00110100 064 52 34 four
5 00110101 065 53 35 five
6 00110110 066 54 36 six
7 00110111 067 55 37 seven
8 00111000 070 56 38 eight
9 00111001 071 57 39 nine
: 00111010 072 58 3A colon
; 00111011 073 59 3B semicolon
< 00111100 074 60 3C less than sign
= 00111101 075 61 3D equal sign
> 00111110 076 62 3E greater than sign
? 00111111 077 63 3F question mark
@ 01000000 100 64 40 at symbol
A 01000001 101 65 41 capital letter a
B 01000010 102 66 42 capital letter b
C 01000011 103 67 43 capital letter c
D 01000100 104 68 44 capital letter d

28
Chapter 1 NUMBER SYSTEM

E 01000101 105 69 45 capital letter e


F 01000110 106 70 46 capital letter f
G 01000111 107 71 47 capital letter g
H 01001000 110 72 48 capital letter h
I 01001001 111 73 49 capital letter i
J 01001010 112 74 4A capital letter j
K 01001011 113 75 4B capital letter k
L 01001100 114 76 4C capital letter l
M 01001101 115 77 4D capital letter m
N 01001110 116 78 4E capital letter n
O 01001111 117 79 4F capital letter o
P 01010000 120 80 50 capital letter p
Q 01010001 121 81 51 capital letter q
R 01010010 122 82 52 capital letter r
S 01010011 123 83 53 capital letter s
T 01010100 124 84 54 capital letter t
U 01010101 125 85 55 capital letter u
V 01010110 126 86 56 capital letter v
W 01010111 127 87 57 capital letter w
X 01011000 130 88 58 capital letter x
Y 01011001 131 89 59 capital letter y
Z 01011010 132 90 5A capital letter z
[ 01011011 133 91 5B opening bracket
\ 01011100 134 92 5C backslash
] 01011101 135 93 5D closing bracket
^ 01011110 136 94 5E caret - circumflex
_ 01011111 137 95 5F underscore
` 01100000 140 96 60 grave accent
a 01100001 141 97 61 small letter a
b 01100010 142 98 62 small letter b
c 01100011 143 99 63 small letter c
d 01100100 144 100 64 small letter d
e 01100101 145 101 65 small letter e
f 01100110 146 102 66 small letter f
g 01100111 147 103 67 small letter g
h 01101000 150 104 68 small letter h
i 01101001 151 105 69 small letter i
j 01101010 152 106 6A small letter j
k 01101011 153 107 6B small letter k
l 01101100 154 108 6C small letter l
m 01101101 155 109 6D small letter m
n 01101110 156 110 6E small letter n

29
Chapter 1 NUMBER SYSTEM

o 01101111 157 111 6F small letter o


p 01110000 160 112 70 small letter p
q 01110001 161 113 71 small letter q
r 01110010 162 114 72 small letter r
s 01110011 163 115 73 small letter s
t 01110100 164 116 74 small letter t
u 01110101 165 117 75 small letter u
v 01110110 166 118 76 small letter v
w 01110111 167 119 77 small letter w
x 01111000 170 120 78 small letter x
y 01111001 171 121 79 small letter y
z 01111010 172 122 7A small letter z
{ 01111011 173 123 7B opening brace
| 01111100 174 124 7C vertical bar
} 01111101 175 125 7D closing brace
~ 01111110 176 126 7E equivalency sign, tilde
[DEL] 01111111 177 127 7F delete

B. EBCDIC
Stands for “Extended Binary Coded Decimal Interchange Code”. It is a type of
alphanumeric code similar to ASCII but less popular. An 8 – bit code without a parity
and uses binary coded decimal as the basis of binary assignment. A ninth bit may or
may not be added for parity.

Dec Hex Char Dec Hex Char Dec Hex Char Dec Hex Char
0 00 NUL 64 40 space 128 80 192 C0 {
1 01 SOH 65 41 129 81 a 193 C1 A
2 02 STX 66 42 130 82 b 194 C2 B
3 03 ETX 67 43 131 83 c 195 C3 C
4 04 68 44 132 84 d 196 C4 D
5 05 HT 69 45 133 85 e 197 C5 E
6 06 70 46 134 86 f 198 C6 F
7 07 DEL 71 47 135 87 g 199 C7 G
8 08 72 48 136 88 h 200 C8 H
9 09 73 49 137 89 i 201 C9 I
10 0A 74 4A [ 138 8A 202 CA
11 0B VT 75 4B . 139 8B 203 CB
12 0C FF 76 4C < 140 8C 204 CC
13 0D CR 77 4D ( 141 8D 205 CD
14 0E SO 78 4E + 142 8E 206 CE

30
Chapter 1 NUMBER SYSTEM

15 0F SI 79 4F |! 143 8F 207 CF
16 10 DLE 80 50 & 144 90 208 D0 }
17 11 81 51 145 91 j 209 D1 J
18 12 82 52 146 92 k 210 D2 K
19 13 83 53 147 93 l 211 D3 L
20 14 84 54 148 94 m 212 D4 M
21 15 85 55 149 95 n 213 D5 N
22 16 BS 86 56 150 96 o 214 D6 O
23 17 87 57 151 97 p 215 D7 P
24 18 CAN 88 58 152 98 q 216 D8 Q
25 19 EM 89 59 153 99 r 217 D9 R
26 1A 90 5A !] 154 9A 218 DA
27 1B 91 5B $ 155 9B 219 DB
28 1C IFS 92 5C * 156 9C 220 DC
29 1D IGS 93 5D ) 157 9D 221 DD
30 1E IRS 94 5E ; 158 9E 222 DE
31 1F IUS 95 5F ^ 159 9F 223 DF
32 20 96 60 - 160 A0 224 E0 \
33 21 97 61 / 161 A1 ~ 225 E1
34 22 98 62 162 A2 s 226 E2 S
35 23 99 63 163 A3 t 227 E3 T
36 24 100 64 164 A4 u 228 E4 U
37 25 LF 101 65 165 A5 v 229 E5 V
38 26 ETB 102 66 166 A6 w 230 E6 W
39 27 ESC 103 67 167 A7 x 231 E7 X
40 28 104 68 168 A8 y 232 E8 Y
41 29 105 69 169 A9 z 233 E9 Z
42 2A 106 6A | 170 AA 234 EA
43 2B 107 6B , 171 AB 235 EB
44 2C 108 6C % 172 AC 236 EC
45 2D ENQ 109 6D _ 173 AD 237 ED
46 2E ACK 110 6E > 174 AE 238 EE
47 2F BEL 111 6F ? 175 AF 239 EF
48 30 112 70 176 B0 240 F0 0
49 31 113 71 177 B1 241 F1 1
50 32 SYN 114 72 178 B2 242 F2 2
51 33 115 73 179 B3 243 F3 3
52 34 116 74 180 B4 244 F4 4
53 35 117 75 181 B5 245 F5 5
54 36 118 76 182 B6 246 F6 6
55 37 EOT 119 77 183 B7 247 F7 7

31
Chapter 1 NUMBER SYSTEM

56 38 120 78 184 B8 248 F8 8


57 39 121 79 ‘ 185 B9 249 F9 9
58 3A 122 7A : 186 BA 250 FA
59 3B 123 7B # 187 BB 251 FB
60 3C 124 7C @ 188 BC 252 FC
61 3D NAK 125 7D ‘ 189 BD 253 FD
62 3E 126 7E = 190 BE 254 FE
63 3F SUB 127 7F " 191 BF 255 FF

PARITY CODE

A bit added to transmitted binary signal either byte or word to detect errors in the
transmission. The two types of parity code are even parity and odd parity. In even parity,
the total number of 1’s will become even in number while in odd parity, the total number of
1’s will become odd in number.

DECIMAL BCD CODE EVEN PARITY ODD PARITY


0 0000 0000 0 0000 1
1 0001 0001 1 0001 0
2 0010 0010 1 0010 0
3 0011 0011 0 0011 1
4 0100 0100 1 0100 0
5 0101 0101 0 0101 1
6 0110 0110 0 0110 1
7 0111 0111 1 0111 0
8 1000 1000 1 1000 0
9 1001 1001 0 1001 1

32

You might also like