Dec 16
Dec 16
Dec 16
Dec - 2016
Paper Code:-EE-309-F
Note : Attempt five questions in all, selecting one question from each Section.
Question No. 1 is compulsory. All questions carry equal marks.
Flowchart
Start
End
Example :
MOV AL, 00011011b
NOT AL ; AL = 11100100b
RET
Flags : all unchanged.
HLT (Halt until interrupt or reset) Instruction :
Mnemonic Halt processing Flags : No flags are affected..
Operation (i) The HLT instruction will cause the 8086 to stop fetching and
executing instructions. The 8086 enters into a half state. To
come out of the halt state, there are 3 ways given below.
(a) Interrupt signal on INTR pin, (b) Interrupt signal on NMI pin
(c) Reset signal on reset pin.
(ii) It may be used as an alternative to an endless software loop in
situations where a program must wait for an interrupt.
Q.1.(c) What is programmable interval timer ? (5)
Ans. There are two types of programmable interval timer are generally used. Intel 8253
is a programmable Interval Timer/Counter which can generate accurate time delays and
waveforms ranging from 0 Hz to 2 MHz using software control. 8254 is its upgraded version
which can operate with higher clock frequency range (DC – 8 MHz) and it is pin to pin compatible
with 8253.
Q.1.(d) Explain direct memory access. (5)
Ans. Direct memory access (DMA) is a feature of modern computers that allows
certain hardware subsystems within the computer to access system memory independently of
the central processing unit (CPU).
Without DMA, when the CPU is using programmed input/output, it is typically fully
occupied for the entire duration of the read or write operation, and is thus unavailable to perform
other work. With DMA, the CPU initiates the transfer, does other operations while the transfer
is in progress, and receives an interrupt from the DMA controller when the operation is done.
This feature is useful any time the CPU cannot keep up with the rate of data transfer, or where
the CPU needs to perform useful work while waiting for a relatively slow I/O data transfer.
Many hardware systems use DMA, including disk drive controllers, graphics cards, network
cards and sound cards. DMA is also used for intra-chip data transfer in multi-core processors.
Computers that have DMA channels can transfer data to and from devices with much less CPU
overhead than computers without a DMA channel. Similarly, a processing element inside a multi-
core processor can transfer data to and from its local memory without occupying its processor
time, allowing computation and data transfer to proceed in parallel.
SECTION – A
Q.2.(a) Define interrupts ? Explain 8085 interrupts. (10)
Ans. Interrupts : The interrupt driven I/O is one of the data transfer techniques used
in the microprocessor systems. By using this techniques, the external device or a peripheral can
inform the processor that it is ready for communication.
82 Microprocessing & Interfacing
RESET
RST
RST
RST
(b) HLDA : This active high signal is used to acknowledge HOLD request.
(vii) Reset signal :
(a) RESET IN : A low on this pin
– Sets the program counter to zero (0000H).
– Resets the interrupt enable and HLDA flip-flops. Before entering any interrupts
service routine we may have to initialize certain passing parameters. Thus it is not desired to
activate interrupts at the RESET time.
– Tri-states the data bus, addres bus and control bus.
– Affects the contents of processor’s internal registers randomly.
On reset, the PC sets to 0000H which causes the 8085 to execute the first instruction
from address 0000H. For proper reset operation reset signal must be held low for at least 3 clock
cycles. The power-on reset circuit can be used to ensure execution of first instruction from
address 0000H.
(b) RESET OUT : This active high signal indicates that processor is being reset. This
signal is synchronized to the processor clock and it can be used to reset other devices connected
in the system.
execution unit gets, the ready instruction in the queue and instruction fetch time is eliminated
(while decoding or executing an instruction EU does not require use of the
buses).
This system has the advantage over the 8085 because, while the EU is executing an
instruction, the BIU is fetching and storing in the queue the next instructions.
The BIU’s instruction queue is based on first in first out (FIFO). So that the EU gets the
instructions for execution in the order they are fetched. If the queue is full and EU does not
request BIU for accessing memory, the BIU does not perform any bus cycle. On the other hand,
if the queue is not full and even through the EU does not request BIU for accessing the memory
the BIU can fill the queue on its own. If the EU interrupts the BIU, the BIU Ist completes the
prefetching and then attains to the service of the EU.
In case of JUMP and CALL instruction, instruction already fetched in queue are of no
use. Hence, in these cases queue is dumped and newly formed by loading instructions from new
address specified by JUMP or CALL instruction.
Execution Unit (EU) : The EU of 8086 tells the BIU from where to fetch instructions
or data, decodes instruction and executes instructions. It contains :
(i) Control Circuitry
(ii) Instruction Decoder
(iii) Arithmetic Logic Unit (ALU)
(iv) Flag register
(v) General purpose registers
(vi) Pointers and Index registers
The central circuitry in the EU directs the internal operation. A decoder in the EU
translates the instructions fetched from memory into a series of actions which the EU performs.
ALU is 6 bit. If can add, subtract, AND, OR, XOR, increment, decrements complement and
shift binary numbers.
More about Queue : In the beginning, the CS : IP is loaded with the required address
from which the execution is to be started. In the initial condition the queue will be empty and the
microprocessor starts a fetch operation to bring one byte (the first byte) of instruction code, if
the CS : IP address is odd, and two bytes at a time, if the CS : IP address is even. The first byte
is a complete opcode in case of some instructions(one byte opcode instructions), the remaining
part of opcode may lie in the second byte. But invariably the first byte of an instruction is an
opcode. These opcodes along with data are fetched and arranged in the queue. When the first
byte from the queue goes for decoding and interpretation, one byte in the queue becomes empty
and subsequently the queue is updated.
(i) The microprocessor does not perform the next fetched operation till at least two
bytes of the instruction queue are emptied. The instruction execution cycle is never broken for
fetch operation. After decoding the first byte the decoding circuit decides whether the instruction
is of single opcode byte or double opcode byte. If the single opcode bytes, the next bytes are
treated as data bytes depending upon the decoded instruction length. Otherwise, the next byte in
the queue is treated as the second byte of the instruction opcode.
90 Microprocessing & Interfacing
(ii) The queue is updated after every byte is read from the queue but the fetch cycle is
entreated by BIU only if at least two bytes of the queue are empty and the EU may be concurrently
executing the fetched instructions. Fig. shows the queue operation.
(b) Segment Registers : The Big Interface Unit (BIU) contains four 16 bit segment
registers. They are :
– Code Segment Register (CS)
– Stock Segment Register (SS)
– Extra Segment Register (ES)
– Data Segment Register (DS)
92 Microprocessing & Interfacing
(c) Instruction Pointer : The instruction pointer register is a 16 bit register which holds
the address of the next code byte that is to be fetched within the code segment. This register
contains the address value which is an offset, because this value must be added to the segment
base address contained in CS register to produce the required 20 bit physical address.
(ii) The Execution Unit : The execution unit of 8086 performs the following major
operations :
– It tells the BIU, from where to fetch instructions or data.
– It decodes and executes instructions.
To perform the above operations, the execution unit consists of the following sections :
(a) Instruction Decoder, ALU and control circuitry.
(b) Flag Register
(c) General Purpose Registers
(d) Stack Pointer Register
(e) Other Pointer and Index Registers
(a) Instruction decoder, ALU and control circuitry : The instruction decoder in the
EU translate instructions fetched from memory into a series of actions which are further carried
out. The Arithmetic and Logic Unit (ALU) of 8086 is of 16 bits which can add, subtract, AND,
OR, XOR, increment, decrement, complement or shift the binary numbers. All internal operations
of EU are controlled by control circuitry.
(b) Flag register : 8086 microprocessor contains one 16 bit flag register (status register).
A flag register is a flip flop which indicates the status of some conditions produced by the
execution of an instruction or controls certain operations of the Execution Unit. In a 16 bit flag
register, there are nine active flags. Six of the nine flag bits are used to indicate some conditions
produced by an instructions. These six flags are called status flag (conditional flags). The remaining
three flag bits in the flag register are used to control certain operations of the processor and are
called control flags.
(c) General purpose registers : The execution unit 8086 contains eight general purpose
registers labelled as AH, AL, BH, BL, CH, CL, DH and DL in the fig. below.
SECTION – C
Q.6.(a) Explain directives and identifiers used in 8086 microprocessor. (10)
Ans. Directives used in assembly language program are as follows :
Directive Action
ALIGN aligns next variable or instruction to byte which is multiple of operand.
ASSUME selects segment register(s) to be the default for all symbol in segment(s)
COMMENT indicates a comment
DB allocates and optionally initializes bytes of storage
DW allocates and optionally initializes doublewords of storage
DD allocates and optionally initializes doublewords of storage
DQ allocates and optionally initializes quadwords of storage
DT allocates and optionally initializes 10-byte long storage units
94 Microprocessing & Interfacing
Q.6.(a) Write a simple assembly program to subtract two memory location, where
each memory location is one byte wide. (10)
Ans. Assembly program :
Instruction Comments
LDA 4201 H ; Content of 4201 H loaded into Accumulator
MOV B, A ; Content of A copied to B register
LDA 4200 H ; Get the minuend in A register
MVI C, 00 H ; Clear C register to account for sign
SUB B ; Get the difference in A register
B.Tech., 5th Semester, Solved papers, Dec -2016 95
Q.7.(b) Write a 8086 assembly language program to find largest number in data
array. (10)
Ans. Program :
0201 BE, 00, 03 MOV SI, 0300H MEMORY ADDRESS IN SI
0204 8B, 0C MOV CX, [SI] COUNT IN CX
0206 B8, 00, 00 MOV AX, 0000 INITIAL VALUE 0000 FOR COMPARISON
0209 46 BCK INC SI INCREMENT SI
020A 46 INC SI INCREMENT SI
020B 3B, 04 CMP, AX, [SI] COMPARE PREVIOUS MAX. WITH
NEXT NUMBER
020D 73, 02 JAE GO JUMP IF NUMBER IN AX IS
GREATER
020F 8B, 04 MOV AX, [SI] SAVE NEW LARGER NUMBER IN AX
0211 E2, F6 GO LOOP BCK JUMP UNTIL CX = 0
0213 A3, 51, 03 MOV [0351], AX STORE LARGEST NUMBER IN
MEMORY
0216 CC INT 3 BREAKPOINT
SECTION – D
Q.8. Explain 8259 interrupt controller with the help of block diagram. (20)
Ans. The block diagram of 8259 is shown in fig.(a). It contains following blocks :
(i) Data bus buffer (ii) Read/write logic
(iii) Cascade buffer and comparator (iv) Control logic
B.Tech., 5th Semester, Solved papers, Dec -2016 97
ignores the new request. If the priority resolvers finds that the new interrupt has a higher priority
than the highest priority interrupt currently being serviced and the new interrupt is not in service,
then it will set appropriate bit in the InSR and send the INT signal to the microprocessor for new
interrupt request.
(viii) Interrupt mask register (IMR) : It is a programmable register. It is used to
Mask unwanted interrupt request, by writing appropriate command word. The microprocessor
can read contents of this register without issuing any command word.
The 8254 has exactly the same pinout as that of the 8253. But the 8254 differs from that
of the 8253 in 2 ways, namely,
(i) no read back Once the particular counter of the 8253 is programmed, its status
can not be read back.
(ii) The maximum clock frequency it can count is limited to 2 MHz. The upper limit of
clock frequency of 8254 is 8 MHz and that of the 8254-2 is 10 MHz.
– Electrical characteristics : The access time of the 8254 is 200ns where as the
access time of the 8254-2 is 175ns. The GATE and CLK inputs present 10 A load and OUT
output can source 400 A in the high state and sink 2 mA in the low state.
– Data bus buffer : The 8-bit tri-state data buffer has 3-basic functions :
(a) Programming different modes of the 8253/8254,
(b) Loading the count register, and
(c) Reading the count value.
– Read/write control logic : The 8253/8254 has 5-signals, namely, CS , A0, A1, RD ,
WR . The functions of these control signals are :
(a) RD (Read Bar) : A low on this pin informs the 8253/8254 that the P is ready to
accept data in the form count value.
(b) WR (Write Bar) : A low on this pin informs the 8253/8254 that the P is ready to
output data in the form of mode informations or data.
Hence, in the isolated I/O mode, RD and WR are directly connected to IOR and
IOW . On the other hand, in the memory mapped I/O, RD and WR are connected to MEMR
and MEMW respectively..
100 Microprocessing & Interfacing
(c) CS (Chip select Bar) : The 8253/8254 is selected only when a low (0) is applied at
this terminal. No reading or writing operations will be performed by or on the 8253/8254 unless
this chip is selected. The CS = 1 does effect the operation of the counters.
(d) A1 A0 (Address Pin) : These lines (A1 A0) are connected to the address bus. The
function of A1 and A0 are to select any one of the three counters and the control word register of
8253/8254 is indicated in below table :
Table : Selection of counter and CWR
A1 A0 Selection of counter
0 0 Counter-0 Selected
0 1 Counter-1 Selected
1 0 Counter-2 Selected
1 1 Control word register selected (CWR)
– Control word Register : As indicated in above table, the control word register is
selected only when A1A0 = 11. It is loaded with the formation of the control word to indicate
which particular counter is to be used in which mode and whether READ and WRITE operation
is to be performed.
Ans.(b) Instruction Register : This register is not accessible to the user. The instruction
register holds the opcode of the instruction that is decoded and executed.
The opcode is further sent to the instruction decoder to select one of the 256 alternatives
(operations). The contents of the instruction decoder are in the form of 0’s and 1’s.
Priority resolver : It determines the priorities of the bit set in the IRR. To make
decision, the priority resolver looks at the ISR. If the higher priority bit in the InSR is set then it
ignores the new request. If the priority resolvers finds that the new interrupt has a higher priority
than the highest priority interrupt currently being serviced and the new interrupt is not in service,
then it will set appropriate bit in the InSR and send the INT signal to the microprocessor for new
interrupt request.