Microprocessor Complete 1
Microprocessor Complete 1
Microprocessor Complete 1
np
Microprocessor: A microprocessor is a multipurpose, 80286- introduced in 1982, 16 bit µp with memory
programmable, clock-driven, register base electronic device, addressing capacity of 16 MB, consists of 68 pin with 6-12.5
that reads binary instruction from storage device called MHZ clock signal.
memory accept binary data and input and process data
according to those instruction and provide result as output. 80386 – introduce in 1985 , 32 bit µ p with 4 GB memory
Microprocessor application can be classified as: addressing capability. Consists of 132 pins with 22 to 33
Reprogrammable system: MHZ clock signal.
- In this microprocessor is used for computing and data 80486- introduced in 1989, 32 bit µp with 4 GB memory
processing. addressing capacity, consists of 168 pin with 26-100 MHZ
- Capable of handing large data, storage devices such as clock signal.
disks and CD Rom and peripherals devices such as Pentium:- introduced in 1993, 32 bit up with 4 GB of
printers. Eg microcomputer. memory addressing capacity consists of 168 pins with 100
Embedded system: and 150 MHZ.
- In this case microprocessor is a part of final product Pentium pro, Pentium II , and Pentium III, was
and is not available for reprogramming to end uses. developed each with 32 bit word length having 150-1000
- Eg washing machine, traffic light controller, MHZ clock signal.
Automatic testing machine.
Evolution of microprocessor: Calculator verses computer:-
4004- introduced in 1971, first 4 bit up having memory - Calculator are dedicated devices and can perform
addressing capability of 1 KB arithmetic and logical operations only. Also calculator
- Consist of 16 pin with clock signal of 750 HZ had to be operated manually for each and every steps
8008- introduced in 1972, 8 bit µp , 40 pin to be followed to solve a problem.
8080- introduced in 1973 , 8 bit µp. The computer are programmable in the sense that
8085- introduce in 1976, 8 bit µp having addressing all state steps needed to solve a problem are fed into main
capability of 64kb,cosists of 40 pin with 3-6 MHZ clock memory as program. Than the computer works on the
signal. previous fed program.
8086 – introduce in 1978, 16 bit µP having addressing - calculator has very less memory capacity in
capability of 1 MB , consists of 40 pins with 5-10 MHZ comparison to the computer.
clock signal. - A calculator has a very small size in comparison to
8088- introduced in 1980, 8/16 bit µp with memory the computer.
addressing capability of 1 MB, consists of 5-8 MHZ clock
signal.
I/P device Memory: This consists of a mixture of ram and Rom. It may
also have magnetic floppy disk, magnetic hard disk or
I/P Port
Control Control Control
bus Memory
optical disk. It's function are :
bus Processing
Unit
RAM & ROM 1. Store the binary codes for the sequences of
instruction and then write a program from that
O/P
device
sequence of instruction for the computer.
Address
bus 2. Store the binary coded data with which the
Fig. Block diagram of microcomputer computer is going to work.
I/P port: The i/p section allows the computer to take in data
Microprocessor: from the outside world or send data to the outside world. Eg
keyboard, video display terminals, printers, modems, etc.
The physical devices used to interface the computer buses
ALU
Registry
memory
to external systems are called ports. Two ports are available
i/p port example keyboard, mouse. O/p port example
monitor , printer.
Control
unit Central processing unit: The cpu control the operation
of computer. Cpu fetches binary coded instruction from
memory. Decode the instruction into a series of actions and
carries out these actions in a sequence of steps. It also
contains the instruction pointer register which hold the
Microcomputer: A small computer that contains address of the next instruction or data item to be fetched
microprocessor is microcomputer. They range from 4-bit from memory.
words that can address a few thousand bytes of memory to
32 bit words and can address billions of bytes of memory. In
Downloaded from www.jayaram.com.np 2 Downloaded from www.jayaram.com.np
Downloaded from www.jayaram.com.np
Address bus: The address bus consists of 16,20,24 or 32 Register array: This area of microprocessor consists of
parallel signal lines. On these lines the CPU sends out the various register identified by B,C, D,E, H, L. These register
address of the memory location that is to be written to or are used to temporary store the data during the execution of
form. a program.
Data bus:The data bus consist of 8, 16 or 32 parallel signal Control Unit: This area provides the timing and control
lines and are bidirectional that CPU can reads data in from signal to all the operations in the microcomputer. It contains
memory and send data out to memory on these lines. the flow of data between the microprocessor memory and
……device in a system will have ……out connected to the peripheral.
data bus but only one device at a time has its out enable.
Control bus: The control bus consists of 4-10 parallel signal Stored Program concept: The task of entering and altering
lines. The CPU sends out signal on the control bus to enable the programs for the ENIAC (electronic numerical integrator
the o/p of the address memory device. Control bus signal are and computer) was extremely tedious. The programming
memory read, write, i/p read, o/p write. concept could be faciliated if the program could represented
in a form suitable for storing in memory along side the data.
Microprocessor: Than a computer could get it's instruction by reading them
form the memory and a program could be set or altered by
setting the values of a portion of memory . This approach is
known stored program concept.
Registry
ALU memory
ALU
Main I/O
memory Equipment
Control
unit
CPU
ALU: This area of microprocessor perform various function Fig: Von-Numann Architecture.
on data. The ALU performs arithmetic operation like
addition subtraction and logical operation like And, OR, X- Main memory is used to store both data and instruction ALU
OR. is capable for performing Arithmetic and logical operation
binary data. The program control unit(cpu) interprets the
Program counter: The program counter acts as a pointer to Serial I/p port: The 8085 has two signals to implement the
the next instruction to be executed and always contains 16 serial transmission SID and SOD. This two signals are used
bit address of the memory location of the next instruction. to transmitting the data serially.
The program counter is updated by the processor and points
to the next instruction after the processor has fetched the Data and address bus: The 8085 has 8 bit data bus and and
instruction. hence 8 bit of data can be transmitted parallel from an to a
Stack pointer: The stack is an area of read write memory in microprocessor . The 8085 has 16 bit address bus as memory
which temporary information is stored in first in last out address are of 16 bit.
basis. The stack pointer holds the address of last byte written - The 8 bit significant bits of the address are transmitted
on to the stack. by AD bus. The AD bus transmits the data and
address at different moments. At a particular moment
Instruction register and decoder: These are not accessible it transfers either data or address.
to the programmer after fetching an instruction from - The 8 most significant bit of the address are
memory the processor load it in the instruction register. This transmitted by address bus A bus.
instruction is decoded by the decoder and the sequence of - First of all the 16 bit data is transmitted by the
events are established for the execution of instruction. microprocessor MSB on the A bus and 8 LSB on the
Downloaded from www.jayaram.com.np 6 Downloaded from www.jayaram.com.np
Downloaded from www.jayaram.com.np
AD bus. Thus the effective 16 bit bus is used for 16 - Does the work of carrying the 8 MSB of the address
bit address. Then data is transfer via AD bus. data.
AD0 – AD7:
8085 Microprocessor unit pin details: - [pins 12 – 19 ] I/O
- It carrys both data and address.
- It carries lower address bits as well as it can be used
+ 5V
as data bus as it can be used as data bus.
1 2
- Carries data of 8 bit.
SID
5 x1 x2
Serial I/O SOD 28
Port 4 A15 ALE (Address latch enable):
TRAP
6
A8 21 - Pin 30, output pin
Externally
RST 7.5
7 19 - It goes high during first clock cycle of a machine
initiated RST 6.5 AD7
signal 8 cycle.
RST 5.5
INTR
9 AD0
12 - When high, AD0 – AD7 is used as address bus.
30 ALE
READY IO/ M :
29 S0
HOLD
39 33 S1 Control and - pin 34, o/p pin
RESET Status signal
36 34 IO/M - Distinguishes whether the address is fir memory or
INTA
External
signal
11 32 RD I/O
HLDA WR
qck 38 3 37 31
- When high the operation is performed between I/O
and µP
- When low the operation is performed between
Reset CLK memory and µp.
OUT OUT
S0 , S1 :
- Pin 29, 33, o/p pin
Intel 8085 contains 40 pins as shown in figure which has
- These are status signals and indicates the type of
- 8 unidirectional address pins (A8 to A15)
operation performed.
- 8 bidirectional multiplexed address/data pins (AD0 to
S0 S1 Operation
AD7)
0 0 HALT
- 11 control output pins
0 1 READ
- 11 control input pins.
1 1 WRITE
- Two power supply pins +5v and ground.
1 1 FETCH (bring info. From the
- A8 – A15 (pin 21 – 28) output
Memory to µP)
Downloaded from www.jayaram.com.np 7 Downloaded from www.jayaram.com.np
Downloaded from www.jayaram.com.np
INTR:
RD : - pin 10 , input pin
- Pin 32, o/p pin - It is an interrupt request signal.
- Controls READ operation. - When it goes high the program counter does not
- When it goes low, the selected memory or I/O device increment its content. The µP suspects its normal
is read. sequence of instruction at hand it goes to the CALL
WR : instruction.
- Pin 31, o/p pin
- A low indicates a write operation being performed INTA:
into the selected memory or I/P device. - pin 11, o/p
- The µP sends as interrupt ack after INTR is received.
READY:
- Pin 35, i/p pin
- It is used to sense whether a peripheral is ready to RST 5.5, RST 6.5, RST 7.5 & TRAP:
transfer data or not. - Pin 9,8 , 7 & 6, input pin
- If READY is high, the peripheral is ready. - These are interrupt signals.
- It is low, the µp waits till it goes high. - When interrupt is recognized, the next instruction is
executed from a fixed location.
HOLD ( when high): - RST 7.5,6.5,5.5 are ……..interrupt.
- pin 39, i/p pin
- It indicates the another device is requesting the use of
buses. Having received a HOLD request the µP stops RESET IN :
the use of the buses as soon as the current instruction - pin 36, input pin.
is completed. The processor regains the bus after the - When signal on this pin is low, the µP is reset.
removal of the HOLD singnal.
RESET OUT:
HLDA: - pin 3, output pin.
- Pin 38, 0/p pin. - This signal indicates that µP is being reset.
- A signal for HOLD ack. - This signal can be used to reset other devices.
- It indicates that the HOLD request has been received.
- After the removal of a HOLD request the HLDA goes X1, X2 :
low. - Pin 1, 2 , i/p pin.
Timing Diagram:
t1 t2 t3
I1 F E1
F2 E2
I2
ALE
RD
Signal Signal
T1 T2 T3 T1 T2 T3
CLK CLK
IO/M IO/M
S0 S1
S1 S0
A8 - A15 A8 - A15
Out In Out In
ALE ALE
RD WR
MVI B, 38 H …….. 7 T
Delay for inst inside the loop, TL = No of T state × T * (N10) Loop2 MVI C, FFH ………7 T
= ( 14× 0.5 × 10-6 ×255) Loop 1 DCR C……..4 T
= 1785 µ sec JNZ loop1 ------10/7 T
Now TLA = TL-3× 0.5 DCR B ------ 4 T
= 1785 – 1.5 JNZ loop2 ------ 10/7 T
= 1.7835 ms
Delay calculation:
Downloaded from www.jayaram.com.np 21 Downloaded from www.jayaram.com.np
Downloaded from www.jayaram.com.np
Count = 140.35
= 8C H
To = 7 * 0.5 = 3.5 µ sec
Q. Write a program to generate a continuous square wave
TL1 = 14 * 0.5 * 255 – 3*0.5
with the period 500 µ sec. Assume the system clock period
TL2 = ( TL1 + 21*0.5) N10 – 3 is 325 µ sec and use bit Do to output the square wave.
- Memory read.
- Memory write.
Address
- Input/ output write.
- Transfer acknowledgement.
- Bus request. Data bus
- Bus grant.
- Interrupt request.
- Interrupt ack. ACK signal
Synchronous Bus: In synchronous bus the occurance of the The above diagram describes the following steps.
events on the bus is determined by a clock. The clock - The CPU issues a START signal to indicate the
transmits a regular sequences of zeroes and one of equal presence of address of control information on bus.
duration. A single zero-one or 1-0 transmission is called - Then it issues memory read signal and places the
clock cycle and defines a time slot. All other devices on the memory address on the address bus.
bus can read the clock live and all events starts at the - The addressed memory module recognizes the address
beginning of clock cycle. and often a delay of one clock cycle it places the data
signals on the buses.
Read Memory:
A memory unit is a collection of storage cells
Address
together with associated circuits needed to transfer
information in out of storage. The memory stores binary
information in groups of bits called words. A memory is a
Master group of 1’s and 0’s and may represent a number, an
synchronous
(MSYNC) instruction code one or more alphanumeric characters or any
Data bus
other binary-coded information. A group of 8 bits is called a
byte. The capacity of memories in commercial computers is
usually stated as the total number of bytes that can be stored.
For 8 bit micro-computer system memory word and
memory byte are the same. A memory word is identified by
- The CPU places the memory read and the address an address. The 8 bit microprocessor uses 16 bit address to
signals on the bus. access memory word. This provides a maximum of 216 =
- After allowing for these two signals to stabilized, it 65536 memory addresses ranging from 0000H to FFFF H.
issues master synchronous signal ( M SYNC) to Thus , the memory capacity for this Micro-computer system
indicate the presence of valid address of control is 64K.
signals on the bus.
- The addressed memory module responds with the data Memory can be classified as non-volatile memory or
and the slave synchronous ( SSYNC). volatile memory. Non-volatile memory retains the stored
data even when there is no power. On the other hand volatile
memory losses its contents when the power is removed. Few
examples are:
The disadvantage is :
- The storage capacitor cannot hold its charge over an
extended period of time and losses the stored data bit
Select line
unless its charge is refreshed periodically.
Q
- This process of refreshing requires additional memory
circuitry and complicates the operation of the dynamic
Cs (storage Capacity) RAM.
The advantage of this types of cell are: Enable (active high) Enable (active low)
1. Very simple , allows very large memory arrays to be
Fig. tri-state buffer
constructed on a chip at a low cost per bit.
Downloaded from www.jayaram.com.np 31 Downloaded from www.jayaram.com.np
Downloaded from www.jayaram.com.np
combination of two buffers in different direction combines
In a micro-compurter systems, peripherals are connected in to form a bi-directional buffer. The bi-directional buffer
parallel between the address bus and data bus. However 47LS245 is a typical example and is used commonly as a
because of tri-state interfacing devices, peripherals do not driver for the data bus.
load the system buses. The microprocessor communicates
with one device at a time by enabling the tri-state line of the Input/Output Output/input
interfacing device. Tri-state logic is critical to proper
functioning of the microcomputer.
7
6
5
A2
4
Input A1 Output
3
2 A0
1
0
When 0 goes low , the output is 000, when the input line 5
goes low the output is 101. Encoder are commonly used
Downloaded from www.jayaram.com.np 33 Downloaded from www.jayaram.com.np
Downloaded from www.jayaram.com.np
I7 . . . . . . . . . . . . . . . . . . . . . . . . . . I0
101
D0
110
001 Fig. serial data transfer
010
101
Transmitter 110 Receiver
001
010
D7 There are tow types of serial transfers. They are:
1. Asynchronous serial data transfer.
2. Synchronous data transfer.
Asynchronous transfer:
Fig. parallel data transfer In this types of transmission, the
receiving device does not need to be synchronized with the
Here, the time required to transfer one word is equal to the transmitting device. The transmitting device can send one or
time taken to transmit a bit. Parallel data transmission is more data units when it is ready to send. Each data unit must
Downloaded from www.jayaram.com.np 38 Downloaded from www.jayaram.com.np
Downloaded from www.jayaram.com.np
be formatted. In other words, each data unit must contain ‘a the transmitter sends out a stop bit which is the idle value (
start bit’ and ‘stop bit(or bits)’ indicating the beginning and logic 1) to indicate the end of transmission.
the end of each data unit . In asynchronous transmission the
data message is sent one word at a time. From
Transmitter data start
To receiver
- When no datas are sent over the time it is maintained stop
bit
D7 D6 D5 D4 D3 D2 D1 D0
at an idle value; a logic 1. bit
a. Listners: These devices can receive data band I/O mapped I/O mode (standard I/O): In this mode, the
control signals from other devices connected to the IO/ M signal of the 8085A is used to distinguish between
bus but are not capable of generating data. e.g I/O read/write and memory Read/write operations. The I/O
printers. device an be accessed during IN and OUT instructions ( a 1
b. Talkers: These devices are only capable of placing byte address is specified in the instruction).
data on the bus and can not receive data. Only one
talker can be active at a given time but fourteen Memory mapped I/O mode: In this mode the IO/M signal
devices can listen at a time. Example for talkers are: output is not used to distinguish between memory and I/O
scanners, tape readers, voltmeters etc. devices. The microprocessor communicates with an I/O
device as if it were one of the memory location. Hence the
I/O devices are address as memory.
Downloaded from www.jayaram.com.np 42 Downloaded from www.jayaram.com.np
Downloaded from www.jayaram.com.np
A0 IOADR
gate (74LS02) goes high to generate on I/O select
AND pulse when both inputs are low(or both signals are
Enable
OISEL asserted).
- Mean while the contents of the accumulator have been
IOR IOW
put on the data bus.
The address lines A7 – A0 are connected to a decoder which - The I/O select pulse is used to activate the latch and
will generate a unique pulse corresponding to each address data are latched and displayed on the diodes.(LEDs)
on the address lines. This pulse is combined with the control
signal to generate a device select pulse. Which is used to
enable an output latch or an input buffer. Interfacing an Input device (DIP switches): The figure
below shows an input interfacing ckt for DIP switches.
Interfacing output display: The figure below shows an
output interfacing ckt for LED display.
Downloaded from www.jayaram.com.np 43 Downloaded from www.jayaram.com.np
Downloaded from www.jayaram.com.np
+5v
SOD: The instruction SIM is necessary to output data
serially from SOD line. It can be interpreted for serial output
A6
0
1
as below:
0 D7
A5 1
0 1
A4
0 1 D7 D6 D5 D4 D3 D2 D0 D1
A3 Octal
Data 1
bus Buffer
0 SOD SDE X
0
E1 E2 E3 0 For interrupts
1 D0
A2
0 3-to-8
A1 Serial
0 decoder IOADR
1= enable SOD
A0 output 0= disable SOD
data
IOR
Interrupt priority: Data transfer between the CPU and an Polled interrupt: Polled interrupt are handled using
I/O device is initiated by the CPU. However , the CPU software and are therefore slower compared to vectored
cannot start the transfer unless the device is ready to (hardware) interrupts. In this method there is one common
communicate with the CPU. The readiness of the device can branch address for all interrupts. The program that takes care
be determined from an interrupt signal. The CPU responds of interrupts begins at the branch address and polls the
to the interrupt request by storing the return address form interrupts sources in sequence. The order in which they are
PC into a memory stack and then the program branches to a tested determines the priority of each interrupt. The highest
service routine that process the required transfer. priority source is tested first, and if its interrupt signal is on,
In micro-computer a number of I/O device are attached to control branches to a service routine for this source. Other
the processor, with each device being able to originate an wise the next lower priority source is tested, and so on.
interrupt request. The first task of the interrupt system is to Thus, the initial service routine for all interrupts consists of a
indemnify the source of the interrupt. There is also the program that test the interrupt sources in sequence and
possibility that several sources will request service branches to one of many possible service routines.
simultaneously. In this case the system must also decide Polled interrupts are very simple . But or large number of
which device to service first. devices, the time required to poll each device may exceed
An interrupt priority is a system that established a the to service the device. In such case, the faster mechanism
priority over the various sources to determine which called chained interrupt is used.
condition is to be serviced first when two or more request
arrive simultaneously. The system may also determine Chained interrupt: This is hardware concept of handling
which conditions are permitted to interrupt the computer the multiple interrupts. In this technique, the devices are
while another interrupt is being serviced. Higher-priority connected in a chain fashion as shown in figure below for
interrupt levels are assigned to request which, if delayed or setting up the priority system.
interrupted, could have serious consequences. Device with
higher speed transfers such as magnetic disks are given high INT
priority, and slow devices such as keyboards receive low Processor Device 1 Device 2 Device 3 Device n
....
priority. When two devices interrupt the processor at the INTA
same time, the processor service the device, with the higher
D0 - D7
priority first.
Downloaded from www.jayaram.com.np 47 Downloaded from www.jayaram.com.np
Downloaded from www.jayaram.com.np
without any external hardware. They do not require INTA
Here the device with he highest priority placed in the fist signal or an input port; the necessary hardware is already
position, followed by lower priority devices. Suppose that implemented inside the 8085. These interrupts and their call
one or more devices interrupt the processor at a time. In locations are:
response, the processor saves its current status and then
generates an interrupt acknowledge (INTA) signal to the TRAP Call location
highest priority device, which is device 1 in our case. If this TRAP 0024 H
device has generated the interrupt it will accept the INTA RST 7.5 003 CH
signal from the processor; otherwise, it will pass INTA on to RST 6.5 0034 H
the next device until the INTA is accepted by the RST 5.5 002C H.
interrupting device.
Once accepted, the device provides a means to the The TRAP has the highest, followed by RST 7.5, 6.5, 5.5
processor for finding the interrupt address vector using and INTR. Figure below shows the schematic diagram of
external hardware. Usually the requesting device responds 8085 interrupts.
by placing a word on the data lines. With the help of
hardware it generates interrupts vector address. This word is
referred to as vector, which the processor used as a pointer INTR:
to the appropriate device service routine. This interrupt is maskable. It can be enabled by
This avoids the need to execute a general interrupt service instruction EI and can be disabled by instruction DI. The
routine first. So this technique is also referred to as vectored INTR interrupt requires external hardware to transfer
interrupts. program sequence to specific CALL locations. There are 8
numbers of CALL-Locations for INTR interrupt. The
hardware circuit generate RST codes for this purpose and
Interrupts of 8085: The 8085 has five interrupts: places that on the data bus externally.
i. TRAP When the microprocessor is executing a program, it
ii. RST 7.5 checks the INTR line (when interrupt enable flip flop is
iii. RST 6.5 enabled using EI instruction) during the execution of each
iv. RST 5.5 instruction. If the line is high and the interrupt is enabled,
v. INTR the microprocessor completes the currents instruction,
disabled the interrupt enable flip flop and sends a INTA
signal. The processor does not accept any interrupt requests
The four interrupts TRAP, RST 7.5, 6.5,5.5 are until the interrupt flip flop is enabled again.
automatically vectored (transferred) to specific locations on
Downloaded from www.jayaram.com.np 48 Downloaded from www.jayaram.com.np
Downloaded from www.jayaram.com.np
The signal INTA is used to insert a Restart (RST) 7 6 5 4 3 2 1 0
instruction, ( it saves the memory address of the next R7.5 MSE M7.5 M6.5 M5.5
SOD SDE X
instruction to the stack. The program is transferred to the cal
location.). The RST instruction and their call locations are :
shift
OUT AD0 - A3 SLo - SL3 R Lo - RL3 CNTL/S TB
OUT B0 -B3
Scan section: The scan section has scan counter and 4 scan
lines (SL0 – SL3). These 4 scan lines can be decoded using a
4- to – 16 decoder to generate 16 lines for scanning.
C/D = 0
RD o r WR
RESET TxRDY CS
CLK Transmit C/D R/w
Read/Write Control TxE con trol C /D= 1 Co ntrol
C/D WR
Control Log ic WR =0 Regi ster
RD
RD Logic
RESET 16
WR CL K
CS
Receive R eceiv er
DSR Buffer RxD
S tat us
DTR Modem R egist er
Control C/D= 1
CST RD = 0
RTS
RxRDY
Receive
Control RxC
SYNDET
CS - Chip select: when signal goes low, 8251A is selected
by MPU for communication.
The control logic interfaces the chip with the MPU. The C / D - control/ data: When this signal is high , control
transmitter section converts a parallel word received from register or the status register is selected. When low data
MPU into serial bits and transmit them over the TXD line to buffer is addressed.
a peripheral. The receiver section receives serial bits from a
peripheral, converts them into a parallel word and transfers CS C/D RD WR Function
back to the MPU. The modern control is used to establish 0 1 1 0 MPU writes inst into control reg
data communication through modems over telephone lines. 0 1 0 1 MPU reads status from status reg.
0 0 1 0 MPU o/ps data to the data buffer
Read/ control logic and registers: This section includes R/W 0 0 0 1 MPU accepts data from data buffer.
control logic , six i/p signals, and 3 buffer registers: data 1 X X X USART is not selected
register, control register and status registers.
Transmitter Section: