FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithmetic

gavasarti 1,500 views 62 slides Aug 21, 2020
Slide 1
Slide 1 of 62
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62

About This Presentation

Number System:
Analog System, digital system, numbering system, binary number
system, octal number system, hexadecimal number system, conversion
from one number system to another, floating point numbers, weighted
codes binary coded decimal, non-weighted codes Excess – 3 code, Gray
code, Alphanumer...


Slide Content

NUMBER
SYSTEM
&
BINARY
ARITHMETIC
UNIT I
DIGITAL
ELECTRONICS
PROF. ARTI GAVAS-PARAB
ANNA LEELA COLLEGE OF COMMERCE AND ECONOMICS, SHOBHA
JAYARAM SHETTY COLLEGE FOR BMS
CHAPTER 1

UNIT I: CONTENTS
Number System:
Analog System, digital system,
Numbering system, binary number system, octal number system, hexadecimal number system, conversion from one number
system to another, floating point numbers,
Weighted codes binary coded decimal, non-weighted codes Excess –3 code, Gray code,
Alphanumeric codes –ASCII Code, EBCDIC, ISCII Code, Hollerith Code, Morse Code, Teletypewriter (TTY), Error
detection and correction, Universal Product Code,
Code conversion.
Binary Arithmetic:
Binary addition, Binary subtraction,
Negative number representation,
Subtraction using 1’s complement and 2’s complement, Binary multiplication and division, Arithmetic in octal number system,
Arithmetic in hexadecimal number system,
BCD and Excess –3 arithmetic.
C
H
A
P
T
E
R
I
C
H
A
P
T
E
R
II

ANALOG AND DIGITAL SYSTEMS
Analog and digital signals are used to transmit information (such as any audio or video), usually through electric
signals. In digital technology, translation of information is into binary format (either 0 or 1) and information is
translated into electric pulses of varying amplitude in analog technology.
Analogue signal Analogue meter display
Digital (logic) signal
Digital meter display

NUMBER SYSTEMS
A computer can understand the positional
number system where there are only a few
symbols called digits and these symbols
represent different values depending on the
position they occupy in the number.
The value of each digit in a number can be
determined using :
The digit
The position of the digit in the number
The base of the number system (where the base is
defined as the total number of digits available in
the number system)

NUMBER SYSTEMS: DECIMAL
The number system that we use in our day-to-
day life is the decimal number system.
Decimal number system has base 10 as it uses
10 digits from 0 to 9.
In decimal number system, the successive
positions to the left of the decimal point
represent units, tens, hundreds, thousands, and
so on.
Each position represents a specific power of the
base (10).
For example,
The decimal number 1234 consists of the digit
4 in the units position,
3 in the tens position,
2 in the hundreds position, and
1 in the thousands position.
Its value can be written as
(1 x 1000)+ (2 x 100)+ (3 x 10)+ (4 x l)
(1 x 10
3
)+ (2 x 10
2
)+ (3 x 10
1
)+ (4 x l0
0
)
1000 + 200 + 30 + 4
1234

NUMBER SYSTEMS: BINARY
Characteristics of the binary number system are
as follows :
Uses two digits, 0 and 1
Also called as base 2 number system
Each position in a binary number represents
a 0power of the base (2).
Example 2
0
Last position in a binary number represents a
xpower of the base (2).
Example 2
x
where xrepresents the last
position -1.
For example,
Binary Number: 10101
2
Calculating Decimal Equivalent :
Step Binary
Number
Decimal Number
Step 110101
2 ((1 x 2
4
) + (0 x 2
3
) + (1 x 2
2
) + (0 x
2
1
) + (1 x 2
0
))
10
Step 210101
2 (16 + 0 + 4 + 0 + 1)
10
Step 310101
2 21
10
Note−10101
2is normally written as 10101.

NUMBER SYSTEMS: OCTAL
Characteristics of the octal number system are
as follows :
Uses eight digits, 0,1,2,3,4,5,6,7
Also called as base 8 number system
Each position in an octal number represents a
0power of the base (8).
Example 8
0
Last position in an octal number represents a
xpower of the base (8).
Example 8
x
where xrepresents the last
position -1
For example,
Octal Number: 12570
8
Calculating Decimal Equivalent:
Step Binary
Number
Decimal Number
Step 112570
8
((1 x 8
4
) + (2 x 8
3
) + (5 x 8
2
) + (7 x
8
1
) + (0 x 8
0
))
10
Step 212570
8
(4096 + 1024 + 320 + 56 + 0)
10
Step 312570
8
5496
10
Note−12570
8is normally written as 12570.

NUMBER SYSTEMS: HEXADECIMAL
Characteristics of hexadecimal number system
are as follows:
Uses 10 digits and 6 letters, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
A, B, C, D, E, F
Letters represent the numbers starting from 10. A
= 10. B = 11, C = 12, D = 13, E = 14, F = 15
Also called as base 16 number system
Each position in a hexadecimal number represents
a 0power of the base (16). Example, 16
0
Last position in a hexadecimal number represents
a xpower of the base (16).
Example 16
x
where xrepresents the last position
-1
For example,
Hexadecimal Number: 19FDE
16
Calculating Decimal Equivalent:
Step Binary
Number
Decimal Number
Step 119FDE
16
((1 x 16
4
) + (9 x 16
3
) + (F x 16
2
) +
(D x 16
1
) + (E x 16
0
))
10
Step 219FDE
16
((1 x 16
4
) + (9 x 16
3
) + (15 x 16
2
) +
(13 x 16
1
) + (14 x 16
0
))
10
Step 319FDE
16
(65536+ 36864 + 3840 + 208 +
14)
10
Step 419FDE
16
106462
10
Note−19FDE
16is normally written as 19FDE.

