Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 39

Introduction

Analog Signals
Digital Signals
Applications of digital systems:
– Digital computers
– Calculators
– Electronic appliances
– Multimedia
– Telephony
– Video games

1
Advantages of digital over analog:
• Easy to design.
• Less affected by noise.
• Information storage is easy.
• Accuracy and precision are greater.
• More digital circuitry can be fabricated on IC chip.
Disadvantages:
• In digitisation (converting physical quantity to digital
form), there occurs unavailable error, i.e quantisation
error.
• All physical parameters are analog in nature.

2
Digital Devices
• Gates
• Flip-Flops
• PLDs- Programmable Logic Devices
• FPGAs- Field Programmable Gate Arrays.

3
Decimal Numbers
In order to understand the binary numbering 0
system lets first look at our decimal system. 1
2
• The decimal number system consists of the numbers 0 3
through 9. 4
5
• After nine we place a 1 in the tens column and start
6
again with 0, which gives us 10. 7
• The decimal system is also known as base 10 8
because it is based on the 10 numbers 0 – 9. 9
10

4
Binary digits
The two digits in the binary system 1 and 0 are called
bits-binary digit.
In digital circuits, two different voltage levels are used
to represent the two bits.
Generally 1 is represented by the higher voltage, which
is referred as HIGH and 0 is represented by a lower
voltage level, referred as LOW.
This is called positive logic, i.e. HIGH=1 and LOW=0.
Another system where 1=LOW and 0=HIGH is called
negative logic.

5
Binary Numbers have only two digits 0 or 1
Binary is known as Base 2

Decimal Binary
0 0
1 1
2 10
3 11
4 100
5 101
6 110
7 111
6
As you can see it would take a lot of time to create
charts to represent Binary numbers.

An easier way is to use the powers of 2

20 = 1 24 = 16
21 = 2 25 = 32
22 = 4 26 = 64
23 = 8 27 =128

Lets place the above calculations into a chart that will make
it easy to convert a binary number to a decimal number.

27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
7
Use the chart to convert the binary number to decimal.

27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
0 0 1 0 1 0 0 1
1 x 1 = 1
2 x 0 = 0
4 x 0 = 0 Note: The bit to
8 x 1 = 8 the far right is the
Least Significant
16 x 0 = 0 Bit (LSB) and will
determine if the
32 x 1 = 32 number is even or
64 x 0 = 0 odd.
128 x 0 = 0
Total = 41
8
Use the chart to convert the binary number to decimal.

27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
0 1 1 1 1 1 1 1
1 x 1 = 1
2 x 1 = 2
Note: if consecutive
4 x 1 = 4 bits from the right
8 x 1 = 8 are all 1’s
Then the answer is
16 x 1 = 16 the next power of 2
32 x 1 = 32 minus 1

64 x 1 = 64 In this case
128 – 1 = 127
128 x 0 = 0

Total = 127 9
Convert the given binary number to decimal.

27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
1 0 1 1 1 0 1 0
1 x 0 = 0
2 x 1 = 2
4 x 0 = 0
8 x 1 = 8
16 x 1 = 16
32 x 1 = 32
64 x 0 = 0
128 x 1 = 128

Total = 186
10
The largest number that can be represented using
an 8 bit binary number is 255.

28 27 26 25 24 23 22 21 20
256 128 64 32 16 8 4 2 1
1 1 1 1 1 1 1 1

Remember the rule – if all the digits are 1 then


the number is the next power of 2 minus 1
256 – 1 = 255

11
Converting a binary number to a decimal number
is a simple task if you understand the chart below
and how to use it.

27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1

12
Signed Numbers
• The left most bit in a signed binary number is the sign
bit, which tells whether the number is positive or
negative.
• A 0 is for positive and 1 is for negative.
• The magnitude bits are in true (uncomplemented)
binary for both positive and negative numbers.
Example: 00011001

Sign bit Magnitude bits


This is decimal number +25.
13
The decimal number -25 is expressed as 10011001.
The only difference between +25 and -25 is the sign bit
because the magnitude bits are in true binary for both
positive and negative numbers.
1’s complement form
Positive numbers in 1’s complement form are
represented in the same way as positive sign
magnitude numbers.
Negative numbers are the 1’s complement of the
corresponding positive numbers.
Example: -25 is expressed as the 1’s complement of
+25(00011001), which is 11100110. (Or don’t change
the sign bit and invert the magnitude bits)
14
2’s complement form:
Positive numbers are represented the same way as in
the sign magnitude and 1’s complement form.
Negative numbers are the 2’s complements of the
corresponding positive numbers
Thus, -25 in 2’s complement form is expressed as 2’s
complement of +25(00011001), which is 11100111.
(Or don’t change the sign bit and then take the 2’s
complement of the magnitude bits)

15
Arithmetic operations with signed numbers

1) Addition
(a) Both numbers (addend and augend) are positive:
The sum is positive and is in true (uncomplemented)
form.
Example: 00000111 7
+ 00000100 4
00001011 11

16
Overflow condition
When two numbers are added and the number of bits
required to represent the sum exceeds the number of
bits in the two numbers, and overflow results as
indicated by an incorrect sign bit.
An overflow can occur when both the numbers are
positive or both the numbers are negative.
Example: 01111101
+ 00111010
10110111

Sign incorrect
17
(b) Positive number with larger magnitude than negative
number:
The final carry bit is discarded. The sum is positive and
therefore in true binary form.
Example: 00001111 15
+ 11111010 + -6
100001001 9

Discard carry
Note: -6 is expressed as 2’s complement of signed +6.

