Fundamentals of Digital Computers: Unit - I

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 23

FUNDAMENTALS OF DIGITAL COMPUTERS

UNIT – I
1.1 DIGITAL PRINCIPLES
Digital principles are the basis for all digital electronic system, and they along
with a no. of applications are intended to provide the background to succeed in the
modern world of digital electronics.
1.1.1 Definitions for Digital Signals
Electronic circuits and systems can be divided into two categories generally
referred to as
Analog and
Digital
1.1.2 Analog
Analog circuits, designed for use with small signals, can be made to work in a
linear fashion.
An analog signal is further classified into simple and composite signals. A
simple analog signal is a sine wave that cannot be decomposed further. On the other
hand, a composite analog signal can be further decomposed into multiple sine waves.

The range of an anlaog signal is not fixed. An analog signal transmits data in the
form of wave. The best example of an analog signal is a human voice.
1.1.3 Digital
Digital circuits are generally used with large signals and are considered
nonlinear.
Digital signal represents a noncontiguous wave that carries information in a
binary format and has discrete values. The output signal is simply on or off.

Page 1
FUNDAMENTALS OF DIGITAL COMPUTERS

The range of the digital signal is finite and ranges between 0 to 1. Digital signal
transmits the data in the binary form i.e. in the form of bits. The best example of a
digital signal is the transmission of data in a computer
1.1.4 Binary system
A digital electronic circuit (Or) system has only two states said to be binary (Bi
means two).
The binary number system has exactly two signals “0” & “1”.
The binary number is widely used in digital electronics.

The operations of electronic circuit can be described in terms of its voltage levels.
There are two types of voltage levels.
 High voltage (H)
 Low voltage (L)
This can be represented in binary number system as L = 0 & H = 1 and TRUE for
High and FALSE for low in logical operations.
Here, H = 1 = T and L = 0 = F is called positive logic and H = 0 = F and L = 1 = T
is called negative logic.
The majority of digital circuit families utilize a single +5Vdc power supply and
two voltage levels are +5Vdc and 0Vdc.

Page 2
FUNDAMENTALS OF DIGITAL COMPUTERS

1.1.5 Ideal digital signal


The voltage levels in an ideal digital circuit will have values of either +5Vdc (or)
0Vdc.
When the voltage changes between values, they do so in zero time.

Page 3
FUNDAMENTALS OF DIGITAL COMPUTERS

1.2 NUMBER SYSTEM AND CODES


NUMBER SYSTEM
There are four types of number systems,
1. Binary Number System
2. Octal Number System
3. Decimal Number System
4. Hexadecimal Number System

Decimal Binary Octal Hexadecimal


Number Number Number Number

0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F

1.2.1 BINARY NUMBER SYSTEM:

Page 4
FUNDAMENTALS OF DIGITAL COMPUTERS

The number system which uses a base of 2 is called the binary number system.
Binary number system has 2 digits i.e., 0 and 1.
It is also called base 2 number system.
Binary Conversions:
Binary to octal : Simply group the binary digits into groups of 3.
Binary to Decimal : Multiplying powers of 2.
Binary to Hexadecimal : Simply group the binary digits into groups of 4.
Examples of Binary to octal:
1. (111110111)2 = ?8
111 110 111
7 6 7
Ans: (111110111)2 = (767)8

2. (10110111.10011)2 = ?8
010 110 111 . 100 110
2 6 7 4 6
Ans: (10110111.10011)2 = (267.46)8

3. Convert (1001111)2 to Octal Number


001 001 111
1 1 7
Ans: (1001111)2 = (117)8

4. Convert (101001110100.011)2 into octal system


101 001 110 100 . 011
5 1 6 4 3
Ans: (1010011101000.011)2 = (5164.3)8

Examples of Binary to Decimal:


1. (1010.101)2 = ?10

Page 5
FUNDAMENTALS OF DIGITAL COMPUTERS

2. Convert (1001111)2 to decimal number

3. Convert (0.11)2 to the decimal system


(0.11)2 = 1x2-1+1x2-2
= 1/2 + ¼
= 0.5 + 0.25
= 0.75
Ans: (0.11)2 = (0.75)10
4. Convert (1100101.100)2 to the decimal system
Integer part is 1100101

Page 6
FUNDAMENTALS OF DIGITAL COMPUTERS

= 1x26 + 1x25 + 0x24 + 0x23 + 1x22+ 0x21 + 1x20