CONVERSION FROM ONE NUMBER SYSTEM TO ANOTHER
Decimal to Binary System
Decimal to Octal System
Decimal to Hexadecimal System
Binary to Decimal System
Octal to Decimal System
Hexadecimal to Decimal System
Binary to Octal System
Octal to Binary System
Binary to Hexadecimal System
Hexadecimal to Binary System
Octal to Hexadecimal System
Hexadecimal to Octal System

DECIMAL TO OTHER BASE SYSTEM
Step 1−Divide the decimal number to be converted by the value of the new base.
Step 2−Get the remainder from Step 1 as the rightmost digit (least significant digit) of the new base
number.
Step 3−Divide the quotient of the previous divide by the new base.
Step 4−Record the remainder from Step 3 as the next digit (to the left) of the new base number.
Repeat Steps 3 and 4, getting remainders from right to left, until the quotient becomes zero in Step 3.
The last remainder thus obtained will be the Most Significant Digit (MSD) of the new base number.

CONVERSION FROM DECIMAL TO BINARY SYSTEM
Example: Decimal Number: 29
10
Calculating Binary Equivalent :
Step Operation Result Remainder
Step 1 29 / 2 14 1
Step 2 14 / 2 7 0
Step 3 7 / 2 3 1
Step 4 3 / 2 1 1
Step 5 1 / 2 0 1
Step 1 29 / 2 14 1
As mentioned in Steps 2 and 4, the remainders have to be arranged in the reverse order so that the first remainder
becomes the Least Significant Digit (LSD) and the last remainder becomes the Most Significant Digit (MSD).
Decimal Number : 29
10= Binary Number : 11101
2.

DECIMAL TO BINARY TABLE: 4-BIT BINARY REPRESENTATION
When a number is stored in an electronic system, it is
stored in a memory location having a fixed number of
binary bits.
Some of these memory locations are used for general
storage whilst others, having some special function, are
called registers.
Wherever a number is stored, it will be held in some form
of binary, and must always have a set number of bits.

CONVERSION OF DECIMAL TO BINARY EXAMPLES
Conversion of Decimal to Binary method can easily be
understood by considering an example which is
explained below.
For example –Consider the conversion of the decimal
number 25 into its equivalent binary.
Divide by 2ResultRemainderBinary Value
294 ÷2 147 0 0 (LSB)
147 ÷2 73 1 1
73 ÷2 36 1 1
36 ÷2 18 0 0
18 ÷2 9 0 0
9 ÷2 4 1 1
4 ÷2 2 0 0
2 ÷2 1 0 0
1 ÷2 0 1 1 (MSB)
Convert the decimal number 294 into a binary number.
Therefore, the binary equivalent for the given decimal number 294
10is 100100110
2

CONVERSION OF DECIMAL TO BINARY FOR FRACTION NUMBER
For fractional decimal numbers, multiply it by 2 and record the carry in the integral position. The carries when read
down produces the equivalent binary fraction as explained by the example given.
Thus the fractional binary number is .01011, i.e., 0.01011.
The process of multiplication by 2 will continue till the
desired accuracy is achieved.
Here is another example of such conversion using the
fraction 0.375.
Now, let’s just write out the resulting integer part at each
step —0.011.
So, 0.375in decimal system is represented as 0.011in
binary.
Consider the fractional binary number 0.35

CONVERSION OF BINARY FRACTION TO DECIMAL NUMBER
Divide each digit from right side of radix point till the end by 2
1
, 2
2
, 2
3
, … respectively.
Add all the result coming from step 1.
Equivalent fractional decimal number would be the result obtained in step 2.
Step 2: Conversion of .101 to decimal
0.101
2= (1*1/2) + (0*1/2
2
) + (1*1/2
3
)
0.101
2= 1*0.5 + 0*0.25 + 1*0.125
0.101
2= 0.625
So equivalent decimal of binary fractional is 0.625
Number
Base
as Power
10
2
10
1
10
0
.10
-1
10
-2
10
-3
Equivalent10010 1.1/101/1001/1000
Decimal Fractions
Binary Fractions
Number Base
as Power
2
4
2
3
2
2
2
1
2
0
.2
-1
2
-2
2
-3
Equivalent168421.1/21/41/8

CONVERSION FROM DECIMAL TO OCTAL SYSTEM
Write the given decimal number
If the given decimal number is less than 8 the
octal number is the same.
If the decimal number is greater than 7 then
divide the number by 8.
Note the remainder we get after division
Repeat step 3 and 4 with the quotient till it is
less than 8
Now, write the remainders in reverse
order(bottom to top)
The resultant is the equivalent octal number to
the given decimal number.
For example:Convert 1792 into octal number.
Decimal
Number
Operation
Quotient Remainder
Octal
Number
1792 ÷8 224 0 0
224 ÷8 28 0 00
28 ÷8 3 4 400
3 ÷8 0 3 3400
Decimal to Octal Examples
Example 1: Convert (127)
10to Octal.
Example 2: Convert 52
10to octal.
Example 3: Convert 100
10to octal.

