Solution of Micro Processor
-
Upload
rajinder-sanwal -
Category
Documents
-
view
217 -
download
0
Transcript of Solution of Micro Processor
-
7/29/2019 Solution of Micro Processor
1/6
Ans 1 a) A latch is necessary to hold the output data for display. The input data byte is
obtained by enabling a tri-state buffer and placed in the accumulator.
b)A subroutine is a sequence of program instructions that perform a specific task, packaged as a unit.
This unit can then be used in programs wherever that particular task should be performed. Subprograms
may be defined within programs, or separately inlibrariesthat can be used by multiple programs.
In different programming languages a subroutine may be called a procedure, a function, a routine,
amethod, or a subprogram.
A subroutine is a group of instructions that will be used repeatedly in different locations of the Program.
Rather than repeat the same instructions several times, they can be grouped into a subroutine that is
called from the different locations. In Assembly language, a subroutine can exist anywhere in the code.
However, it is customary to place subroutines separately from the main program.
The 8085 has two instructions for dealing with subroutines. The CALL instruction is used to redirect
program execution to the subroutine. The RET insutruction is used to return the execution to the calling
routine.(Explain their mechanism).
c)Memory Mapped I/O
- 16-bit device address
- Data transfer between any general-purpose register and I/O port.
- The memory map (64K) is shared between I/O device and system memory.
- More hardware is required to decode 16-bit address
- Arithmetic or logic operation can be directly performed with I/O data
Peripheral MappedI/O
- 8-bit device address
- Data is transfer only between accumulator and I.O port
- The I/O map is independent of the memory map; 256 input device and 256. output device can be
connected
- Less hardware is required to decode 8-bit address
- Arithmetic or logical operation cannot be directly performed with I/O data
d) In a given program, it is often needed to perform a particular sub-task many times on different
data values. Such a subtask is usually called a subroutine. For example, a subroutine may sort
numbers in an integer array or perform a complex mathematical operation on an input variable
(e.g., calculate sin(x)). It should be noted, that the block of instructions that constitute a
subroutine can be included at every point in the main program when that task is needed.
http://en.wikipedia.org/wiki/Library_(computer_science)http://en.wikipedia.org/wiki/Library_(computer_science)http://en.wikipedia.org/wiki/Library_(computer_science)http://en.wikipedia.org/wiki/Method_(computing)http://en.wikipedia.org/wiki/Method_(computing)http://en.wikipedia.org/wiki/Method_(computing)http://en.wikipedia.org/wiki/Method_(computing)http://en.wikipedia.org/wiki/Library_(computer_science) -
7/29/2019 Solution of Micro Processor
2/6
However, this would result in unnecessary waste of memory space. Rather, only one copy of the
instructions that constitute the subroutine is placed in memory and any program that requires the
use of the subroutine simply branches to its starting location in memory. The instruction that
performs this branch is named a CALL instruction. The calling program is called CALLER and
the subroutine called is called CALLEE.
The instruction that is executed right after the CALL instruction is the first instruction of the
subroutine. The last instruction in the subroutine is a RETURN instruction, and we say that the
subroutine returns to the program that called it. Since a subroutine can be called from different
places in a calling program, we must have a mechanism to return to the appropriate location (the
first instruction that follows the CALL instruction in the calling program). At the time of
executing the CALL instruction we know the program location of the instruction that follows the
CALL (the next program counter or PC). Hence, we should save the return address at the time
the CALL instruction is executed. The way in which a machine makes it possible to call and
return from subroutines is referred to as its subroutine linkage method.
The simplest subroutine linkage method is to save the return address in a specific location. This
location may be a register dedicated to this function, often referred to as the link register. When
the subroutine completes its task, the return instruction returns to the calling program by
branching indirectly through the link register.
The CALL instruction is a special branch instruction and performs the following operations:
Store the contents of the PC in the link register
Branch to the target address specified by the instruction.
The RETURN instruction is a special branch instruction that performs the following operations:
Branch to the address contained in the link register.
1e) Text editors allow data entry and updating. Some additional capabilities are:
- duplicating or deleting lines or blocks of lines
-
7/29/2019 Solution of Micro Processor
3/6
- changing specific text or using a regular expression to change a range of text
- moving sections of text
- finding text
- screen movement (up, down, left or right) by line, page or top/bottom
- command retrieval and repetition
- a macro facility
- retrieval of other files into the current one
- sorting
- regular expression capability
- undoing changes
- allowing more than one file to be edited at the same time
- writing to, appending to, or clearing the clipboard
- filling or overlaying areas with numbers or text
- splitting and joining lines either manually or at/after some text
- allowing split screens on the same or different files
- allowing invocation of external code/applications
- setting and going to bookmarks (in larger files)
- centering or justifying text
- excluding lines not of interest
- formatting or justifying paragraphs in various ways
- showing changed lines
- randomizing lines or paragraphs
- highlighting keywords or entire lines
- aligning strings within lines
- showing duplicate or unique data
-
7/29/2019 Solution of Micro Processor
4/6
Ans 1 f)
Application programming is used to build application software which
includes software like notepad, Word Pad, calculator, web browser, Microsoft excel and
many more. Application software runs on top of system software. It interacts with
system software which in turn interacts and makes physical hardware functional.
System programming is used to write low level instructions which are understandable to
computer hardware. Programming is done using assembly language which interacts with
hardware. This assembly code is specific to hardware. If this code has to be executed on
another machine, that machine should have exactly same hardware. System
programming is used to make device drivers kind of application. It helps operating
system to interact with hardware. Again output is in low level instructions which in turn
translated by such drivers to the language understandable by operating system.
Ans 2 a)Arithmetic instructions for register pair.
i) LXI Rp
ii) MOV R,M
iii) LDAX B/D
iv) LDA 16-bit
v) MOV M,R
vi) STAX B/D
vii) STA 16-bit
viii) INX Rp
ix) DCX Rp
Register pair instructions for Rotation.
i) RLC (rotate accumulator left)
ii) RAL (rotate accumulator left through carry)
iii) RRC (rotate accumulator right)
iv) RAR (rotate accumulator right through carry).
2b)FLAG REGISTER
The Status Flags of the 8080 and 8085 are single bits which indicate the logical conditions that existed as
a result of the execution of the instruction just completed. This allows instructions following to act
accordingly, such as a branch as a result of two values comparing equal. The flags are:
ZERO FLAG: This flag is set to a 1 by the instruction just ending if the A Register contains a result of all
0s. 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
-
7/29/2019 Solution of Micro Processor
5/6
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: 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: 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: 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: 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 instructions 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.
INSTRUCTION ORGANIZATION
The 8085s instructions are made up of bytes. In microprocessor parlance, a byte is described as 8
contiguous binary bits treated as a unit. The least significant bit is on the right, and is labeled Bit 0. The
most significant bit is on the left, and is Bit 7. Thus, the machine coding is "origin zero", unless noted
otherwise. Note also that there is no parity bit, or provision for it, as would be found in larger systems.
The 8085s instructions are either one, two, or three bytes long. In all cases, the first byte contains the
essential information, such as the OP code. The second and third bytes, if included, provide operand
information that wont fit in the first byte.
2c ) Interrupt is a mechanism by which an I/O or an instruction can suspend the normal execution of
processor and get itself serviced. Generally, a particular task is assigned to that interrupt signal. In the
microprocessor based system the interrupts are used for data transfer between the peripheral devices and
the microprocessor. The processor will check the interrupts always at the 2nd T-state of last machine
cycle.
-
7/29/2019 Solution of Micro Processor
6/6
Interrupt Service Routine(ISR):-A small program or a routine that when executed services
the corresponding interrupting source is called as an ISR.
Maskable/Non-Maskable Interrupt:-An interrupt that can be disabled by writing some instruction is
known as Maskable Interrupt otherwise it is called Non-Maskable Interrupt.
There are two types of interrupts used in 8085 Microprocessor:
1.Hardware Interrupts
2.Software Interrupts
There are 6 pins available in 8085 for interrupt:
TRAP
RST 7.5
RST6.5
RST5.5
INTR
INTA
Execution of Interrupts:-
When there is an interrupt requests to the Microprocessor then after accepting the
interrupts Microprocessor send the INTA (active low) signal to the peripheral. The vectored address of
particular interrupt is stored in program counter. The processor executes an interrupt service routine
(ISR) addressed in program counter.
2 d)