= 64 + 32 + 0 + 0 + 4 + 0 + 1
= 101
Fraction part is .100
= 1x2-1 + 0x2-2 + 0x2-3
=½+0+0
= 0.5
Ans: (1100101.100)2 = (101.5)10
Examples of Binary to Hexadecimal:
1. (10111011)2 = ?16
1011 1011
B B
Ans: (10111011)2 = (BB)16
2. (1011010.100101)2 = ?16
0101 1010 . 1001 0100
5 A 9 4
Ans: (1011010.100101)2 = (5A.94)16
3. (101001)2 = ?16
0010 1001
2 9
Ans :(101001) 2 =(29)16
4. (1010.011)2 = ?16
1010 .0110
A 6
Ans :(1010.011) 2 = (A.6)16

1.2.2 OCTAL NUMBER SYSTEM


The number system which uses a base of 8 is called the octal number system.
It is also called base 8 number system.
Page 7
FUNDAMENTALS OF DIGITAL COMPUTERS

Octal number system have 8 digits ie, 0, 1, 2, 3, 4, 5, 6, 7.


Octal Conversions
Octal to Binary : Using 421 code.
Octal to Decimal : Multiplying powers of 8.
Octal to Hexadecimal
First convert the given octal number to 421 codes.
Convert 421 codes to 8421 code.
421 code 8421 code
22 21 20 23 22 21 20
Decimal 4 2 1 8 4 2 1
0 0 0 0 0 0 0 0
1 0 0 1 0 0 0 1
2 0 1 0 0 0 1 0
3 0 1 1 0 0 1 1
4 1 0 0 0 1 0 0
5 1 0 1 0 1 0 1
6 1 1 0 0 1 1 0
7 1 1 1 0 1 1 1
8 1 0 0 0
9 1 0 0 1
10 (A) 1 0 1 0
11 (B) 1 0 1 1
12 (C) 1 1 0 0
13 (D) 1 1 0 1
14 (E) 1 1 1 0
15 (F) 1 1 1 1

Examples of Octal to Binary


1. (7521)8 = ?2
7 = 111
5 = 101

Page 8
FUNDAMENTALS OF DIGITAL COMPUTERS

2 = 010
1 = 001 Ans: (7521)8 = (111101010001)2

2. (623.54)8 = ?2
6 = 110
2 = 010
3 = 011
5 = 101
4 = 100 Ans: (623.54)8 = (110010011.101100)2

3. (12.3)8 = ?2
1 = 001
2 = 010
3 = 011 Ans: (12.3)8 = (001010.011)2

4. Convert (1250)8 into binary system


1 = 001
2 = 010
5 = 101
0 = 000 Ans: (1250)8 = (001010101000)2

5. (117)8 = ?2
1 = 001
1 = 001
7 = 111 Ans: (117)8 = (001001111)2

Examples of Octal to Decimal


1. (512)8 = ?10

Page 9
FUNDAMENTALS OF DIGITAL COMPUTERS

2. Convert (371.145)8 to decimal number

3. Convert (6.50)8 to decimal number

4. Convert (0.150)8 to the decimal system


(0.150)8 = 1x8-1+5x8-2 +0x8-3
= 1/8 +5x1/64+0
Page 10
FUNDAMENTALS OF DIGITAL COMPUTERS

= 0.125 + 0.078
= 0.203
Ans: (0.150)8 = (0.203)10
5. Convert (1452)8 to the decimal system
(1452)8 = 1x83+4x82 +5x81 +2x80
= 512 +4x64+5x8 +2x1
= 512 +256 + 40 + 2
= 810
Ans: (1452)8 = (810)10

Examples of Octal to Hexadecimal


1. (724)8 = ?16
Convert using 421 code
724 = 111 010 100
Next convert it to 8421 code
0001 1101 0100
1 D 4
Ans: (724)8 = (1D4)16

2. (371.145)8 = ?16
Convert using 421 code
371.145 = 011 111 001 . 001 100 101
Next convert it to 8421 code
0000 1111 1001 . 0011 0010 1000
0 F 9 3 2 8
Ans: (371.145)8 = (F9.328)16

3. (011)8 = ?16
Convert using 421 code
011 = 000 001 001
Next convert it to 8421 code
Page 11
FUNDAMENTALS OF DIGITAL COMPUTERS

0000 0000 1001


0 0 9
Ans: (011)8 = (009)16
4. (6340)8 = ?16
Convert using 421 code
6340 = 110 011 100 000
Next convert it to 8421 code
1100 1110 0000
C E 0
Ans: (6340)8 = (CE0)16

1.2.3 DECIMAL NUMBER SYSTEM