CONVERSION FROM DECIMAL TO OCTAL SYSTEM
Example 1: Convert (127)
10to Octal.
Solution:Divide 127 by 8
127 ÷8= 15(Quotient) and
(7)Remainder
Divide 15 by 8 again.
15 ÷8 = 1(Quotient) and (7) Remainder
Divide 1 by 8, we get;
1 ÷8 = 0(Quotient) and (1) Remainder
Since the quotient is zero now, no more
division can be done. So by taking the
remainders in reverse order, we get the
equivalent octal number.
Hence, (127)
10= (177)
8
Example 2: Convert 5210
to octal.
Solution: Divide 52 by 8
52 ÷8 = 6(Quotient) and
(4)Remainder
Divide 6 by 8 again.
6 ÷8 = 0(Quotient) and (6)
Remainder
Since the quotient is zero now,
no more division can be done.
So by taking the remainders in
reverse order, we get the
equivalent octal number.
Hence, (52)10 = (64)8
Example 3: Convert 10010 to
octal.
Solution: Divide 100 by 8
100 ÷8= 12(Quotient) and
(4)Remainder
Divide 12 by 8 again.
12 ÷8 = 1(Quotient) and (4)
Remainder
Divide 1 by 8, we get;
1 ÷8 = 0(Quotient) and (1)
Remainder
Since the quotient is zero now, no
more division can be done. So by
taking the remainders in reverse
order, we get the equivalent octal
number.
Hence, (100)10 = (144)8

CONVERSION FROM DECIMAL FRACTION TO OCTAL SYSTEM
Take decimal number as multiplicand.
Multiple this number by 8 (8 is base of octal so multiplier here).
Store the value of integer part of result in an array (it will be: 0, 1, 2, 3, 4, 5, 6, and 7 because of multiplier 8).
Repeat the above two steps until the number became zero
Example−Convert decimal fractional number 0.140869140625 into octal number.
Multiplication Resultant integer part
0.140869140625 x 8=0.12695313 1
0.12695313 x 8=0.01562504 1
0.01562504 x 8=0.12500032 0
0.12500032 x 8=0.00000256 1
0.00000256 x 8=0.000020544 0
and so on ....
Now, write these resultant integer
part, this will be approximate 0.11010
which is equivalent octal fractional
number of decimal fractional
0.140869140625.

CONVERSION FROM DECIMAL TO HEXADECIMAL SYSTEM
Take decimal number as dividend.
Divide this number by 16 (16 is base of
hexadecimal so divisor here).
Store the remainder in an array (it will be: 0
to 15 because of divisor 16, replace 10, 11,
12, 13, 14, 15 by A, B, C, D, E, F respectively).
Repeat the above two steps until the
number is greater than zero.
Print the array in reverse order (which will
be equivalent hexadecimal number of given
decimal number).
Example−Convert decimal number 540 into hexadecimal
number.
Division Remainder (R)
540 / 16 = 33 12 = C
33 / 16 = 2 1
2 / 16 = 0 2
0 / 16 = 0 0

CONVERSION FROM DECIMAL FRACTION TO HEXADECIMAL
Take decimal number as multiplicand.
Multiple this number by 16 (16 is base of
hexadecimal so multiplier here).
Store the value of integer part of result in an
array (it will be: 0 to 15, because of
multiplier 16, replace 10, 11, 12, 13, 14, 15 by
A, B, C, D, E, F respectively).
Repeat the above two steps until the
number became zero.
Print the array (which will be equivalent
fractional hexadecimal number of given
decimal fractional number).
Example−Convert decimal fractional number 0.06640625
into hexadecimal number.
Multiplication Resultant integer part
0.06640625 x 16=1.0625 1
0.0625 x 16 =1.0 1
0 x 16=0.0 0

CONVERSION FROM BINARY TO DECIMAL SYSTEM
Converting from binary to decimal involves multiplying
the value of each digit (i.e. 1 or 0) by the value of the
placeholder in the number
Write down the number.
Starting with the LSB, multiply the digit by the value
of the place holder.
Continue doing this until you reach the MSB.
Add the results together.
Placeholder Value in the Decimal Numbering System
Placeholder Value in the Binary Numbering System
Most Significant Bit (MSB) and Least Significant Bit (LSB)

STEPS TO CONVERT BINARY TO DECIMAL
For example,
Binary Number: 10101
2
Calculating Decimal Equivalent :
Step Binary
Number
Decimal Number
Step 110101
2 ((1 x 2
4
) + (0 x 2
3
) + (1 x 2
2
) + (0 x
2
1
) + (1 x 2
0
))
10
Step 210101
2 (16 + 0 + 4 + 0 + 1)
10
Step 310101
2 21
10

CONVERSION FROM OCTAL TO DECIMAL SYSTEM
Converting octal to decimal can be done as
following:
Write the powers of 8 (1, 8, 64, 512, 4096, and
so on) beside the octal digits from bottom to
top.
Multiply each digit by it's power.
Add up the answers. This is the solution.
For example if the given octal number is 50173:
Digit Power Multiplication
5 4096 20480
0 512 0
1 64 64
7 8 56
3 1 3
Then the decimal solution (20480 + 64 + 56 + 3) is: 20603
The octal numeral system, or octfor short, is the base-8 number system, and uses the digits 0 to 7.
It has the advantage of not requiring any extra symbols as digits.
It is also used for digital displays.