18
(c) Negative number with magnitude larger than
positive number:
Example: 16-24
00010000 16
+ 11101000 +-24
11111000 -8
The sum is negative and therefore in 2’s complement
form. The final answer in decimal is the 2’s
complement of the answer with a negative sign.

19
(d) Both numbers negative:
The final carry bit is discarded. The sum is negative and
therefore in 2’s complement form.
Example:
11111011 -5
+ 11110111 +-9
111110010 -14

Discard carry

20
Subtraction

Subtraction operation changes the sign of


subtrahend and adds it to the minuend.
The sign of a positive or negative binary number
is changed by taking its 2’s complement.
To subtract two signed numbers, take the 2’s
complement of the subtrahend and add.
Discard any final carry bit.

21
Example:
00001000 – 00000011 i.e. 8-3
Which is 8+(-3) = 5
00001000 -------Minuend
+ 11111101 -------(2’s complement of subtrahend)
1 00000101

Discard carry

22
Binary to Hexadecimal Conversion
Break the binary number into 4-bit groups,
starting at the rightmost bit and replace each 4-
bit group with the equivalent hexadecimal
symbol.
Example: 1100101001010111
C A 5 7
Thus (1100101001010111)2 = (CA57)16

23
Hexadecimal to Binary Conversion
Reverse the above process, i.e. replace each
hexadecimal symbol with appropriate four bits.
Example: (10A4)16 = (1000010100100)2
Hexadecimal to Decimal Conversion
First convert hexadecimal number to binary and then
convert from binary to decimal.
Example: (1C)16 = (00011100)2 = (16+8+4)10 = (28)10

24
Another method is to multiply decimal value of
each hexadecimal digit by its weight and then
take the sum of these products.
Example: (1C)16 = 1 * 161+C * 160 = 16 + 12 = 28

25
Decimal to Hexadecimal Conversion
Repeated division by 16 will give the equivalent
hexadecimal number, formed by the
remainders of the division.
Example: (650)10 = (28A)16
16 650
16 40 10
16 2 8
16 0 2
26
Hexadecimal Addition
(a) 2316 (b) DF16
+ 1616 + AC16
3916 18B16

Right column = F16 + C16 = 1510 + 1210 = 2710


= 2710 - 1610 = 1110 = B16 with a carry
1
Left column = D16 + A16 + 116 = 1310 + 1010 + 110 = 2410
= 2410 - 1610 = 816 with a carry 1
27
Octal Number System
Is composed of eight digits, 0,1……7
Octal to Decimal Conversion
Since the base is 8, each successive digit position is an
increasing power of 8, beginning from right with
power 80.
Example: (2374)8 = (2*83)+(3*82)+(7*81)+(4*80)
= 1024+192+56+4 = (1276)10

28
Decimal to Octal Conversion
Repeated division by 8.
Example: (359)8 = (547)10
8 359
8 44 7
8 5 4
8 0 5

29
Octal to Binary Conversion
Simply replace each octal digit with the
appropriate three bits.
Example: (13)8 = (001011)2

30
Binary to Octal Conversion
Break the binary number into 3-bit groups,
starting at the rightmost bit and replace each 3-
bit group with the equivalent octal number.
If three bits are not available for the left most
group, add zeroes to make a complete group.
Example: 011010000100 = (3204) 8
3 2 0 4

31
Binary Coded Decimal (BCD)
BCD is a way to express each of the decimal digits with
a binary code.
The 8421 code is a type of BCD code.
Binary Coded Decimal means that each decimal digit, 0
through 9, is represented by a binary code of four
bits.
The designation 8421 indicates the binary weight of
four bits (23 , 22 , 21 , 20).

32
Decimal Number BCD
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
33
Invalid Codes:
With the help of four bits, 16 numbers (0000 through
1111) can be represented, but in 8421 code, only 10
of these are used. The six combinations are not used –
10 through 15 (1010……..1111) and are called
invalid in the 8421 BCD code.
To convert a decimal number to BCD, write 4 bit code
for each decimal digit.
Example: 24 is represented as 00100100 in BCD.
Reverse happens when we convert BCD to decimal.

34
BCD Addition
1) Add the two BCD numbers using the rule of binary
addition.
2) If the 4-bit sum is equal to or less than 9, it is a
valid BCD number.
3) If the 4-bit sum is greater than 9, or if a carry is
generated, it is an invalid result. So add 6 (0110) to
the 4-bit sum to get a valid result.

35
Example: 1001+0100
1001
+ 0100
1101----------invalid BCD
+ 0110 ---------add 6
10011----------valid BCD, 00010011 = 13

36
Digital Codes and Parity
The Gray Code is unweighted and not an arithemetic
code: that is there are no specific weights assigned to the
bit positions.
The important feature of Gray code is that it exhibits
only a single bit change from one code word to the next
in sequence.
This single bit change characteristic of the Gray code
minimizes the chance for error.

37
Binary to Gray Code Conversion
1. The MSB (left–most) in the Gray code is the same
as the corresponding MSB in the binary number.
2. Going from left to right, add each adjacent pair of
binary code bits to get the next Gray code bit.
Discard carries.
Example: convert 10110 in binary to Gray code.
1+0+ 1 + 1+ 0

1 1 1 0 1
So the Gray code is 11101
38
Gray to Binary Code Conversion
1. The MSB (left–most) in the binary code is the same
as the corresponding bit in the Gray number.
2. Add each binary code bit generated to the Gray
code bit in the next adjacent position. Discard
carries.
Example: convert 11101 in Gray to binary.
1 1 1 0 1

1 0 1 1 0
So the binary is 10110
39

You might also like