The number system which uses a base of 10 is called the decimal number system.
Decimal number system have 10 digits ie, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
Decimal Conversions:
Decimal to Binary : Divisible by 2.
Decimal to Octal : Divisible by 8.
Decimal to Hexadecimal : Divisible by 16.
Examples of Decimal to Binary:
1. (90)10 = ?2

Ans: (90)10 = (1011010)2

2. (15.75)10 = ?2

Page 12
FUNDAMENTALS OF DIGITAL COMPUTERS

Ans: (15.75)10 = (1111.1100)2


3. (250.25)10 = ?2

Ans: (250.25)10 = (11111010.010)2


4. (108)10 = ?2

Ans: (108)10 = (1101100)2

5. (60)10 = ?2

Page 13
FUNDAMENTALS OF DIGITAL COMPUTERS

Ans: (60)10 = (111100)2


Examples of Decimal to octal:
1. (200)10 = ?8

Ans: (200)10 = (310)8


2. (18.90)10 = ?8

Ans: (18.90)10 = (22.71463)8


3. (9.741)10 = ?8

Ans: (9.741)10 = (11.573310)8

4. (168)10 = ?8

Ans: (168)10 = (250)8


Examples of Decimal to Hexadecimal
1. (156)10 = ?16

Page 14
FUNDAMENTALS OF DIGITAL COMPUTERS

Ans: (156)10 = (9C)16


2. (78.34)10 = ?16

Ans: (78.34)10 = (4E.57013D)16


3. (225.25)10 = ?16

Ans: (225.25)10 = (E1.40)16


4. (425)10 = ?16

Ans: (425)10 = (1A9)16


5. (108)10 = ?16

Ans: (108)10 = (6C)16


1.2.4 HEXADECIMAL NUMBER SYSTEM
The number system which uses a base of 16 is called the decimal number system.
It have 16 digits i.e., (0 to 9 and A to F).
Hexadecimal Conversions
Hexadecimal to Binary : Using 8421 code.
Hexadecimal to Octal:
 First convert to 8421 codes.
Page 15
FUNDAMENTALS OF DIGITAL COMPUTERS

 Convert 8421 codes to 421 codes.


Hexadecimal to Decimal : Multiplying powers of 16.
Examples of Hexadecimal to Binary
1. (AB)16= ?2
A = 1010
B = 1011
Ans : (AB)16 = (10101011)2
2. (7D.A2)16 = ?2
7 = 0111
D = 1101
A = 1010
B = 0010
Ans : (7D.A2)16 = (01111101.10100010)2
3. Convert (EF125)16 into binary system?
E = 1110
F = 1111
1 = 0001
2 = 0010
5 = 0101
Ans : (EF125)16 = (11101111000100100101)2
4. Convert (AB.C)16 INTO Binary?
A = 1010
B = 1011
C = 1100 Ans: (ABF.1C)16 = (10101011. 1100)2
Examples of Hexadecimal to Octal
1. (ABC)16= ?8
Convert to 8421 code
ABC= 1010 1011 1100
Convert to 421 code
101 010 111 100
5 2 7 4
Ans : (ABC)16 = (5274)8
Page 16
FUNDAMENTALS OF DIGITAL COMPUTERS

2. (1D4)16 = ?8
Convert to 8421 code
1D4= 0001 1101 0100
Convert to 421 code
000 111 010 100
0 7 2 4
Ans :(1D4)16 = (0724)8
3. (D53.4)16 = ?8
Convert to 8421 code
D53.4= 1101 0101 0011. 0100
Convert to 421 code
110 101 010 011. 010 000
6 5 2 3 2 0
Ans :(D53.4)16 = (6523.20)8
Examples of Hexadecimal to Decimal
1. (DF3)16 = ?10

Ans: (DF3)16 = (3571)10


2. Convert (1A.3B)16 to decimal number?

Ans: (1A.3B)16 = (26.2304)10

Page 17
FUNDAMENTALS OF DIGITAL COMPUTERS

1.2.5 BINARY CODED DECIMAL (BCD)


The BCD is the simplest binary code that is used to represent a decimal number.
In the BCD code, 4 bits represent a decimal number.
For example,
 2 is represented as 0010.
If a decimal number consists of more than 1 digit, each decimal digit is
represented individually by its 4-bit binary equivalent.
For example,
 123 is represented as 0001 0010 0011.
There is a difference between the binary equivalent of a decimal number and its
BCD code.
For example,
The binary equivalent of 45 is 101101 and its BCD code is 0100 0101.
BCD is straight assignment of the binary equivalent; it is possible to assign
weights to the binary bits according to their points. BCD code is also called an 8421
code. The weights in the BCD codes are 8 4 2 1
For example
1. 1 0 1 0