CONVERSION FROM HEXADECIMAL TO DECIMAL SYSTEM
Follow these steps to convert a hexadecimal number into
decimal form:
Write the powers of 16 (1, 16, 256, 4096, 65536, and
so on) beside the hex digits from bottom to top.
Convert any letters (A to F) to their corresponding
numerical form.
Multiply each digit by it's power.
Add up the answers. This is the solution.
For example if the given hexadecimal
number is 6FC7:
Digit Power Multiplication
6 4096 24576
F (15) 256 3840
C (12) 16 192
7 1 7
Then the decimal solution (24576 + 3840 +
192 + 7) is: 28615
Hexadecimal is a positional system that represents numbers using a base of 16.
Unlike the common way of representing numbers with ten symbols, it uses sixteen distinct symbols, most often the
symbols "0"-"9" to represent values zero to nine, and "A"-"F" to represent values ten to fifteen.
Hexadecimal numerals are widely used by computer system designers and programmers, as they provide a human-
friendly representation of binary-coded values.

CONVERSION FROM BINARY TO OCTAL SYSTEM
Follow these steps to convert a binary
number into octal form:
Start from the right side of the
binary number and divide it up into
groups of 3 digits. Add extra zeros
to the front of the first number if it
is not three digits.
Convert each group of 3 binary
digits to its equivalent octal value
from the conversion table below.
Concatenate the results together.
This is the solution.
Conversion table:
BinaryOctal
000 0
001 1
010 2
011 3
100 4
101 5
110 6
111 7
For example if the given binary number is
10110111010001:
Binary(0)10110111010001
Octal2 6 7 2 1
Then the octal solution is: 26721

CONVERSION FROM OCTAL TO BINARY SYSTEM
Follow these steps to convert a
octal number into binary form:
Write down the octal number
and represent each digit by its
binary equivalent from the
conversion table below.
Concatenate the results
together. Discard any leading
zeros at the left of the binary
number. This is the solution.
Conversion table:
OctalBinary
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
For example if the given octal number is 21073:
Octal2 1 0 7 3
Binary010001000111011
Then the binary solution is: (0)10001000111011

CONVERSION FROM BINARY TO HEXADECIMAL SYSTEM
Follow these steps to convert a
binary number into hexadecimal
form:
Start from the right side of the binary
number and divide it up into groups of
4 digits. Add extra zeros to the front
of the first number if it is not four
digits.
Convert each group of 4 binary digits
to its equivalent hex value from the
conversion table below.
Concatenate the results together. This
is the solution.
Conversion table:
Binary Hexadecimal
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 A
1011 B
1100 C
1101 D
1110 E
1111 F
For example if the given binary
number is 11011010100111:
Binary(00)11011010100111
Hexad
ecimal
3 6 A 7
Then the hexadecimal solution is:
36A7

CONVERSION FROM HEXADECIMAL TO BINARY SYSTEM
Follow these steps to convert a
hexadecimal number into binary
form:
Write down the hex number
and represent each digit by its
binary equivalent from the
conversion table below.
Concatenate the results
together. Discard any leading
zeros at the left of the binary
number. This is the solution.
Conversion table:
Hexadecimal Binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111
For example if the given hexadecimal
number is 3CF8:
Hexadecimal3 C F 8
Binary 0011110011111000
Then the binary solution is:
(00)11110011111000

CONVERSION FROM OCTAL TO HEXADECIMAL SYSTEM
While converting from octal to
hexadecimal unit, it is a usual practice
to convert the octal to hexadecimal by
converting the octal number into
binary digit and then further to from
binary to hexadecimal.
For example to convert the number 536 from
octal to hexadecimal.
Convert 536(octal) into its binary equivalent we get
(536)
8= (101) (011) (110)
=(101011110)
2
Now forming the group of 4 binary bits to obtain its hexadecimal
equivalent,
(101011110)
2= (0001) (0101) (1110)
= (15E)
16
So the hexadecimal number of 536 is 15E.

CONVERSION FROM HEXADECIMAL TO OCTAL SYSTEM
Method to Convert Hex to Octal
For each given hexadecimal number digit,
write the equivalent binary number. If any
of the binary equivalents are less than 4
digits, add 0’s to the left side.
Combine and make the groups of binary
digits from right to left, each containing 3
digits. Add 0’s to the left if there are less
than 3 digits in the last group.
Find the octal equivalent of each binary
group.
Example: Convert 1BC
16into an octal number.
Solution:
Given, 1BC
16is a hexadecimal number.
1→0001, B→1011, C→1100
Now group them from right to left, each having 3 digits.
000, 110, 111, 100
000→0, 110→6, 111→7, 100→4
Hence,1BC
16= 674
8

