Sunteți pe pagina 1din 20

UNIT – 5

MICROPROCESSORS
Digital Number System
 Digital electronics uses circuits, that have two states, which are represented by
two voltage ranges called HIGH and LOW.
 We often represent a HIGH state by the number 1, and a LOW state by the
number 0.
 The digital numbering system can be classified as:
• Decimal Number System
• Binary Number System
• Hexa-decimal Number System
• Octal Number system
Binary & Decimal Number System
The decimal system is based on the use of 10 symbols or digits; 0,1,..9
The binary system is based on just two symbols 0 & 1.
Examples:
(N)2 = (11100110)2
Its decimal value is given by,
(N)2 = 1 x 27 + 1 x 26 + 1 x 25 + 0 x 24 + 0 x 23+ 1 x 22 + 1 x 21 + 0 x 20
= 128 + 64 + 32 + 0 + 0 + 4 + 2 + 0 = (230)10
A binary fractional number (N)2 = 101.101
Its decimal value is given by
(N)2 = 1 x 22 + 0 x 21 + 1 x 20+ 1 x 2-1 + 0 x 2-2 + 1 x 2-3
= 4 + 0 + 1 + 0+ 0.5 +(1/8)
= 5 + 0.5 + 0.125 = (5.625)10

1
BCD
 Binary-Coded Decimal (BCD) is a class of binary encodings of decimal
numbers where each decimal digit is represented by a fixed number of bits,
usually four or eight.
 Binary coded decimal is a widely used system with computers.
 Each decimal digit is coded separately in binary.
Example: the decimal no 15 in BCD is 0001 0101
 This code is useful in microprocessor based system where the output has to
drive decimal displays

BOOLEAN ALGEBRA
Boolean algebra involves digits 1 & 0 and operations •,+ and the inverse.
Laws of Boolean Algebra are,
1. Anything OR ed with itself equal to itself:
2. Anything AND ed with itself is equal to itself :
3. It does not matter in which order we consider inputs for OR and AND gates.
4. 𝑨 + (𝑩 · 𝑪) = (𝑨 + 𝑩) · (𝑨 + 𝑪) (AND Distributive Law)
5. 𝑨 · (𝑩 + 𝑪) = (𝑨 · 𝑩) + (𝑨 · 𝑪) (OR Distributive Law)
6. 𝑨 + 𝑩 = 𝑩 + 𝑨 and 𝑨 · 𝑩 = 𝑩 · 𝑨
7. 𝑨 + 𝑨̅=𝟏
8. 𝑨 + 𝟎 = 𝑨 and 𝑨 + 𝟏 = 𝟏 , 𝑨 · 𝟏 =A
̅ = 𝟎 and 𝑨 · 𝟎 = 𝟎
9. 𝑨 · 𝑨

2
3
De Morgan’s Law
DeMorgan's Theorems are two additional simplification techniques that can be
used to simplify Boolean expressions.
1. The inverse of the outcome of ORing A and B is the same as when the
inverses of A and B are separately ANDed.
̅̅̅̅̅̅̅̅
𝐴 + 𝐵 = 𝐴̅ · 𝐵̅
2. The inverse of the outcome of ANDing A and B is same as when the
inverses of A and B are ORed.
̅̅̅̅̅̅̅
𝑨·𝑩=𝑨 ̅+𝑩 ̅

LOGIC GATES
Logic gates are the building blocks for digital electronic systems.
AND Gate: ‘AND’ Gate gives o/p high only when both i/p are high.

OR Gate: An ‘OR’ gate with i/p ‘A’ and ‘B’ gives an o/p of 1 when ‘A’ or ‘B’ is 1.

4
NOT Gate
A NOT gate has one i/p and one o/p, giving a 1 o/p when the i/p is 0 and vice versa.

NAND Gate
It is a combination of an AND gate followed by NOT Gate

5
NOR gate
NOR gate is a Combination of OR gate followed by NOT gate.

XOR Gate
For an Exclusive OR gate, the output is 1 if the inputs are different, but 0 if the
inputs are the same.

6
The Flip-Flops
 The flip-flop is a basic memory element which is made up of assembly of logic