1x8 + 0x4 + 1x2 + 0x1 = 10


2. 0 1 0 1

0x8 + 1x4 + 0x2 + 1x1 = 5


Advantage
One advantage of the BCD system is that there is no limit to the size of a number.
Disadvantage
There is a difficulty in forming complements when numbers are represented in
BCD.
For example, 1’s complement of 2 (0010) is 1101 which is 13 in the decimal
system and it is not an acceptable BCD code. To overcome this difficulty, other BCD
code such as Excess-3 is used.
BCD codes for decimal digits

Page 18
FUNDAMENTALS OF DIGITAL COMPUTERS

1.2.6 GRAY CODE


The reflected binary code (RBC), also known just as reflected binary (RB) or Gray
code, is an ordering of the binary numeral system such that two successive values differ
in only one bit (binary digit).
The Gray code is binary code. It is used in shaft encoder, which indicates the
angular position of a shaft in digital form.
The reflected binary code was originally designed to prevent spurious output
from electromechanical switches. Now, Gray codes are widely used to facilitate error
correction in digital communications such as digital terrestrial television and
some cable TV systems.
The bits are arranged in such a way that only one bit changes at a time when we
make a change from one number to the next. Its use reduces the error in reading shaft
position. The largest possible error will be one least significant digit.
The gray code is often used in computer controlled machines such as lathes etc.
Photoelectric coders or shaft position encoders are used as sensors.
Let us consider an object move along a track and move from one zone to another.
Let the presence of the object in one zone is sensed by sensors ABC.
If consecutive zones are binary coded then zone-0 is represented by ABC= 000,
zone-1 by ABC= 001, zone-2 by ABC= 010 and so on.
Now consider, the object moves from zone-1 to zone-2. Both BC has to change to
sense that movement. Suppose, sensor B (may be an electro-mechanical switch) reacts
slightly late than sensor C. Then, initially ABC= 000 is sensed as if the object has moved
in the other direction from zone-1 to zone-0.

Page 19
FUNDAMENTALS OF DIGITAL COMPUTERS

This problem can be more prominent if the object moves from zone-3 (ABC =
011) to zone-4 (ABC= 100) when all three sensors has to change its value.
If zones are gray coded such problem does not appear as between two
consecutive zones only one sensor changes its value.

The disadvantage with gray code is that it is not good for arithmetic operation.
For comparing truth tables of binary coded numbers and gray coded numbers we can
design binary to gray converter and gray to binary converter.

Gray code

Page 20
FUNDAMENTALS OF DIGITAL COMPUTERS

To obtain a different reflected code, one can start with any bit combination and
proceed to obtain the next bit combination by changing only one bit from 0 to 1 or 1 to 0
in any desired random fashion.
1.2.7 EXCESS-3 CODE
To overcome the disadvantage of BCD in forming complements, other systems
like Excess-3 codes are used.
This code is formed by adding 3 to the decimal number and then forming the
binary coded number.
For example,
To form the excess-3 representation of 5, first 3 is added to 5 yielding 8 and
normal BCD is used which is 1000.
Similarly, the decimal number 0, 1, 2 coded in Excess-3 will be 0011, 0100, 0101.

1.2.8 ASCII CODE

Page 21
FUNDAMENTALS OF DIGITAL COMPUTERS

ASCII stands for American Standard Code for Information Interchange.


ASCII is widely used in small computers, peripherals, instruments and
communication devices.
It is a 7 bit code. It was developed by ANSI (American National Standard
Institute).
Microcomputers using 8-bit word length use 7-bits to represent the basic code.
The 8th bit is used for parity or it may be permanently 1 or 0.
With 7 bit up to 128 characters can be coded.
A letter, digit or special symbol is called a character. It includes upper and lower
case alphabets, numbers, and punctuation mark and control characters.

ASCII-8 CODE
A new version of ASCII is the ASCII-8 code which is an 8-bit code, with 8-bits the
code capacity is extended to 256 characters.

1.2.9 EBCDIC CODE


EBCDIC stands for Extended Binary Coded Decimal Interchange Code.
It is a standard character code for large computers,

Page 22
FUNDAMENTALS OF DIGITAL COMPUTERS

It is an 8-bit code without parity.


With 8-bits up to 256 characters can be coded.
In ASCII-8 and EBCDIC, the first 4-bits are zone bits and the remaining 4-bits
represent digit values.

Page 23

You might also like