EXERCISES (NUMBER SYSTEMS CONVERSION)
1.Convert the following decimalnumbers into binaryand hexadecimal
numbers:
1.108
2.4848
3.9000
2.Convert the following binary numbers into hexadecimal and decimal
numbers:
1.1000011000
2.10000000
3.101010101010
3.Convert the following hexadecimal numbers into binary and decimal
numbers:
1.ABCDE
2.1234
3.80F
4.Convert the following decimal numbers into binary equivalent:
1.19.25D
2.123.456D
1.1101100B, 1001011110000B, 10001100101000B, 6CH,
12F0H, 2328H.
2.218H, 80H, AAAH, 536D, 128D, 2730D.
3.10101011110011011110B, 1001000110100B,
100000001111B, 703710D, 4660D, 2063D.
4.?? (You work it out!)

FLOATING POINT NUMBERS
As the name implies, floating point
numbers are numbers that contain floating
decimal points.
For example, the numbers 5.5, 0.001, and -
2,345.6789 are floating point numbers.
Numbers that do not have decimal places
are called integers.
Older computers used to have a separate
floating point unit (FPU) that handled
these calculations, but now the FPU is
typically built into the computer's CPU.
A floating-point number (or real number) can
represent a very large (1.23×10^88) or a very small
(1.23×10^-88) value.
It could also represent
very large negative number (-1.23×10^88) and
very small negative number (-1.23×10^88),
as well as zero, as illustrated as follows:

FLOATING POINT NUMBERS
According to the IEEE standard, 32-bit floating
point numbers are represented as shown:
In 32-bit single-precision floating-point
representation:
The most significant bit is the sign bit(S), with
0 for positive numbers and 1 for negative
numbers.
The following 8 bits represent exponent(E).
The remaining 23 bits represents fraction(F)/
Mantissa (M).
Representation of floating point number is not
unique. For example,
The number 55.66can be represented as 5.566×10^1,
0.5566×10^2, 0.05566×10^3, and so on.
The most significant bit indicates sign of the number, where
0 indicates positive and 1 indicates negative.
The 8-bit exponent shows the power of the number.
The mantissa is 23 bits wide.
Mantissa(M) /

WEIGHTED & NON-WEIGHTED CODES
Weighted Codes: The weighted codes are those that
obey the position weighting principle, which states that the
position of each number represent a specific weight. In
these codes each decimal digit is represented by a group of
four bits.
In weighted codes, each digit is assigned a specific weight
according to its position. For example, in 8421/BCD code,
1001 the weights of 1, 1, 0, 1 (from left to right) are 8, 4, 2
and 1 respectively.
Non-weighted codes: The non-weighted codes are not
positionallyweighted . In other words codes that are not
assigned with any weight to each digit position.

WEIGHTED CODE: BINARY CODED DECIMALS (BCD)
The BCD (Binary Coded Decimal) is a straight
assignment of the binary equivalent. It is possible to
assign weights to the binary bits according to their
positions. The weights in the BCD code are 8,4,2,1.
Example:Thebitassignment1001,canbeseenby
itsweightstorepresentthedecimal9because:
1x8+0x4+0x2+1x1=9

BINARY CODED DECIMALS (BCD)
Conversion from Decimal to BCD Conversion from BCD to Decimal

NON-WEIGHTED CODE: EXCESS –3 CODE
Excess-3 is a non weighted code used to express decimal numbers. The code derives its name from
the fact that each binary code is the corresponding 8421 code plus 0011(3).
An Excess-3 equivalent of a given binary binarynumber is obtained using the following steps:
Find the decimal equivalent of the given binary number.
Add +3 to each digit of decimal number.
Convert the newly obtained decimal number back to binary number to get required excess-3 equivalent.
You can add 0011 to each four-bit group in binary coded decimal number (BCD) to get desired
excess-3 equivalent.
Example:1000of8421=1011inExcess-3

NON-WEIGHTED CODE: EXCESS –3 CODE
These are following excess-3 codes for decimal digits:
Decimal Digit BCD Code Excess-3 Code
0 0000 0011
1 0001 0100
2 0010 0101
3 0011 0110
4 0100 0111
5 0101 1000
6 0110 1001
7 0111 1010
8 1000 1011
9 1001 1100

NON-WEIGHTED CODE: EXCESS –3 CODE
Example-1:Convert decimal number 23 to
Excess-3 code.
So, according to excess-3 code we need to add 3
to both digit in the decimal number then
convert into 4-bit binary number for result of
each digit. Therefore,
= 23+33=56 =0101 0110 which is required
excess-3 code for given decimal number 23.
Example-2:Convert decimal number 15.46 into
Excess-3 code.
According to excess-3 code we need to add 3 to
both digit in the decimal number then convert into
4-bit binary number for result of each digit.
Therefore,
= 15.46+33.33=48.79 =0100 1000.0111 1001 which
is required excess-3 code for given decimal number
15.46.

XS-3 CONVERTING INTO BINARY CODED DECIMAL (BCD) CODES
One should note that to given Excess-3 code, the equivalent decimal number can be determined by splitting
number into 4-bit group starting from least significant for integer part and from leftmost digit for fractional part.
Then subtract 0011 (=3) from each four-bit group that will be binary decimal digit (BCD) form of that number.
Now you can also convert this BCD code into decimal number by converting each 4-bit group into decimal digit.
Example:Convert Excess-3 code 1001001 into BCD and decimal number.
So, grouping 4-bit for each group, i.e., 0100 1001 and subtract 0011 0011 from given number.
Therefore,
= 0100 1001 -0011 0011 =0001 0110
So, binary coded decimal number is 0001 0110 and decimal number will be 16.