gates and sequential logic device.
 A sequential logic system requires an o/p which depends on earlier values of
inputs. Therefore a sequential logic system must have some form of memory.
 There are a number of forms of flip-flop:
• SR flip-flop
• JK Flip-flop
• D flip-flop
SR flip-flop (SR Latch)

Fig: SR flip-flop circuit Fig: SR flip-flop


Initially both o/p are ‘0’ and S=0 & R=0;
SET
 When S is changed from ‘0’ to ‘1’ the o/p from NOR gate will become ‘0’
 This results in both i/p to NOR gate ‘1’ becoming ‘0’ so it’s o/p becomes ‘1’.
 This feedback acts as i/p to NOR gate 2 which has both i/p’s at 1 & result in
no further change.
 Now if S is changed from 1 to 0 there is no change of o/p.
RESET
 If ‘R’ is changed from 0 to1, when S is 0.
 The o/p from NOR gate 1 changes to 0 & hence the o/p from the NOR gate 2
changes to 1.
 The flip-flop has been reset.
 A change then from R to 0 will have no effect on o/p’s
If S & R are made simultaneously made equal to 1, no stable state can occur and so
this i/p condition is not allowed.

7
Clocked SR flip-flop (synchronous SR latch)

Fig: Circuit Arrangement for Fig: Symbol for


Clocked SR flip-flop Clocked SR flip-flop

 It is required for SET and RESET operations to occur at a particular time.


 With the unclocked system the o/p of logic gate can change at any time when
any one or more of i/p change.
 With a clocked system the exact time at which any o/p can change state are
determined by a signal termed as clock signal.
 In clocked SR flip-flop the set and clock signal are supplied through AND gate
to the ‘S’ i/p of flip-flop.
 The set signal only arrives at flip-flop when both it & clock signal are 1.
 Similarly RESET signal is supplied with a clock signal to the R input via another
AND gate
 Here the setting and resetting can only occur at the time determined by the clock.

8
JK flip-flop

Fig: Circuit Arrangement for JK flip-flop


 For many applications the indeterminate state occurs with SR flip-flop when S=1
& R=1 is not acceptable.
 JK flip flop is used to avoid the above problem
 JK flip-flop is widely used device

The flip-flop is constructed in such a way that the output Q is ANDed with K and
Clk. This arrangement is made so that the flip-flop is cleared during a clock pulse
only if Q was previously 1. Similarly 𝑄̅is ANDed with J and Clk, so that the flip-
flop is cleared during a clock pulse only if 𝑄̅ was previously 1.
When J=K=0
When both J and K are 0, the clock pulse has no effect on the output and the
output of the flip-flop is the same as its previous value. This is because when both
the J and K are 0, the output of their respective AND gate becomes 0.

9
When J=0, K=1
When J=0, the output of the AND gate corresponding to J becomes 0 (i.e.) S=0
and R=1. Therefore 𝑄̅ becomes 1. This condition will reset the flip-flop. This
represents the RESET state of Flip-flop.
When J=1, K=0
In this case, the AND gate corresponding to K becomes 0(i.e.) S=1 and R=0.
Therefore, Q becomes 1. This condition will set the Flip-flop. This represents the
SET state of Flip-flop.
When J=K=1
Consider the condition of Clk=1 and J=K=1. This will cause the output to
complement again and again. This complement operation continues until the Clock
pulse goes back to 0. Since this condition is undesirable. This undesirable
behaviour can be eliminated by Edge triggering of JK flip-flop.
Triggering Methods in Flip-flops

Timing diagram for Positive edge triggered flip flop

10
D flip-flop

Fig: Circuit Arrangement for D flip-flop

 The data or D flip-flop is basically a clocked SR flip-flop or a JK flipflop with


the ‘D’ i/p being connected directly to ‘S’ or ‘J’ input’s via a NOT gate to the
‘R’ or ‘K’ i/p.
 The D flip-flop captures the value of the D-input at a definite portion of the clock
cycle (such as the rising edge of the clock)
 The captured value becomes the Q output.
 At other times, the output Q does not change.

REGISTERS
 A register is a set of memory element that is used to hold information until it
