Mpi 11002
Mpi 11002
: ________
Enrolment No.___________
Subject Code:2141001
Subject Name:Microprocessor and Interfacing
Time:10:30 AM to 01:00 PM
1.
2.
3.
Date:30/05/2016
Total Marks: 70
Instructions:
Attempt all questions.
Make suitable assumptions wherever necessary.
Figures to the right indicate full marks.
------------------------------------------------------------------------------------------------------------------Reference Book:
B1) Title: Microprocessor Architecture, Programming, and Applications with the 8085
Auther: Ramesh Gaonkar
Publication: PENRAM (PRI)
Edition: 6th
B2) Title: Microprocessor and Interfacing
Auther: Douglas V Hall
Publication: Mc Graw Hill
Edition: Revised Second Edition.
PAPER SOLUSION
MARKS
Q.1
Short Questions
14
1
What is the use of bidirectional buffer in 8085?
Ans.1.
Bidirectional 8-bit buffer i.e. Data bus buffer is used to interface the 8259A to
the 8085 data bus. Control words and status information are transferred through
the data bus buffer.
2
Define the function of parity flag in 8085.
Ans.2. Parity flag is used to indicate the parity of result. If lower order 8-bits of the
result contains even number of 1s, the Parity Flag is set to one and for odd
number of 1s, the Parity Flag is reset i.e. zero.
3
What is clock signal?
Ans.3. The "clock" is the heart beat of any processor...
The processor executes one thing at "a time": the time is given by the clock.
The clock is just an oscillator running 0,1,0,1,0... Each time the clock changes
level, the processor executes ONE instruction.
4
Define machine cycle.
Ans.4. Machine cycle is defined as the time required completing one operation of
accessing memory, I/O or acknowledging an external request.
Ans.6.
SP: 2FFE
7
Ans.7.
Ans.8.
Ans.9.
10
Ans.10. If memory has 8192 memory locations, then 13 address lines are
required.
11
If the memory size is 256 x 1 bits. How many chips are required
to make up-to 1 Kbyte of memory?
Ans.11. For 1Kbyte of memory 4 numbers of memory size is required of
256 x 1 bits memory sizes each.
12
What is the total number of T-States required to execute below program.
MVI C,05H
Back: DCR C
JNZ Back
MVI C, 05 H
BACK DCR C
JNZ BACK
7 T-States
4 T-States
10 T-States
The first instruction initializes the loop counter and is executed only once
requiring only 7 T-States.
The following two instructions form a loop that requires 14 T-States to
execute and is repeated 32 times until C becomes 0.
Tdelay= TO+ TL
TO= 7 T-States Delay of the MVI instruction
13
TL= (14 X 32) -3 = 445 T-States 14 T-States for the 2 instructions repeated 32
times (0516= 3210) reduced by the 3 T-States for the final JNZ.
Tdelay= TO+ TL
= 7 + 445
= 552
Which interrupt has the highest priority?
Q.2.
(a)
Describe the instruction with example and also show the contents of
Register / memory locations before and after execution of instruction:
XTHL
Ans.
XTHL :
03
Exchange HL with top of stack
The contents of L register are exchanged with the location pointed out by the contents of
the SP.
The contents of H register are exchanged with the next location (SP + 1).
Q.2. (b)
04
Show the diagram to generate control signal using NAND gate in 8085.
Ans.
Generating Control signals: The Mp provides RD and WR signals to initiate read and
rite
cycle. Because these signals are used both for reading / writing memory or
reading writing an input/output device, it is necessary to generate separate read and write
signals for memory and I/O devices. 8085 provides IO/M signal to indicate that initiated
cycle is for I/O
device or for memory device. Using IO/M signal along with RD
and WR, it is possible to generate four signals shown below.
MEMR (Memory Read)
: To read data from memory
MEMW
(Memory Write)
: To write data in memory
IOR (I/O Read)
: To read data from I/O devices
IOW (I/o Write)
: To write data in I/O devices.
We know that for OR gate, When the both inputs are low then only output is low. The
signal IO/M signal goes low for memory operation. This signal is logically OR-ed with
RD and WR to get MEMR and MEMW signals. When both RD and IO/M signals go
low, MEMR signals in goes low. Similarly when both WR and ME/MW signal goes low.
To generate IO/R and IO/W signals for I/O operation, IO/M signal is first inverted and
then Logically OR-ed with RD and WR signals.
2) Memory Write
3) IO Read
4) IO Write
Q.2 (c) Write 8085 assembly language program for Modulo-10 down counter. After count
00H, the count should go back to repeat the sequence. Provide 1 Sec delay between
count and display the count at an output port 01H. The clock frequency is 1 MHz.
Show timing calculations assuming suitable value of T states for various
instructions.
Ans.
Q.2 (c) Write 8085 assembly language program to perform the following, a2 + b2,
where a and b are 8-bit binary numbers.
MVI B, Data#1
MOV C, B
MVI D, Data#2
MOV E,D
XRA A
Again: ADD B
DCR C
JNZ Again
07
MOV H, A
XRA A
Loop: ADD D
DCR E
JNZ Loop
ADD H
content H
STA 4200H
Q.3
(a)
Sr.
No.
IO is treated IO.
IO is treated as memory.
10
Ans.
Q.3. (b)
03
be
Show only memory map for the 8085 microprocessor such that it should
contain 8 kbyte of EPROM and 8 kbyte of RAM.
04
8Kbyte of EPROM and 8Kbyte of RAM required 13 address line. (213= 8192 =
8Kbyte)
Memory
ICs
Starting
address
of 8KB
0000H
1FFFH
2000H
3FFFH
EPROM
End
address
of 8KB
EPROM
Starting
Address
of 8KB
RAM
End
address
of 8KB
RAM
Q.3
(c)
07
OR
Q.3
(a)
03
Starting
address
of
0000H
03FFH
2000H
23FFH
EPROM
End
address
of
EPROM
Starting
Address
of RAM
End
address
of RAM
Memory
ICs
Starting
address
of
0000H
03FFH
8000H
83FFH
EPROM
End
address
of
EPROM
Starting
Address
of RAM
End
address
of RAM
Q.3
(b)
Draw memory system and show memory map for the microprocessor 04
system such that it should contain 2 kbyte of EPROM and 2 kbyte of
RAM with starting addresses 0000H and 6000H
Ans.
EPROM ans RAM are of size 2Kbyte, so it required 211=2048 =2Kbyte, 11 address
lines.
Memory Map:
Memory
ICs
Starting
address
of 2KB
0000H
07FFH
6000H
67FFH
EPROM
0000H
End
address
of 2KB
EPROM
Starting
Address
of 2KB
RAM
6000H
End
address
of 8KB
RAM
Q.3
(c)
07
STA means Store Accumulator -The contents of the accumulator is stored in the
specified address(526A).
The opcode of the STA instruction is said to be 32H. It is fetched from the memory
41FFH(see fig). - OF machine cycle
Then the lower order memory address is read(6A). - Memory Read Machine Cycle
Read the higher order memory address (52).- Memory Read Machine Cycle
The combination of both the addresses are considered and the content from accumulator
is written in 526A. - Memory Write Machine Cycle
Assume the memory address for the instruction and let the content of accumulator is
C7H. So, C7H from accumulator is now stored in 526A.
Q.4
(a)
Draw control word format for Bit Set/Reset for 8255 IC.
03
Ans.
Bit set/reset Mode (BSR Mode).
The Bit Set/Reset (BSR) mode is applicable to port C only. Each line of port C (PC 0 - PC7) can
be set/reset by suitably loading the control word register. BSR mode and I/O mode are
independent and selection of BSR mode does not affect the operation of other ports in I/O mode.
PC0
PC1
PC2
PC3
PC4
PC5
PC6
PC7
Thus, as per the above values, 0B (Hex) will be loaded into the Control Word Register (CWR).
D7 D6 D5 D4 D3 D2 D1 D0
0
Q.4
(b)
Port A as simple input, Port B as simple output, Port CL as output and Port CU as
input. Assume address of the control word register of 8255 as 83H.
Ans.
04
ORA E
JNZ Back
RET
OR
Q.4
(a)
03
Q.4
(b)
Write a BSR control word subroutine only to set PC7 and PC3 and reset
them after 10ms delay. (do not calculate for delay)
04
Ans.
Q.4
(c)
Q.5
(a)
07
Ans. The 8259A is a programmable interrupt controller designed to work with Intel
microprocessor 8080 A, 8085, 8086, 8088.
The 8259 A interrupt controller can
1) Handle eight interrupt inputs. This is equivalent to providing eight interrupt pins on
the processor in place of one INTR/INT pin.
2) Vector an interrupt request anywhere in the memory map. However, all the eight
interrupt are spaced at the interval of either four or eight location. This eliminates
the major drawback, 8085 interrupt, in which all interrupts are vectored to
memory location on page 00H.
3) Resolve eight levels of interrupt priorities in a variety of modes.
4) Mask each interrupt request individually.
5) Read the status of pending interrupts, in service interrupts, and masked interrupts.
6) Be set up to accept either the level triggered or edge triggered interrupt request.
7) Mine 8259 as can be cascade in a master slave configuration to handle 64 interrupt
inputs.
Q.5 (b)
04
Draw and explain the functional block diagram of 8253 timer IC.
07
Ans.
Fig. shows the block diagram of 8253/54. It includes three counters, a data bus buffer,
Read/Write control logic, and a control register. Each counter has two input signals
CLOCK and GATE and one output signal OUT.
(a)
03
Ans.
o 8086 is a 16bit processor. Its ALU, internal registers works with 16bit binary
word
o 8086 has a 16bit data bus. It can read or write data to a memory/port either 16bits
or 8 bit at a time
o 8086 has a 20bit address bus which means, it can address upto 220 = 1MB
memory location
o Frequency range of 8086 is 6-10 MHz
(b)
Ans.
04
07
Ans.
The 8259A is a Programmable interrupt controller designed to work with Intel
microprocessor 8080 A, 8085, 8086, 8088.
The 8259 A interrupt controller can
1) Handle eight interrupt inputs. This is equivalent to providing eight interrupt pins on
the processor in place of one INTR/INT pin.
2) Vector an interrupt request anywhere in the memory map. However, all the eight
interrupt are spaced at the interval of either four or eight location. This
eliminates the
major drawback, 8085 interrupt, in which all interrupts are vectored to memory location
on page 00H.
3) Resolve eight levels of interrupt priorities in a variety of modes.
4) Mask each interrupt request individually.
5) Read the status of pending interrupts, in service interrupts, and masked interrupts.
6) Be set up to accept either the level triggered or edge triggered interrupt request.
7) Mine 8259 as can be cascade in a master slave configuration to handle 64 interrupt
inputs.
Functional Description:
The 8259 A has eight interrupt request inputs, TR2 IR0. The 8259 A uses its INT output
to interrupt the 8085A via INTR pin. The 8259Areceives interrupt acknowledge pulses
from the at its input. Vector address used by the 8085 A to transfer control to the service
subroutine of the interrupting device, is provided by the 8259 A on the data bus. The
8259A is a programmable device that must be initialized by command words. After
initialization the 8259 A mode of operation can be changed by operation command
words from the microprocessor.
Data bus buffer: This 3- state, bidirectional 8-bit buffer is used to interface the 8259A to
the system data bus. Control words and status information are transferred through the
data bus buffer.
Read/Write & control logic: The function of this block is to accept OUTPUT
commands from the CPU. It contains the initialization command word (ICW) register
and operation command word (OCW) register which store the various control formats
for device operation. This function block also allows the status of 8159A to be
transferred to the data bus.
Interrupt request register (IRR): IRR stores all the interrupt inputs that are requesting
service. Basically, it keeps track of which interrupt inputs are asking for service. If an
interrupt input is unmasked, and has an interrupt signal on it, then the corresponding bit
in the IRR will be set.
Interrupt mask register (IMR): The IMR is used to disable (Mask) or enable
(Unmask) individual interrupt inputs. Each bit in this register corresponds to the interrupt
input with the same number. The IMR operation on the IRR. Masking of higher priority
input will not affect the interrupt request lines of lower priority. To unmask any interrupt
the corresponding bit is set 0.
In service register (ISR): The in service registers keeps tracks of which interrupt inputs
are currently being serviced. For each input that is currently being serviced the
corresponding bit will be set in the in service register. Each of these 3-reg can be read as
status reg.
Priority Resolver: This logic block determines the priorities of the set in the IRR. The
highest priority is selected and strobed into the corresponding bit of the ISR during
INTA pulse.
Cascade buffer/comparator: This function blocks stores and compare the IDS of all
8259As in the reg. The associated 3-I/O pins (CAS0-CAS2) are outputs when 8259A is
used a master.
Master and are inputs when 8259A is used as a slave. As a master, the 8259A sends the
ID of the interrupting slave device onto the cas2-cas0. The slave thus selected will send
its pre- programmed subroutine address on to the data bus during the next one or two
successive pulses.