NON-WEIGHTED CODE: GRAY CODE
The gray code belongs to a class of codes called
minimum change codes, in which only one bit in the
code changes when moving from one code to the
next.
The Gray code is non-weighted code, as the position
of bit does not contain any weight.
The gray code is a reflective digital code which has
the special property that any two subsequent
numbers codes differ by only one bit.
This is also called a unit-distance code. In digital Gray
code has got a special place.
For example, decimal numbers 13 and 14 are
represented by gray code numbers 1011 and 1001,
these numbers differ only in single position that is the
second position from the right.
DecimalNumber BinaryCode GrayCode
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
10 1010 1111
11 1011 1110
12 1100 1010
13 1101 1011
14 1110 1001
15 1111 1000

GRAY CODE GENERATION TRICK
0 1|1 0 (Mirror the Pair)
00 01 |11 10 (prefix 0 to first half and 1 to second half)
00 01 11 10 |10 11 01 00 (Repeat the same for 3-bit or 4-bit Gray Code)
000 001 011 010 |110 111 101 100
000 001 011 010 110 111 101 100 |100 101 111 110 010 011 001 000
0000 0001 0011 0010 0110 0111 0101 0100 |1100 1101 1111 1110 1010 1011 1001 1000
0000 0001 0011 0010 0110 0111 0101 0100 1100 1101 1111 1110 1010 1011 1001 1000
01 234 567891011 1213 14 15

GENERATING GRAY CODE
Note that the Gray code sequence, only varies
by one bit as we go down the list, or bottom to
top up the list.
Adjacent cells vary by only one bit because a
Gray code sequence varies by only one bit.
This property of Gray code is often useful for
digital electronics in general. In particular, it is
applicable to Karnaughmaps.

ALPHANUMERIC CODES
The alphanumeric codesare the codesthat represent numbers and alphabetic characters.
An alphanumeric codeshould at least represent 10 digits and 26 letters of alphabet i.e. total 36 items.
Alphanumeric codes are sometimes called character codes due to their certain properties.
These codes are basically binary codes.
We can write alphanumeric data, including data, letters of the alphabet, numbers, mathematical symbols and
punctuation marks by this code which can be easily understandable and can be processed by the computers.
ASCII Code,
EBCDIC,
ISCII Code,
Hollerith Code,
Morse Code,
Teletypewriter (TTY)

