Questionnaire MICROPROCESSOR PART 1 UNIT 1 and 2
Questionnaire MICROPROCESSOR PART 1 UNIT 1 and 2
Questionnaire MICROPROCESSOR PART 1 UNIT 1 and 2
Solution:
Q2 What is address bus, data bus and control bus in microprocessor based
systems?
Solution:
System Bus –wires connecting memory & I/O to microprocessor.
Address Bus • Unidirectional
• Identifying peripheral or memory location
Data Bus • Bidirectional
• Transferring data
Control Bus • Synchronization signals
• Timing signals
• Control signal
Q4 How many address lines, data lines are available on memory chip having size
of 16Kx8?
Solution:
16K x 8= 214x8
Address lines-14
Data lines-8
Solution:
• Multiplexing is used to reduce the number of pins and to reduce chip
area.
• The address bus has 8 signal lines A8-A15 which are unidirectional and
other eight address lines are multiplexed(Time shared) with 8 data
lines So the bits AD0 –AD7 In 8085 microprocessor are bi-directional
and serve as A0 –A7and D0 –D7at the same time.
• During the execution of the instruction, these lines carry the address
bits during the early part, then during the late parts of the execution,
they carry the 8 data bits.
• In order to separate the address from the data, we can use a latch to
save the value before the function of the bits changes and using ALE to
enable the latch.
• The higher order bits of the address remain on the bus for three clock
cycles however lower order bits remain only for one clock cycle.
• To make sure we have the entire address for first three clock cycles, we
will use an external latch 74LS373 to save the value of AD0-AD7 when
it is carrying the address. ALE signal is used to enable the latch.
Solution:
• 8-bit general purpose µp
• Capable of addressing 64 k of memory
• Has 40 pins • Requires +5 v power supply
• Can operate with 3 MHz clock
• 8085 upward compatible
Solution:
o
o : Active low read control signal: This signal indicates selected memory or I/O
device is to be read and data is available on data bus.
o : Active low write control signal: This signal indicates data on data bus is to
be written to selected memory or I/O device.
o ALE: Address Latch Enable: This signal is used to demultiplex Address/ Data
bus.When microprocessor starts an operation it makes ALE signal high to
indicate address is available on address bus and then ALE gets low to indicate
this bus is used as data bus.
• Power and frequency signal:
o VCC: +5V Power supply
o Vss: Ground
o X1 X2 :A crystal of frequency 6MHz is connected cross X1, X2 pins and it is
divided by microprocessor internally to be operated at 3MHz frequency.
o CLK(OUT): This can be used as system clock for other devices.
• Externally Initiated Signals
There are five interrupt signals that can be used to interrupt a program
TRAP, RST7.5, RST 6.5, RST 5.5, INTR.
o TRAP : Non-maskable interrupt and has highest priority
o INTR: General purpose interrupt and least priority interrupt.
o RST 7.5, RST 6.5, RST 5.5 : Restart interrupt: vectored interrupt that transfers
the control to specific memory location. Priority of RST 7.5 is highest then RST
6.5 and then RST 5.5.
o Hold: This pin is used by DMA (Direct Memory Access)Controller to request
microprocessor to release their buses.
o Ready:This pin is used to synchronize microprocessor with slow peripherals.
When READY is low microprocessor is in wait state and waits for slow peripheral
to accept or receive data.
• Acknowledgement Signals:
o : Interrupt Acknowledgement Signal:This signal is used to acknowledge
the interrupt.
o HLDA: This signal is used to acknowledge the hold request.
.
Q10 Write the format for flag register and explain each flag bit. Determine the
final status of flag register and contents of accumulator register after
execution of following program:
MVI A, 28H
INR A
XRA A
ADI 48H
ADD A
HLT
Solution:FlagRegister:
ZERO FLAG (Z): This flag is set to a 1 by the instruction just ending if the A Register
contains a result of all 0’s. Besides the obvious mathematical applications, this is
useful in determining equality in a compare operation (a value subtracted from a
second value with an answer of 0), or in logical AND or OR operations where the
result left the A Register with no bit set to a 1 (the AND was not satisfied). If any bits
were left set to a 1 in the A Register, the flag will be reset to a 0 condition.
SIGN FLAG(S): This flag is set to a 1 by the instruction just ending if the leftmost, or
highest order, bit of the A Register is set to a 1. The leftmost bit of a byte in signed
arithmetic is the sign bit, and will be 0 if the value in the lower seven bits is positive,
and 1 if the value is negative.
PARITY FLAG(P): This flag is set to a 1 by the instruction just ending if the A Register
is left with an even number of bits set on, i.e., in even parity. If the number of bits in
the A Register is odd, the bit is left off. This may be useful in I/O operations with
serial devices, or anyplace that error checking is to be done.
CARRY FLAG (CY): This flag is set to a 1 by the instruction just ending if a carry out of
the leftmost bit occurred during the execution of the instruction. An example would
be the addition of two 8-bit numbers whose sum was 9 bits long. The 9th bit would
be lost, yielding an erroneous answer if the carry bit was not captured and held by
this flag. This flag is also set if a borrow occurred during a subtraction or a compare
operation.
AUXILIARY CARRY FLAG (AC): This flag is set to a 1 by the instruction just ending if a
carry occurred from bit 3 to bit 4 of the A Register during the instruction’s execution.
Because of the relationships of decimal in pure BCD to hexadecimal coding, it is
possible to bring BCD values directly into the A Register and perform mathematical
operations on them. The result, however, will be as if two hex characters are being
processed. If the result must be returned to the program as BCD rather than as hex,
the Decimal Adjust Accumulator (DAA) instruction can make that translation; the
Auxiliary Carry Flag is provided to assist in this operation.
MVI A, 28H
INR A
XRA A
ADI 48H
ADD A
HLT
Status of Accregister : 90H
Flag register: S = 1, Z = 0, AC = 1, P = 1, CY = 0
Q11 What do you mean by instruction cycle, machine cycle and T-state?
(a)Draw the timing diagram for MVI B,49H of 8085 microprocessor.
(b) Draw timing diagram for MOV A,B
(c)Draw the timing diagram for IN C0H of 8085 microprocessor.
(d)Draw the timing diagram for OUT C0H of 8085 microprocessor.
Solution:
(a) Timing Diagram MVI A, 49H
Solution:
MEMORY
A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 ADDRESS
1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 8800 H
1 0 0 0 1 0 0 0 1 1 1 1 1 1 1 1 88FF H
Q14 Draw interfacing of 8085 microprocessor with 2KB ROM memory in 8355
CHIP. Give its address range illustrating address decoding table.
MEMORY
A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 ADDRESS
1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 8800 H
1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 8FFF H
̅̅̅̅̅&𝑾𝑹
(𝒊)𝑹𝑫 ̅̅̅̅̅(𝒊𝒊)𝑨𝑳𝑬(𝒊𝒊𝒊)𝑯𝑶𝑳𝑫(𝒊𝒗) 𝑰𝑶/𝑴
̅ (𝒗)𝑰𝑵𝑻𝑨
̅̅̅̅̅̅̅̅ (𝒗𝒊)𝑹𝑬𝑺𝑬𝑻𝑰𝑵
̅̅̅̅̅̅̅̅̅̅̅̅̅̅
Solution:
1
JMP-jump unconditionally JMP 2050 3 3 10 Direct
JC- Jump conditionally, checks the
condition, if condition is true means
2
carry =1, then goes to specified
address else goes to next instruction JC 4000 3 2/3 7/10 Direct
JNC- Jump conditionally, checks the
condition, if condition is true means
3
carry =0, then goes to specified
address else goes to next instruction JNC 4500 3 2/3 7/10 Direct
JP- Jump conditionally, checks the
condition, if condition is true i.e. S=0
4 means positive, then goes to
specified address else goes to next
instruction JP 2050 3 2/3 7/10 Direct
JM- Jump conditionally, checks the
condition, if condition is true i.e. S=1
5 means negative, then goes to
specified address else goes to next
instruction JM 2600 3 2/3 7/10 Direct
JZ= Jump conditionally, checks the
condition, if condition is true means Z
6
=1, then goes to specified address
else goes to next instruction JZ 2100 3 2/3 7/10 Direct
JNZ- Jump conditionally, checks the
condition, if condition is true means Z
7
=0, then goes to specified address
else goes to next instruction JNZ 3500 3 2/3 7/10 Direct
JPE= Jump conditionally, checks the
condition, if condition is true i.e.
8 parity is even means P=1, then goes
to specified address else goes to next
instruction JPE 4800 3 2/3 7/10 Direct
JPO- Jump conditionally, checks the
condition, if condition is true i.e. prity
is odd means P=0, then goes to
specified address else goes to next
9 instruction JPO 4600 3 2/3 7/10 Direct
CALL – Call unconditionally- program
sequence is transferred to subroutine
10 with 16 bit address specified . CALL 6500 3 8 18 Direct
RET-After executing interrupt service
routine, program sequence is
transferred from subroutine to calling
11 program RET 1 3 10 Implicit
Machine Addressing
S.No. Operation Example No. of Bytes T- State
Cycle Mode
1 EI-Enable interrupt EI 1 1 4 IMPLICIT
2 DI-Disble interrupt DI 1 1 4 Implicit
3 NOP- No operation NOP 1 1 4 Implicit
4 HALT HALT 1 1 4 Implicit
Q17. What is an Interrupt? Solution: Interrupt is a process where an external device can
get the attention of the microprocessor.
Classification of Interrupts
•Maskable Interrupts are the Interrupts that can be delayed or Rejected or ignored.
•Non-Maskable Interrupts are the interrupts that can not be delayed or Rejected or ignored.
→Interrupts can also be classified into:
•Vectored interrupts are the interrupts in which the address of the service routine is hard-
wired.
•Non-vectored interrupts are the interrupts in which the address of the service routine needs
to be supplied externally by the device.
The 8085 has eight software interrupts from RST 0 to RST 7 The vector address for these
interrupts can be calculated as follows.
(1)TRAP (2) RST 7.5 (3) RST 6.5 (4) RST 5.5
(5)INTR
Q19. Illustrate Interrupt structure of 8085 microprocessor. Also differentiate among all
interrupts of 8085 microprocessor.
Solution:
Q20.Explain SIM and RIM instructions with their Control Word Format. Also write a
program to enable RST 6.5 Interrupt and disable 5.5 and 7.5 interrupt.
Solution:
SIM:Set Interrupt Mask: This instruction takes the bit pattern in the Accumulator and applies
it to the interrupt mask for enabling and disabling the specific interrupts.
To reset RST7.5
Loads the accumulator with an 8-bit pattern showing the status of each interrupt pin and
mask. Also it is used for serial data input.