is needed.
 It can be implemented by a set of flip-flops.
 Each flip-flop stores a binary signal.
 A load signal can be ANDed with the clock to enable and disable loading the
registers
 When load signal is zero, no clock i/p occurs to the D flip-flops and so no
change occurs to the states of the flip-flop.
 when the load signal is 1, then the i/p can change the states of the flip flops
 As long as the load signal is 0, the flip-flops will hold their old state values.

11
Fig: A 4 bit Register

INTRODUCTION TO MICROPROCESSORS ()
 It is a multi-purpose, programmable device that reads binary instructions from a
storage device called memory, processes the data according to the instructions,
and then provides results as output.
 In common practice it is also known as CPU (central processing unit).
 First Microcontroller, Intel 4004 was launched in 1971. It was able to process
just 4 bits.
 The fourth-gen Intel Core processor has 1.7 billion transistors and runs as
3,000,000,000Hz.
 Intel claims that by 2026 processors will have as many transistors as there are
neurons in a brain.
Microprocessors are classified primarily in two categories:
1. Reprogrammable Systems:
e.g.: Microcomputers: A microcomputer is a small, relatively inexpensive
computer with a microprocessor as its central processing unit (CPU). It includes a
microprocessor, memory, and input/output (I/O) facilities
2. Embedded Systems:
Photocopying machine, Digital camera, Washing machine.

12
Microprocessor Systems

Fig: General form of microprocessor system and its buses


Systems using microprocessors basically have three parts:
 A central processing unit (CPU): To recognize and carryout program
instructions.
 I/P and O/P interfaces: To handle communication between the
microprocessor and the outside world.
 Memory: To hold program instruction and data.
The microprocessors which have memory and various input/output
arrangements all on same chip is called micro controllers.

Buses
• Digital signals move from one section to another along paths called buses.
• There are three forms of bus in a microprocessor system:
1. Data bus
2. Address bus
3. Control bus
1. Data Bus:
 The data associated with the processing function of the CPU is carried by data
bus.
 It is used to transport a word to or from the CPU and the memory or the input
/ output interfaces.
 Each wire in the bus carries a binary signal, i.e. a 0 or a 1.
 Thus with a four word 1010 being carried by a separate wire in the bus.
 The more wires the data bus has the longer the word length that can be used.

13
2. Address Bus:
 The address bus carries signals which indicate where data is to be found and
so selection of certain memory locations or input or output ports.
 Each storage location within a memory device has a unique identification or
address.
 Each input /output interface also has an address
3. Control Bus:
 The signals relating to control actions are carried by the control bus.
 Control bus is also used to carry the system clock signals; these are to
synchronize all the actions of the microprocessor systems.

THE MICROPROCESSOR
The following are the functions of the constituent parts of a microprocessor.
1. ALU: ALU stands for Arithmetical Logical Unit. As name indicates it has two
parts:
 Arithmetical unit which is responsible for mathematical operations like
addition, subtraction, multiplication and division
 Logical unit which is dedicated to take logical decisions like greater than,
less than, equal to, not equal to etc. (Basically AND/OR/NOT Operations)
2. Registers:
Registers are small storage devices that are available to CPU or processors.
They act as temporary storage for processing of intermediate data by mathematical
or logical operations.
3. Control unit:
It determines the timing and sequence of operations. It directs data flow
between CPU and storage and I/O devices.
4. Memory:
Stores binary data and takes form of one or more integrated circuits
5. Input Devices:
Input devices are used to enter input data to microprocessor from Keyboard
or from ADC which receives data from sensors/signal conditioning systems.
6. Output Devices:
These devices display the results/conclusions coming out from ALUs either
in soft copy (Monitor) or in Hard Copy (Printer).

14
Fig: General Internal Architecture of Microprocessor

The commonly used registers are:


1. Accumulator register:
 In a computer's central processing unit (CPU), an accumulator is a register in
which intermediate arithmetic and logic results are stored.
 Since only one memory location can be addressed at once, temporary storage
is required.
 E.g.: In the addition of two numbers, one of the address is fetched from one
address and placed in the accumulator register while the CPU fetches other
number from the other memory address.
 The accumulator register is thus a temporary holding register for ALU and