ASCII CODE
The full form of ASCII code is American Standard Code for Information Interchange.
ASCII is originally a 7-bit code. It has been extended to 8-bit to better utilize the 8-bit computer memory organization.
In 1967 this code was first published and since then it is being modified and updated. ASCII code has 128 characters some
of which are enlisted below to get familiar with the code.
Hex0 1 2 3 4 5 6 7 8 9 A B C D E F
2SP! " # $ % & ' ( ) * + , - . /
30 1 2 3 4 5 6 7 8 9 : ; < = > ?
4@ A B C D E F G H I J K L M N O
5P Q R S T U V W X Y Z [ \ ] ^ _
6` a b c d e f g h i j k l m n o
7p q r s t u v w x y z { | } ~

EBCDIC CODE
The EBCDIC stands for
Extended Binary Coded Decimal
Interchange Code.
IBM invented this code to
extend the Binary Coded
Decimal which existed at that
time.
All the IBM computers and
peripherals use this code.
It is an 8 bit code and therefore
can accommodate 256
characters. Below is given some
characters of EBCDIC code to
get familiar with it.
Char EBCDIC HEX Char EBCDIC HEX Char EBCDIC HEX
A 1100 0001C1 P 1101 0111D7 4 1111 0100F4
B 1100 0010C2 Q 1101 1000D8 5 1111 0101F5
C 1100 0011C3 R 1101 1001D9 6 1111 0110F6
D 1100 0100C4 S 1110 0010E2 7 1111 0111F7
E 1100 0101C5 T 1110 0011E3 8 1111 1000F8
F 1100 0110C6 U 1110 0100E4 9 1111 1001F9
G 1100 0111C7 V 1110 0101E5 blank … …
H 1100 1000C8 W 1110 0110E6 . … …
I 1100 1001C9 X 1110 0111E7 ( … …
J 1101 0001D1 Y 1110 1000E8 + … …
K 1101 0010D2 Z 1110 1001E9 $ … …
L 1101 0011D3 0 1111 0000F0 * … …
M 1101 0100D4 1 1111 0001F1 ) … …
N 1101 0101D5 2 1111 0010F2 – … …
O 1101 0110D6 3 1111 0011F3 /

UNICODE
Unicodeis the newest concept in digital coding.
In Unicodeevery number has a unique character. Leading technological giants have adopted this code for its
uniqueness.
Before Unicode, no single character encoding scheme could represent characters in all languages.
For example, western European uses several encoding schemes (in the ISO-8859-x family). Even a single language like Chinese has a
few encoding schemes (GB2312/GBK, BIG5). Many encoding schemes are in conflict of each other, i.e., the same code number is
assigned to different characters.
Unicode aims to provide a standard character encoding scheme, which is universal, efficient, uniform and
unambiguous.
Unicode standard is maintained by a non-profit organization called the Unicode Consortium(@
www.unicode.org). Unicode is an ISO/IEC standard 10646.
Unicode originally uses 16 bits(called UCS-2 or Unicode Character Set -2 byte), which can represent up to 65,536
characters. It has since been expanded to more than 16 bits, currently stands at 21 bits.
The range of the legal codes in ISO/IEC 10646 is now from U+0000H to U+10FFFFH (21 bits or about 2 million characters),
covering all current and ancient historical scripts.

UNICODE
A part of the Unicode table is given below.
03
40
͇͈͉͍͎̀́͂̓̈́͆͊͋͌ͅ͏͓͔͕͖͙͚͐͑͒͗͛͘͜͟͝͞
03
60
ͣͤͥͦͧͨͩͪͫͬͭͮͯ͢͠͡ͰͱͲͳʹ͵Ͷͷ͸͸ͺͻͼͽ;Ϳ
03
80
͸͸͸͸΄΅Ά·ΈΉΊ͸Ό͸ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟ
G
re
ek
03
A
0
ΠΡ͸ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξο
03
C
0
πρςστυφχψωϊϋόύώϏϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟ
30
0E
ϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲ

HOLLERITH CODE
In 1896, Herman Hollerith formed a company called the Tabulating Machine Company. This company developed a
line of machines that used punched cards for tabulation.
After a number of mergers, this company was formed into the IBM, Inc. We often refer to the punched-cards used
in computer systems as Hollerith cards and the 12-bit code used on a punched-card is called the Hollerith code.
A Hollerith string is a sequence of l2-bit characters; they are encoded as two ASCII characters, containing 6 bits
each.
The first character contains punches 12,0,2,4,6,8 and the second character contains punches 11, 1,3,5, 7, 9.
Interleaving the two characters gives the original 12 bits.
To make the characters printable on ASCII terminals, bit 7 is always set to 0 and bit 6 is said to the complement
of bit 5. These two bits are ignored when reading Hollerith cards.

MORSE CODE
The Morse code, invented in 1837 by Samuel F.B. Morse, was the first alphanumeric code used in telecommunication.
It uses a standardized sequence of short and long elements to represent letters, numerals and special characters of a
given message.
The short and long elements can be formed by sounds, marks, pulses, on off keying and are commonly known as dots
and dashes. For example :
The letter 'A' is formed by a dot followed by a dash. The digit 5 is formed by 5 dots in succession.
The International Morse code treats a dash equal to three dots.
Due to variable length of Morse code characters, the Morse code could not adapt to automated circuits. In most
electronic communication, ASCII code are used.
Morse code has limited applications. It is used in communication using telegraph lines, radio circuits. Pilots and air traffic
controllers also use them to transmit their identity and other information.

TELETYPEWRITER (TTY)
A teletypewriter (TTY) is an input device that allows alphanumeric character to be typed in and sent, usually one
at a time as they are typed, to a computer or a printer.
The Teletype Corporation developed the teletypewriter, which was an early interface to computers.
Teletype mode is the capability of a keyboard, computer, application, printer, display, or modem to handle
teletypewriter input and output.
Basically, this is a one-character-at-a-time mode of sending, receiving, or handling data, although it is often modified
to handle a line of characters at a time.
Since this mode requires little programming logic, it is often used where memory is limited.
The Basic Input/OutputOperating System ( BIOS ) sends messages to a PC display using teletype mode. Most
printers offer a teletype mode.
The simplest video display output format is text in teletype mode. Many modems today continue to include
support for a TTY interface.

ERROR DETECTION AND CORRECTION CODES
Erroris a condition when the output information
does not match with the input information. During
transmission, digital signals suffer from noise that
can introduce errors in the binary bits travelling
from one system to other. That means a 0 bit may
change to 1 or a 1 bit may change to 0.
Error-Detecting codes
Whenever a message is transmitted, it may get scrambled by
noise or data may get corrupted. To avoid this, we use error-
detecting codes which are additional data added to a given
digital message to help us detect if an error occurred during
transmission of the message. A simple example of error-
detecting code is parity check.
Error-Correcting codes
Along with error-detecting code, we can also pass some data
to figure out the original message from the corrupt message
that we received. This type of code is called an error-
correcting code. Error-correcting codes also deploy the
same strategy as error-detecting codes but additionally, such
codes also detect the exact location of the corrupt bit.

EXAMPLE: PARITY CHECKING OF ERROR DETECTION
It is the simplest technique for detecting and correcting
errors.
The MSB of an 8-bits word is used as the parity bit and
the remaining 7 bits are used as data or message bits.
The parity of 8-bits transmitted word can be either even
parity or odd parity.
Even parity--Even parity means the number of 1's in the
given word including the parity bit should be even (2,4,6,....).
Odd parity--Odd parity means the number of 1's in the
given word including the parity bit should be odd (1,3,5,....).

EXAMPLE: PARITY CHECKING HOW DOES ERROR DETECTION TAKE PLACE?
Parity checking at the receiver can detect the presence of an
error if the parity of the receiver signal is different from the
expected parity.
That means, if it is known that the parity of the transmitted
signal is always going to be "even" and if the received signal has
an odd parity, then the receiver can conclude that the received
signal is not correct.
If an error is detected, then the receiver will ignore the
received byte and request for retransmission of the same byte
to the transmitter.

UNIVERSAL PRODUCT CODE (UPC)
A UPC, is a type of code printed on retail product packaging to aid in identifying aparticular item.
It consists of two parts –
the machine-readable barcode, which is a series of unique black bars, and
the unique 12-digit number beneath it.
The purpose of UPCs is to make it easy to identify product features, such as the brand name, item, size,
and color, when an item is scanned at checkout.
In fact, that’s why they were created in the first place –to speed up the checkout process at grocery stores.
UPCs are also helpful in tracking inventory within a store or warehouse.
To obtain a UPC for use on a product a company has to first apply to become part of the system.
The Global Standards Organization, formerly known as the Uniform Code Council, manages the assigning of UPCs
within the US.

CODE CONVERSIONS
There are many methods or techniques which can be used to convert code from one
format to another as following:
Binary to BCD Conversion
BCD to Binary Conversion
BCD to Excess-3
Excess-3 to BCD
BCD/Binary to Gray
Gray to Binary

CODE CONVERSIONS: BINARY TO BCD CONVERSION
Step 1--Convert the binary number to decimal.
Step 2--Convert decimal number to BCD.
Example −convert (11101)
2to BCD.
Step 1 −Convert to Decimal
BinaryNumber−:11101
2
CalculatingDecimalEquivalent−:
StepBinary
Number
Decimal Number
Step 1111012((1 ×2
4
) + (1 ×2
3
) + (1 ×2
2
) +
(0 ×2
1
) + (1 ×2
0
))10
Step 2111012(16 + 8 + 4 + 0 + 1)10
Step 311101229
10
BinaryNumber−:11101
2=DecimalNumber−:29
10
Step 2 −Convert to BCD
DecimalNumber−:29
10
CalculatingBCDEquivalent.Converteachdigitinto
groupsoffourbinarydigitsequivalent.
Step Decimal NumberConversion
Step 12910 0010210012
Step 22910 00101001BCD
Result
(11101)
2= (00101001)
BCD

CODE CONVERSIONS: BCD TO BINARY CONVERSION
Step 1--Convert the BCD number to decimal.
Step 2--Convert decimal to binary.
Example−convert(00101001)
BCDtoBinary.
Step 1 -Convert to BCD
BCDNumber−(00101001)
BCD
CalculatingDecimalEquivalent.Converteach
fourdigitintoagroupandgetdecimalequivalent
foreachgroup.
Step BCD Number Conversion
Step 1(00101001)BCD 0010210012
Step 2(00101001)BCD 210910
Step 3(00101001)BCD 2910
BCDNumber−:(00101001)
BCD=DecimalNumber−:29
10
Step 2 -Convert to Binary
Usedlongdivisionmethodfordecimaltobinary
conversion.
DecimalNumber−:29
10CalculatingBinaryEquivalent−
Step OperationResult Remainder
Step 129 / 2 14 1
Step 214 / 2 7 0
Step 37 / 2 3 1
Step 43 / 2 1 1
Step 51 / 2 0 1
Result
(00101001)
BCD= (11101)
2

CODE CONVERSIONS: BCD TO EXCESS-3 & EXCESS-3 TO BCD CONVERSION
Step 1--Convert BCD to decimal.
Step 2--Add (3)
10to this decimal number.
Step 3--Convert into binary to get excess-3 code.
Example−convert(0110)
BCDtoExcess-3.
Step 1 −Convert to decimal
(0110)
BCD=6
10
Step 2 −Add 3 to decimal
(6)
10+(3)
10=(9)
10
Step 3 −Convert to Excess-3
(9)
10=(1001)
2
(0110)
BCD= (1001)
XS-3Result
Step 1--Subtract (0011)
2from each 4 bit of excess-3
digit to obtain the corresponding BCD code.
Example −convert (10011010)
XS-3to BCD.
Given XS-3 number = 1 0 0 1 1 0 1 0
Subtract (0011)
2= 1 0 0 1 0 1 1 1
--------------------
BCD = 0 1 1 0 0 1 1 1
(10011010)
XS-3= (01100111)
BCDResult

CODE CONVERSIONS: BCD/BINARY TO GREY CODE
The MSB is kept the same. As the MSB of the binary is 0, the
MSB of the gray code will be 0 as well (first gray bit)
Next, take the XOR of the first and the second binary bit. The
first bit is 0, and the second bit is 1. The bits are different so the
resultant gray bit will be 1 (second gray bit)
Next, take the XOR of the second and third binary bit. The
second bit is 1, and the third bit is 0. These bits are again
different so the resultant gray bit will be 1 (third gray bit)
Next, take the XOR of third and fourth binary bit. The third bit
is 0, and the fourth bit is 0. As these are the same, the resultant
gray bit will be 0 (fourth gray bit)
Lastly, take the XOR of the fourth and fifth binary bit. The fourth
bit is 0, and the fifth bit is 1. These bits are different so the
resultant gray bit will be 1 (fifth gray bit)
Hence the result of binary to gray code conversion of 01001 is
complete, and the equivalent gray code is 01101.

CODE CONVERSIONS: GRAY CODE TO BINARY CONVERSION
The MSB of the binary number will be equal to the MSB of the given gray code.
Now if the second gray bit is 0, then the second binary bit will be the same as the previous or the first bit. If the
gray bit is 1 the second binary bit will alter. If it was 1 it will be 0 and if it was 0 it will be 1.
This step is continued for all the bits to do Gray code to binary conversion.

THANK YOU!