what is microprocessor? · pdf file1969 4004 4 4 - - 1977 8085 8 8 16 64kb 1978 8086 ... used...
TRANSCRIPT
Chapter 1: Basics of Microprocessor
What is Microprocessor?
A Microprocessor is a multipurpose programmable logic device which reads the
binary instructions from a storage device called ‘Memory’ accepts binary data as input and
process data according to the instructions and gives the results as output. So, you can
understand the Microprocessor as a programmable digital device, which can be used for both
data processing and control applications.
Q. Describe the evolution of microprocessor with suitable examples. [W-09, W-10, S-10]
Answer:
Year Name Size Bit Size Data bus Address
bus
Address
Space
1969 4004 4 4 - -
1977 8085 8 8 16 64KB
1978 8086 16 16 20 1 MB
1982 80286 32 32 24 16 MB
1985 80386 32 32 32 4 GB
1989 80486 32 32 32 4 GB
2000 Pentium 64 64 36 64 GB
Q. State Silent features of 8085 Microprocessor.
Answer:
8 Bit CPU
3‐6Mhz
Simpler design: Single Cycle CPU
Provide 5 level hardware interrupts and 8 software interrupts
40 Pin Dual line Package
16 bit address
6 registers: B, C, D, E, H, L
Accumulator 8 bit
Requires a single +5Vsupply
Provide 74 instructions with five addressing modes
It can access up to 64 KB memory
Chapter 1: Basics of Microprocessor
Q. Draw neat labeled architecture of 8085 indicating different Signals [W-09, S-10]
Answer:
Q. State function of ALU, Accumulator, and Temp. Register and Flag Register [W-08,
10 S - 09]
Answer:
1. ALU (Arithmetic Logic Unit)
Chapter 1: Basics of Microprocessor
The ALU performs all the arithmetic and logical operations like addition, subtraction,
complementing, logical AND, logical OR, logical Exclusive OR, incrementing and
decrementing, rotate, shift and clear. An ALU is made of many logic gates and adders etc.
The arithmetic and logic unit consists of the following units. ALU uses the 8 bit temporary
register and accumulator. After performing operation result is stored into accumulator only.
2. Accumulator It is an 8-bit register which is treated as a special function register. Most of the
arithmetic and logic operations are performed using this accumulator. All the I/O data
transfers between 8085 and I/O devices are performed via accumulator. One of the operands
for arithmetic operations in ALU is from the accumulator. After performing the arithmetic
operations the result is stored back in accumulator. It is from the accumulator only, the data is
sent out to an output device. Similarly, the data from an input device is read only through the
accumulator. The data in the accumulator alone can be rotated or shifted. No other register
can be used for these operations. Certain instructions like DAA are performed using only
accumulator. So, many times the Accumulator register is treated as a default register.
3. Temporary Register This is an 8-bit register which is not accessible to the user. This register is used by the
microprocessor to load the second operand during arithmetic/logical operations in ALU. The
final result is stored in the Accumulator and the flags are set or reset according to the result of
the operation.
In arithmetic and logical operations, that involve two operands, the accumulator
provides one operand. The other is provided by the temporary register. For example in ADD
C instruction C register contents are moved to the Temp. Register and the addition of A and
Temp. Register contents is performed by the ALU.
4. Flag Register
The flag register is an 8- bit register which generally reflect data conditions in the
accumulator with certain exceptions. Hence this flag register is also known as Status register.
Though this flag register is an eight bit register, it contains only 5 flag bits and the remaining
three bits are undefined as shown figure.
Chapter 1: Basics of Microprocessor
S - Sign Flag: After execution of an arithmetic and logic operation, if bit D7 of the result
(Normally in the Accumulator) is 1, the sign flag is set. This Flag is used with signed
numbers. For example in a given byte, if D7 is 1, the number is treated as a negative number.
Else (if it is zero), it is viewed as a positive. In arithmetic operations with signed numbers bit
D7 is reserved for indicating the sign and the remaining seven bits are used to denote the
magnitude of the number.
Z – Zero Flag: This Flag is set (made 1) if the result after any arithmetic operation is zero,
and the flag is reset (made 0) if the result is not zero. So, this flag is set or reset based on the
results in the accumulator as well as in the other registers.
AC – Auxiliary Carry Flag: In this arithmetic operation, when a carry is generated by and
passed on to bit 4, the AC flag is set. This flag is used internally for BCD arithmetic and is
not available for the programmer to change the sequence of a program with a jump
instruction. But the Z and CY flags can be used for this purpose.
P – Parity Flag: If the result after an arithmetic and logical operation has an even number of
1s, this parity flag is set to 1 otherwise (if number of 1s is odd) the flag is reset (made0).
For example the data byte 10111101 has even parity and the data byte 10011011 has odd
parity. So P bit=0.
CY- Carry Flag: After an arithmetic operation, like addition, subtraction if there exists a
carry or barrow, this flag CY is set to 1 else it is reset (made0)
Q. List all registers of 8085 microprocessor and categories them into 8 bit and 16 bit
register. [W-09]
Q. Describe the register organization of 8085 microprocessor. [S-11]
Answer: 1. Temporary Register: The Temporary registers are temporary data registers, W
register and Z register. All are 8-bit registers. The temporary data register is associated with the ALU
operations. One of the operand is stored in this register. This is not accessible to user. Similarly W and
Z are also temporary registers used to hold 8-bit data during execution of certain instructions. As these
registers are internally used by the CPU, they are not accessible to the user. The W and Z registers are
used by the processor during CALL instruction. When a CALL instruction is encountered in any
program, the current Program counter (PC) contents are pushed on to the stack and the given address
is loaded on to PC. The given address is temporarily stored in W and Z registers and placed on the bus
for the fetch cycle. Thus the program control is transferred to the address given in the instruction.
Another example is, during the execution of XCHG instruction, the contents of H-L pair are
exchanged with D-E pair. At the time of exchange W and Z registers are used for temporary storage
of data.
2. General Purpose Register: B, C, D, E, H and L are six, 8-bit general purpose registers to store
data. These registers can be used as separate 8-bit registers and also can be paired as 16-bit registers to
store the address of a memory location. But they must be paired as B-C; D-E and H-L register pairs
only as shown below. When used as pair, for example B-C, the higher order byte moves to the first
register (B) and the low order byte moves to the second register (C). The H-L pair also functions as a
data pointer or memory pointer For Ex: LXI H, 8500 H. This will load immediately the address of
Chapter 1: Basics of Microprocessor
memory location (8500H) in to H-L pair .Now the H-L pair points to the location 8500 H.
3. Special Purpose Register: The Special purpose registers, as their name indicates, are used for
some specific purpose. The Special purpose registers are Accumulator (A), Flag Register, Instruction
Register (IR), Program Counter (PC) and Stack Pointer (SP).
Accumulator (Register A): It is an 8-bit tri-state register. It is mainly used for arithmetic, logic, load
and store operations. It is also used in I/O operations. In most of operations, the result is stored in
Accumulator after execution.
Stack Pointer: [S-08, S-09]: It is a 16-bit special purpose register which always stores the address
of top of the Stack. I.e. it always points to top of the Stack. Stack is a part of the memory location
used to store the data temporarily. A stack works on Last in First out (LIFO) basis. As the Stack
pointer always points to the top of the Stack, only top of the Stack of the memory can be accessed.
When a Write operation (PUSH) takes place, the contents of the stack pointer is decremented by two
so that the SP points to the new location. Similarly when the Read operation (POP) occurs, the Stack
pointer is incremented by two to point to the next data on top of the Stack.
Program Counter: [S-08, S-09]: It is a 16-bit special purpose register, which stores the
address of the next instruction to be fetched or executed. The execution of a program is
initiated by loading the PC by the address of the first instruction of the program. Once the
first instruction is executed, the PC is automatically incremented to point to the next
instruction unless a jump to some specific address occurs. This process is repeated till the last
instruction of the program.
In case of JUMP or CALL instructions, current address is stored in the Program
Counter. The processor then fetches the next instruction from the new address specified by
the JUMP or CALL instruction. In conditional JUMP and conditional CALL instructions, if
the condition is not satisfied, the processor increments the Program Counter by three so that it
points the instruction followed by the conditional JUMP or CALL instruction. Otherwise the
processor fetches the next instruction from the new address specified by JUMP or CALL
instruction.
Q. Some Important point [study it. It may be asked in exam]
Increment/ Decrement Address Latch: This is a 16 bit special register not accessible to the
user. This register is used by the CPU to increment/ decrement the contents of the Stack
Chapter 1: Basics of Microprocessor
Pointer (SP) and increment program counter (PC) during instruction execution. During first T
- state of op code fetch machine cycle (T1) the microprocessor increments the PC register
contents to point to the next location. This increment operation takes place on increment/
decrement register address latch. The 16 bit address that is sent out through AD0-AD7 and A8-
A15 are latched into this register. The address bus AD0-AD7 continues to be available on the
bus after T1 state from this latch.
Address Buffer: This is an 8-bit unidirectional buffer. It is used to drive external higher
order address bus. It is also used to tri-state the higher order address (A8-A15) bus under
certain conditions like reset, hold, and halt and also when address lines are not in use.
Address/Data Buffer: This is an 8-bit bi-directional buffer. It is used to drive multiplexed
address/data bus. It means low order address bus (A7-A0) and data bus (D7-D0). It is also
used to tri-state the multiplexed address/data bus under certain conditions like reset, hold, and
halt and also when A/D bus lines are not in use.
The address and data bus buffers are used to drive external address and data buses
respectively. Due to these buffers the address and data buffers can be tri-stated when they are
not in use. In actual practice, in a microprocessor the driving capacity of the address pins
after the internal buffering may not be adequate. So, there will be external buffer chips also
available.
Serial I/O control:
This control provides two lines SOD (Serial Out Data) and SID (serial In Data) for serial
communication. These lines are used during serial data transmission over long distance
where data is transmitted and received bit by bit. The Serial Output Data (SOD) pin is used
to send data out serially and serial Input Data (SID) pin is used to receive data serially by the
8085 microprocessor.
Interrupt control:
This is an important block related to interrupts. This block is linked to the CPU
through the 8-bit internal data bus. This interrupt control has five interrupt signals. They are
TRAP, RST 7.5, RST 6.5, RST 5.5 and INTR. The control block will take care of enabling
and disabling of these interrupts etc…
8085 Interrupts:
The 8085 microprocessor has five interrupts. They are TRAP, RST 7.5, RST 6.5, RST5.5 and
INTR. Among all these interrupts TRAP has the highest priority and INTR (Interrupt
Request) has the lowest priority. The TRAP is also a non maskable interrupt. The numbers
succeeding the RST (7.5, 6.5, and 5.5) are related to the call locations. The various interrupts,
their locations in the order of highest to lowest priority are given in Table 3.1. Here RST
means RESTART. Among these interrupts INTR is the only non-vector interrupt whereas the
other interrupts are vectored interrupts.
Q. Explain Instruction Register, Instruction Decoder and Timing and Control Unit. [W-
08, S-09, W-10]
Answer:
Chapter 1: Basics of Microprocessor
Instruction Register and Decoder: The instruction register and the decoder are also part of
the ALU. When an instruction is fetched from memory, it is loaded in the instruction register.
The Decoder decodes the instruction and develops the sequence of events to follow. The
instruction register is a 8 – bit special register, but it is not a programmable and is not
accessible to the user. The instruction decoder decodes the instruction at a binary level and
sends the appropriate signals to the control unit.
Timing and Control Unit: This unit of the microprocessor issues necessary timing and
control signals for the execution of instructions. It generates three types of signals namely
status, control and timing signals required for the operation of memory and I/O devices. This
unit with the help of these signals controls the entire operation of the microprocessor and the
peripherals. The signals associated with this unit are two control signals. 𝑅𝐷̅̅ ̅̅ And 𝑊𝑅̅̅ ̅̅ ̅, three
status signals IO/�̅�, S1 and S0 to identify the nature of the operation and one special signal
ALE which indicates the starting of the operation. These signals are explained below in
detail.
Q. Explain System Buses of 8085 Microprocessor. [Only for Knowledge]
Answer:
Address, Data and Control Buses:
Intel 8085 has 16-bit unidirectional address bus which carries the address of memories
and peripheral devices. A bus is nothing but a group of electrical lines used to transmit the
information as electrical signals. So, this 16-bit parallel address bus carries address from
microprocessor to memories/peripherals. Hence it is Uni-directional (because the converse is
not possible). The width of the parallel bus determines how much memory that a
microprocessor can address. The 8085 microprocessor with 16-bit address bus can address a
maximum of 216= 65536=64 KB of memory locations. The size of the address bus is
independent of the size of the microprocessor.
In INTEL 8085 microprocessor, the 8 most significant bits of the address are
transmitted by the high order address bus A8-A15. But the 8 least significant bits of the
addresses are transmitted by Address/Data bus or A/D bus. i.e. the lower order address lines
are multiplexed with the data bus. So, the A/D bus operates in a time shared mode. i.e. the
data and address are sent on the same lines but at different instants of time. A0-A7 will
always have the address during the first T state (T1) of the machine cycle. To DE multiplex
the A/D bus the pin ALE is used. When ALE=1 (high) the A/D bus acts as a lower order
address bus else it acts as Data bus.
The Data bus is a bidirectional bus which is used to send data to and from the
microprocessor. This is also a parallel bus. The size of the data bus determines the size of the
microprocessor. The 8085 microprocessor has 8-bit data bus and hence it is called an 8-bit
microprocessor. This refers to the width of the data bus but not the address bus.
Similarly8086 is a 16-bit microprocessor and its data bus width is 16 bits
INTEL 8085 has Address/ Data bus namely AD7-AD0. i.e. at some instances it acts
as a 8- bit address bus and at other instances it works as a 8-bit data bus. INTEL used this
time multiplexing technique to save the pins. Generally the size of the internal general
purpose registers matches the size of the data bus. Thus, the INTEL’s 8-bit general purpose
registers matches with its 8-bit data bus. The size of the data bus matches the size of the
Chapter 1: Basics of Microprocessor
internal registers, so that all the bits on the bus can at one time come into or go out of any of
the registers.
The control bus of 8085 is a uni-directional bus because the microprocessor alone
sends control signals to memories or peripheral devices. The size of the control bus depends
upon the specific microprocessor. Typical control signals are Read or Write signals. It means
whether the microprocessor operation is a read or writes and whether it is memory or I/O
operation. In addition to this it includes state signals, and address latch enables. A
microprocessor may also have certain additional control signals and such as interrupt signals,
acknowledgement signals and hold signals. But they are not considered as part of control bus
even though they take part in control of microprocessor based systems.
The above three buses that interface the CPU to the system components are combined
known as the System bus.
Chapter 1: Basics of Microprocessor
Q. Draw the Pin Diagram of 8085 microprocessor and explain function of all the pins.
[Important Point]
Answer: The pin diagram of 8085 microprocessor is shown in Fig 5. From the figure it
is clear that it is 40 pin DIP chip. The various pins of 8085 microprocessor can be grouped in
the following categories
Power Supply and Clock pins
Data bus and Address bus
Control and Status signals
Interrupt signals
DMA signals
Serial I/O signals
Power supply and clock pins:
Vcc: +5V power supply
Vss: Ground reference.
X1 and X2: A Crystal (or RC, LC Network) is connected at these two pins. The
internal clock generator divides oscillator frequency by 2, therefore to operate a
system at 3MHZ, the crystal of the tuned circuit should have a frequency of 6MHZ.
CLK (OUT): This signal is used as a system clock for other devices. Its frequency is
half the oscillator frequency
Chapter 1: Basics of Microprocessor
Data bus and Address bus:
AD0-AD7: These lines are Address/Data lines, which are bidirectional with dual
purpose. They are used as the low-order address bus as well as the data bus. During
the first part of the machine cycle (T1), lower 8 bits of memory address or I/O address
appear on the bus. During the remaining part of the machine cycle (T2,T3) these lines
are used as a bi-directional data bus.
A8-A0: These are the upper half of the 16 bit address lines. These lines are exclusively
used for the most significant 8 bits of the 16 bits of the16 bit address bus.
Control and Status Signals:
ALE (Address Latch Enable): This is a positive going pulse generated every time
the 8085 begins an operation. The ALE=High indicates that the bits on AD7-AD0 are
address bits. This signal is mainly used to latch the low order address from the
multiplexed bus and generate a separate set of eight address lines (A7-A0)
𝑹𝑫̅̅̅̅̅ (Read): This is an active low read control pin. This signal indicates that the
selected I/O or memory device is to be read and data are available on data bus.
𝑾𝑹̅̅ ̅̅ ̅ (Write): This is an active low write control pin. It indicates that the data on the
data on the data bus are to be are to be written into a selected memory or I/O location
IO/�̅�: This is a status signal used to differentiate between IO and memory operations.
When it is high, it indicates an I/O operation and when it is low, it indicates a
memory operation. This signal is combined with 𝑅𝐷̅̅ ̅̅ and 𝑊𝑅̅̅ ̅̅ ̅ signals to generate I/O
and memory control signals.
S1 and S0: These are status signals and they indicate the type of machine cycle in
progress during execution of an instruction.
SN IO/M S1 S0 Status
1 0 1 1 Op-code Fetch
2 0 1 0 Memory Read
3 0 0 1 Memory Write
4 1 1 0 I/O Read
5 1 0 1 I-O Write
6 1 1 1 Interrupt Acknowledge
READY (Input): Through this pin, the microprocessor will know whether peripheral
device is ready or not for data transfer. If the device is not ready the processor waits.
So, this pin helps to synchronize slow devices to the microprocessor.
Chapter 1: Basics of Microprocessor
Interrupt signals:
INTR (Interrupt Request): This is used as a general purpose interrupt. It has a
lowest priority and it is the only non-vectored interrupt.
RST 7.5: It is a restart interrupt pin. It has higher priority than RST 6.5, RST5.5 and
INTR. It is a maskable vectored interrupt.
RST 6.5 and RST5.5: These two are maskable vectored interrupt with higher priority
than INTR.
TRAP: It is a non-maskable vectored interrupt. It has higher priority.
𝑰𝑵𝑻𝑨̅̅ ̅̅ ̅̅ ̅̅ (Output): It is an active low interrupt acknowledge pin. This will acknowledge
the receiver of interrupt request to the peripheral device.
DMA Signals:
Hold: This pin is used during the Direct Memory Access. A high on this pin indicates
that, a peripheral like DMA controller is requesting the use of address and data buses.
HLDA (Output): A high on this p in acknowledges the hold request from peripheral.
RESETIN̅̅ ̅̅ ̅̅ ̅̅ ̅̅ ̅̅ : It is an active low signal. When the signal on this pin goes low, the system
is in reset i.e. the program counter is set to zero, the address & data buses are tri-
stated.
RESETOUT: This signal is used to Reset other devices in microprocessor system.
Serial input/ Output signals:
SID: Serial input Data is a pin through which serial data are brought into the
microprocessor accumulator after the RIM instruction is executed.
SOD: Serial output Data pin is used by the microprocessor to output data serially to the
external devices. Serial data is sent out of the microprocessor by executing SIM instruction.
The most significant bit of accumulator should have the serial bit and D6 bit of the
accumulator must be made high to enable the serial data transfer.
Q. Explain de-multiplexing of address and data bus? Which signal is used to de-
multiplex the address/data bus with reference to 8085 microprocessor? [W-08]
answer: In the 8085 16 bit address bus are available from that higher order 8 bit address line
i.e. A8-A15 are directly available, but lower order 8 bit address bus are multiplexed with data
bus i.e. AD0-AD7. Hence de-multiplexing is required i.e. separation of address and data bus.
De-multiplexing of address/data bus can be implemented by using tri-state octal latch
74LS37 and this latch can be controlled by using ALE (address Latch Enable) signal of 8085.
When ALE goes high, then lines are used as address lines and when it goes low, then lines
are used as data bus.
Q. State the limitation of 8085 Microprocessor [S-09]
Chapter 1: Basics of Microprocessor
Answer:
Arithmetic operation can be done only on 8 bit data.
Only 64KB address space
For de-multiplexing of address/data bus, extra hardware is required.
Absence of pipelining
Limited flags
Limited interrupts
Cannot design multiprocessor system.
No memory management unit.
Q. Explain Difference between Non-Maskable and Maskable Interrupts [W-08, W-10,
S-11]
Answer:
Non-Maskable interrupts (NMI) Maskable Interrupts (MI)
Cannot be avoided by microprocessor Can be avoided by microprocessor
Always edge as well as level triggered May be either edge or level triggered
Response time is fast Response time is low
No instruction is available for masking Instruction are available for masking
NMI of 8086 INTR of 8086