also after the operation for holding results.
2. Status register or condition code register or flag register
 Status register contains the information concerning the latest process carried
out in the ALU.
 It contains individual bits with each bit having special significance. The bits
called Flags.
 The status of the latest operation is indicated by each flag, with each flag
being set or reset to indicate a specific status.

fig: Status register FLAGS and meaning

15
3. Program counter register or instruction register(IP)
 This register is used to allow the CPU to keep track of its position in a
program.
 This register contains the address of the memory location that contains the
next program instruction.
 As each instruction is executed, the program counter register is updated so
that it contains the address of memory location where the next instruction to
be executed is stored.
4. Memory address register (MAR)
 This contains the address of the data.
 The Memory Address Register (MAR) that either stores the memory address
from which data will be fetched to the CPU or the address to which data will
be sent and stored.
 MAR holds the memory location of data that needs to be accessed.
5. Instruction register (IR)
 Instruction register (IR) stores the address of the next instruction currently
being executed or decoded.
6. General-purpose registers
 These may serve as temporary storage of data or address and be used in
operations involving transfer between other registers.
7. Stack pointer register (SP)
 The contents of this register form an address which defines the top of the
stack in RAM.
 The stack is a special area of the memory in which program counter values
can be stored when a subroutine part of a program is being executed.

MEMORY UNIT
There are different types of memory segments being used by the CPU.
a. ROM:
From this memory unit, CPU can only read the stored data. No writing operations
can be done in this part of memory. Thus it is used to store the programs that need
no alteration or changes like Monitor Program or Keyboard driver etc.
b. PROM:
The term programmable ROM is used for ROM chips that can be programmed by
the user
c. EPROM:
The term Erasable programmable memory is used for ROM that can be programmed
and their contents altered

16
d. EEPROM:
Electrically erasable PROM is similar to EPROM.
Erasure is by applying a relatively high voltage rather than using ultraviolet light.
e. RAM
Temporary data, i.e. data currently being operated on, is stored in a read/write
memory referred to as a random-access memory.

INSTRUCTION EXECUTION:
Time required for instruction execution involves two cycles
• Fetch cycle/ execute cycle:
 In this cycle, the instruction addressed by the content of PC is read
from the memory and loaded in instruction register.
 After each fetch, the microprocessor increments the program
counter by one.
 The instruction can then be decoded and used to execute an
operation.
 This sequence is known as fetch cycle
• Write cycle
 The operation of writing data into a memory or storage device.
 Write cycles are also called program/erase (P/E) cycles.
BUS
Digital signals move from one section to another along paths called buses.
Interrupts
An interrupt is a condition that causes the microprocessor to temporarily work on a
different task, and then later return to its previous task.

17
Intel 8085A microprocessor Architecture

[Or the next figure]

18
MICROCONTROLLER

Fig: Block diagram of a microcontroller

19
 The microcontroller is the integration of microprocessor with memory and
input/output interfaces and other peripherals such as timers on a single chip.
 The general microcontroller has pins for external connections of inputs and
outputs, power, clock and control signals
 The pins for the inputs and outputs are grouped into units called input/output
ports.
 Examples: Motorola 68HC11, Intel 8051 and PIC16C6x/7x are examples of 8
bit microcontrollers. Motorola 68HC16 is an example for 16 bit
microprocessor.

Difference Between Microprocessor & Microcontroller


Microprocessor
 A microprocessor requires an external memory for program/data storage.
 Instruction execution requires movement of data from the external memory to
the microprocessor or vice versa.
 Usually, microprocessors have good computing power and they have higher
clock speed to facilitate faster computation.
Microcontroller
 A microcontroller can be thought of a microprocessor with inbuilt peripherals.
 A microcontroller does not require much additional interfacing ICs for
operation and it functions as a stand alone system.
 The operation of a microcontroller is multipurpose.
 Microcontrollers are also called embedded controllers.
 A microcontroller clock speed is limited only to a few tens of MHz.
 Microcontrollers are numerous and many of them are application specific.

Classification/Development of Microcontrollers

20

S-ar putea să vă placă și