Lecture-1 (Introduction, Hardwired Logic) : MPI Unit 1
Lecture-1 (Introduction, Hardwired Logic) : MPI Unit 1
Lecture-1 (Introduction, Hardwired Logic) : MPI Unit 1
Hardwired Logic:
A hardwired control unit has a processor that generates signals or instructions to be implemented in
correct sequence.
This was the older method of control that works through the use of distinct components, drums, a
sequential circuit design, or flip chips.
It is implemented using logic gates & flip flops. It is faster, less flexible & limited in complexity.
Flexible Logic:
A micro programmed control unit on the other hand makes use of a micro sequencer from which
instruction bits are decoded to be implemented.
It acts as the device supervisor that controls the rest of the subsystems including arithmetic and logic
units, registers, instruction registers, off-chip input/output, and buses.
Three-state logic is a logic used in electronic circuits wherein a third state, the high-impedance state, is
added to the original 1 and 0 logic states that a port can be in.
This high-impedance state effectively removes the port from the circuit, as if it were not part of it.
So in the third state of high impedance, the output from the port is neither 1 nor 0, but rather the port
does not appear to exist.Three-state logic is also known as tri-state logic.
Microprocessor:
A microprocessor is an integrated circuit (IC) or computer processor which incorporates core functions of a
computer’s central processing unit (CPU).
It is a programmable multipurpose silicon chip, clock driven, register based, accepts binary data as input
and provides output after processing it as per the instructions stored in the memory.
Microcomputer:
It includes a microprocessor, memory, and minimal input/output circuitry mounted on a single printed
circuit board.
Microprocessor is the brain of computer, which does all the work. It is a computer processor that incorporates all the
functions of CPU (Central Processing Unit) on a single IC (Integrated Circuit) or at the most a few ICs.
Microprocessors were first introduced in early 1970s. 4004 was the first general purpose microprocessor used by
Intel in building personal computers. Arrival of low cost general purpose microprocessors has been instrumental in
development of modern society the way it has.
Image Source:
https://www.tutorialspoint.com/basics_of_computers/basics_of_computers_microprocessor_concepts.htm
Microprocessors Characteristics
Microprocessors are multipurpose devices that can be designed for generic or specialized functions. The
microprocessors of laptops and smartphones are general purpose whereas ones designed for graphical processing or
machine vision are specialized ones. There are some characteristics that are common to all microprocessors.
o Clock speed
o Instruction set
o Word size
Clock Speed
Every microprocessor has an internal clock that regulates the speed at which it executes instructions and also
synchronizes it with other components. The speed at which the microprocessor executes instructions is called clock
speed. Clock speeds are measured in MHz or GHz where 1 MHz means 1 million cycles per second whereas 1 GHz
equals to 1 billion cycles per second. Here cycle refers to single electric signal cycle.
Currently microprocessors have clock speed in the range of 3 GHz, which is maximum that current technology can
attain. Speeds more than this generate enough heat to damage the chip itself. To overcome this, manufacturers are
using multiple processors working in parallel on a chip.
Word Size
Number of bits that can be processed by a processor in a single instruction is called its word size. Word size
determines the amount of RAM that can be accessed at one go and total number of pins on the microprocessor. Total
number of input and output pins in turn determines the architecture of the microprocessor.
First commercial microprocessor Intel 4004 was a 4-bit processor. It had 4 input pins and 4 output pins. Number of
output pins is always equal to the number of input pins. Currently most microprocessors use 32-bit or 64-bit
architecture.
Instruction Set
A command given to a digital machine to perform an operation on a piece of data is called an instruction. Basic set of
machine level instructions that a microprocessor is designed to execute is called its instruction set. These
instructions do carry out these types of operations −
o Data transfer
o Arithmetic operations
o Logical operations
o Control flow
o Input/output and machine control
Microprocessor Components
Compared to the first microprocessors, today’s processors are very small but still they have these basic parts right
from the first model −
o CPU
o Bus
o Memory
CPU
CPU is fabricated as a very large scale integrated circuit (VLSI) and has these parts −
Connection lines used to connect the internal parts of the microprocessor chip is called bus. There are three types of
buses in a microprocessor −
o Data Bus − Lines that carry data to and from memory are called data bus. It is a bidirectional bus with width
equal to word length of the microprocessor.
o Address Bus − It is a unidirectional responsible for carrying address of a memory location or I/O port from
CPU to memory or I/O port.
o Control Bus − Lines that carry control signals like clock signals, interrupt signal or ready signal are called
control bus. They are bidirectional. Signal that denotes that a device is ready for processing is called ready
signal. Signal that indicates to a device to interrupt its process is called an interrupt signal.
Memory
Microcomputer Organization:
As discussed in previous lecture microprocessor is a central processing unit (CPU) with its related timing functions
on a single chip. A microprocessor combined with memory and input/output devices forms a microcomputer.
Therefore, the basic components of a microcomputer are:
1) CPU
2) Program memory
3) Data memory
4) Output ports
5) Input ports
6) Clock generator.
The CPU consists of ALU (Arithmetic and Logic Unit), register unit and control unit. The CPU fetches the stored
instructions from the program memory, data word from data memory or from an input device and after processing
the data stores the result in data memory or sends it to an output device.
This unit performs computing functions on m-bit data where ‘m’ is the bit size of the processor. These functions are
arithmetic operations such as addition, subtraction and logical operation such as AND, OR, XOR, rotate, compare etc.
Results are stored either in registers or in memory or sent to output devices.
b) Register Unit:
It contains various 8-bit or 16-bit registers. These registers are used primarily to store data temporarily during the
execution of a program. Some of the registers are accessible to the user through instructions. It means there contents
can be read and/or changed through instructions. Some of the registers are not accessible to user but they are used
by the processor for the execution of an instruction. 8085A microprocessor contains 8-bit registers such as
Accumulator (Reg. A), B, C, D, E, H, L etc and16-bit registers such as Program Counter (PC), Stack Pointer (SP).
c) Control Unit:
It provides necessary timing & control signals required for the operation of microcomputer. It controls the flow of
data between the microprocessor and peripherals (input, output & memory). The control unit gets a clock signal
which determines the speed of the microprocessor.
c. It executes the instruction. Executing the instruction may include same of the following major tasks:
1. Transfer of data from one register to another register in the CPU itself.
2. Transfer of data between a CPU register & specified memory location or input/output device.
3. Performing arithmetic and logical operations on data from a specific memory location or a designated CPU
register.
4. Directing the CPU to change the sequence of fetching instructions, if processing the data created a specific
condition.
5. Performing housekeeping function within the CPU itself in order to establish desired condition at certain registers.
d. It looks for control signal such as interrupts and provides appropriate responses.
e. It provides status, control, and timing signals that the memory and input/output section can use.
Memory:
It stores both the instructions to be executed (i.e. program) and the data involved. It usually contains ROM (Read
Only Memory) and RWM (Read Write Memory). The ROM can only read and cannot be written into and is non
volatile that is, it retains its contents when the power is turned off. A ROM is typically used to store instructions and
data that do not change. For example, it stores the monitor program of a microcomputer.
One can either read from or write into a RWM in memory read operation or memory write operation respectively.
The RWM is volatile, that is it does not retain its contents when the power is turned off. It is used to store user
programmes & data which are temporary might change during the course of executing a program.
Both ROM & RWM are RAMs (Random Access Memory). During a memory read operation, the content of the
addressed location is not destroyed. During a write operation, the original content of the addressed location is
destroyed.
Program Memory:
The basic task of a microcomputer system is to ensure that its CPU executes the desired instructions sequence i.e.,
the program properly. The instructions sequence is stored in the program memory. On initialization- usually on
power up or manual reset the processor starts executing the instructions from a predetermined location in program
memory. The first instruction of the program should, therefore, be in this location. In typical processor based system,
the program to be executed is fixed one which does not change.
Therefore these programmes are stored in non-volatile memory such as ROM, or PROM, EPROM, EEPROM.
In the trainer kit, ROM contains only the monitor program which is an application program for the trainer system. It
allows the user to interact with microprocessor to enter user program and execute it. The user program is not stored
in ROM because it needs not to be stored permanently. The user program is stored in RWM or RAM.
Data Memory:
A microcomputer manipulates data according to the algorithm given by the instruction in the program in the
program memory. These instructions may require intermediate results to be stored. The functional block in the μc
used for this storage is the data memory. Microprocessors also have a small amount of memory in the form of
internal registers which can also be used if available for such storage. External data memory is needed if the storage
requirement is more.
Apart from intermediate storage, the data memory may also be used to provide input data needed by the program
and to store some of the results of the program. Data memory is used for all storage purposes other than storage of
program. Therefore, they must have Read-Write capability called Read-Write Memory (RWM).
Both ROM & RWM are arranged into words, each of which has a unique address. The address of a word in memory is
different than its contents. To refer the contents of a memory location, its address is placed in parentheses.
Therefore, X is an address and (X) is the content of that address X.
The address decoder takes an address and from the control unit and selects the proper memory location. Finding the
correct memory location and obtaining its content takes certain amount of time, this times is the access time of the
memory. The access time affects the speed of the computer since the computer must obtain the instruction and data
from the memory. Computer memories are usually RAM so that all memory location have the same access time. The
computer must wait whenever it uses its memory, typical memory access time range from few nano-secs to several
μsecs. Memory sections often subdivided into units called pages. The entire memory section may involve million of
words, whereas a page contains between 256 & 4k warts. The computer may access a memory location by first
accessing a particular page and then accessing a location (or line number) on that page. The advantage of paging is
that the computer can reach several locations on the same page with just the address on the page. The process is like
describing street address by first specifying a street and then listing the house numbers. The control section
transfers data to or from memory as follows:
2. The control section sends a read and write signal to the memory to indicate, the direction of the transform.
3. The control section waits until transfer has been completed. This delay precedes the actual data’s transfer in the
input case and follows it in the output case.
Input/Output Ports:
The input & output ports provide the microcomputer the capability to communicate with the outside world. The
input ports allow data to pass from the outside world to the μc data which will be used in the data manipulation
being done by the microcomputer to send data to output devices
The user can enter instruction (i.e. program) and data in memory through input devices such as keyboard, or simple
switches, CRT, disk devices, tape or card readers. Computers are also used to measure and control physical
quantities like temperature, pressure, speed etc. For these purposes, transducers are used to convent physical
quantise into proportional electrical signals A/D computers are used to convert electrical signals into digital signals
which are sent to the compute.
The computer sends the results of the computation to the output devices e.g. LED, CRT, D/A converters, printers etc.
These I/O devices allow the computer to communicate with the outside world. I/O devices are called peripherals.
Clock Generator:
Operations inside the microprocessor as well as in other parts of the microcomputer are usually synchronous by
nature. This is done so that events in different parts of the system can proceed in a systematic fashion. The clock
needed to perform this synchronous operation is provided by the clock generator. The clock generator generates the
appropriate clock periods during which instruction executions are carried out by the microprocessor.
Some of the microprocessors have an internal clock generator circuit to generate a clock signal. These
microprocessors require an external crystal or RC network to be connected at the appropriate pins for deciding the
operating frequency (e.g. 8085A). Some microprocessors require an external clock generator (e.g. 8086). These
microprocessors also provide an output clock signal which can be used by other devices in the microcomputer
system for their own timing and synchronizing.
The 8085 is an 8-bit microprocessor, and it was launched by the Intel team in the year of 1976 with
the help of NMOS technology. This processor is the updated version of the microprocessor. The
configurations of 8085 microprocessor mainly include data bus-8-bit, address bus-16 bit, program
counter-16-bit, stack pointer-16 bit, registers 8-bit, +5V voltage supply, and operates at 3.2 MHz
single segment CLK. The applications of 8085 microprocessor are involved in microwave ovens,
washing machines, gadgets, etc. The features of the 8085 microprocessor are as below:
o This microprocessor is an 8-bit device that receives, operates, or outputs 8-bit information in a
simultaneous approach.
o The processor consists of 16-bit and 8-bit address and data lines and so the capacity of the
device is 216 which is 64KB of memory.
o This is constructed of a single NMOS chip device and has 6200 transistors
o A total of 246 operational codes and 80 instructions are present
o As the 8085 microprocessor has 8-bit input/output address lines, it has the ability to address
28 = 256 input and output ports.
o This microprocessor is available in a DIP package of 40 pins
o In order to transfer huge information from I/O to memory and from memory to I/O, the
processor shares its bus with the DMA controller.
o It has an approach where it can enhance the interrupt handling mechanism
o An 8085 processor can even be operated as a three-chip microcomputer using the support of IC
8355 and IC 8155 circuits.
o It has an internal clock generator
o It functions on a clock cycle having a duty cycle of 50%
The architecture of the 8085 microprocessor mainly includes the timing & control unit, Arithmetic and
logic unit, decoder, instruction register, interrupt control, a register array, serial input/output control.
The most important part of the microprocessor is the central processing unit.
Operations of the 8085 Microprocessor
The main operation of ALU is arithmetic as well as logical which includes addition, increment,
subtraction, decrement, logical operations like AND, OR, Ex-OR, complement, evaluation, left shift or
right shift. Both the temporary registers as well as accumulators are utilized for holding the
information throughout the operations then the outcome will be stored within the accumulator. The
different flags are arranged or rearrange based on the outcome of the operation.
Flag Registers
The flag registers of microprocessor 8085 are classified into five types namely sign, zero, auxiliary
carry, parity and carry. The positions of bit set aside for these types of flags. After the operation of an
ALU, when the result of the most significant bit (D7) is one, then the sign flag will be arranged. When
the operation of the ALU outcome is zero then the zero flags will be set. When the outcome is not zero
then the zero flags will be reset.
In an arithmetic process, whenever a carry is produced with the lesser nibble, then an auxiliary type
carry flag will be set. After an ALU operation, when the outcome has an even number then the parity
flag will be set, or else it is reset. When an arithmetic process outcome in a carry, then carry flag will
be set or else it will be reset. Between the five types of flags, the AC type flag is employed on the inside
intended for BCD arithmetic as well as remaining four flags are used with the developer to make sure
the conditions of the outcome of a process.
The control and timing unit coordinates with all the actions of the microprocessor by the clock and
gives the control signals which are required for communication among the microprocessor as well as
peripherals.
As an order is obtained from memory after that it is located in the instruction register, and encoded &
decoded into different device cycles.
Register Array
The general purpose programmable registers are classified into several types apart from the
accumulator such as B, C, D, E, H, & L. These are utilized as 8-bit registers otherwise coupled to stock
up the l6 bit of data. The permitted couples are BC, DE & HL, and the short term W & Z registers are
used in the processor & it cannot be utilized with the developer.
Special Purpose Registers
These registers are classified into four types namely program counter, stack pointer, increment or
decrement register, address buffer, or data buffer.
Program Counter
This is the first type of special-purpose register and considers that the instruction is being performed
by the microprocessor. When the ALU completed performing the instruction, then the microprocessor
searches for other instructions to be performed. Thus, there will be a requirement of holding the next
instruction address to be performed in order to conserve time. Microprocessor increases the program
when an instruction is being performed, therefore that the program counter-position to the next
instruction memory address is going to be performed…
The SP or stack pointer is a 16-bit register and functions similar to a stack, which is constantly
increased or decreased with two throughout the push and pop processes.
The 8-bit register contents or else a memory position can be increased or decreased with one. The 16-
bit register is useful for incrementing or decrementing program counters as well as stack pointer
register content with one. This operation can be performed on any memory position or any kind of
register.
Address buffer stores the copied information from the memory for the execution. The memory & I/O
chips are associated with these buses; then the CPU can replace the preferred data by I/O chips and
the memory.
The data bus is useful in carrying the related information that is to be stock up. It is bi-directional, but
the address bus indicates the position as to where it must be stored & it is uni-directional, useful for
transmitting the information as well as address input/output devices.
The timing & control unit can be used to supply the signal to the 8085 microprocessor architecture for
achieving the particular processes. The timing and control units are used to control the internal as
well as external circuits. These are classified into four types namely control units like RD’ ALE, READY,
WR’, status units like S0, S1, and IO/M’, DM like HLDA, and HOLD unit, RESET units like RST-IN and
RST-OUT.
REGISTER SECTION:
There are six 8-bit general purpose registers designated as B, C, D, E, H and L. All these registers are accessible to the
user. It means their contents can be read without destroying it or some new data can be written into it through
instructions. These registers constitute a register array like a small on-chip RAM with addressable memory location.
Internal control signals select the register for a read or write operation. This means that the CPU can either load a
register from the 8-bit internal data bus or output the register content to the internal 8-bit data bus.
PROGRAM COUNTER:
This is a 16-bit register accessible to the user. It is a special purpose register and it always contains the address of
the next instruction to be fetched from the program memory and executed by the CPU in a program sequence. Thus
the program counter keeps the track of the program execution in which instructions are to be executed next.
The stack is a storage area of the processor. It consists of number of sequential and RWM locations in which
microprocessor saves the internal register contents during subroutine calls and interrupts so that they will not be
changed or destroyed by a subroutine.
8085 is a 40 pin IC, The signals from the pins can be grouped as follows
2. Address bus
3. Data bus
Vss: Ground
X1, X2 : Crystal or R/C network or LC network connections to set the frequency of internal clock generator. The
frequency is internally divided by two. Since the basic operating timing frequency is 3 MHz, a 6 MHz crystal is
connected externally. CLK (output)-Clock Output is used as the system clock for peripheral and devices interfaced
with the microprocessor.
2. Address Bus:
It carries the most significant 8 bits of the memory address or the 8 bits of the I/O address.
3. Data bus:
o These multiplexed set of lines used to carry the lower order 8 bit address as well as data bus.
o During the opcode fetch operation, in the first clock cycle, the lines deliver the lower order address A0 - A7.
o In the subsequent IO / memory, read / write clock cycle the lines are used as data bus.
o The CPU may read or write out data through these lines.
This indicates that the data on the data bus is to be written into the selected memory location or I/O device.
o This status signal indicates that the read / write operation relates to whether the memory or I/O device.
o It goes high to indicate an I/O operation.
o It goes low for memory operations.
5. Status Signals:
S1: S2:
0 1 1 Opcode fetch
0 1 0 Memory read
0 0 1 Memory write
1 1 0 I/O read
1 0 1 I/O write
1 1 0 Interrupt acknowledge
Z 0 1 Halt
Z x x Hold
Z x x Reset
They are the signals initiated by an external device to request the microprocessor to do a particular task or work.
TRAP
RST 7.5
RST 6.5
RST 5.5
INTA
On receipt of an interrupt, the microprocessor acknowledges the interrupt by the active low INTA (Interrupt
Acknowledge) signal.
Used to reset all the connected devices when the microprocessor is reset.
When 2 or more devices are connected to a common bus, to prevent the devices from interfering with each other, the
tristate gates are used to disconnect all devices except the one that is communicating at a given instant.
The CPU controls the data transfer operation between memory and I/O device. Direct Memory Access operation is
used for large volume data transfer between memory and an I/O device directly.
The CPU is disabled by tri-stating its buses and the transfer is effected directly by external control circuits.
HOLD signal is generated by the DMA controller circuit. On receipt of this signal, the microprocessor acknowledges
the request by sending out HLDA signal and leaves out the control of the buses. After the HLDA signal the DMA
controller starts the direct transfer of data.
READY (input)
Memory and I/O devices will have slower response compared to microprocessors.
Before completing the present job such a slow peripheral may not be able to handle further data or control signal
from CPU.
The processor sets the READY signal after completing the present job to access the data.
The microprocessor enters into WAIT state while the READY pin is disabled.
In immediate addressing mode the source operand is always data. If the data is 8-bit, then the instruction will be of 2
bytes, if the data is of 16-bit then the instruction will be of 3 bytes.
Examples:
LXI H 3050 (load the H-L pair with the operand 3050H immediately)
In register addressing mode, the data to be operated is available inside the register(s) and register(s) is(are)
operands. Therefore the operation is performed within various registers of the microprocessor.
Examples:
ADD B (add contents of registers A and B and store the result in register A)
Examples:
LHLD address (load contents of 16-bit memory location into H-L register pair)
In register indirect addressing mode, the data to be operated is available inside a memory location and that memory
location is indirectly specified by a register pair.
Examples:
MOV A, M (move the contents of the memory location pointed by the H-L pair to the accumulator)
LXIH 9570 (load immediate the H-L pair with the address of the location 9570)
In implied/implicit addressing mode the operand is hidden and the data to be operated is available in the instruction
itself.
Examples:
CMA (finds and stores the 1’s complement of the contains of accumulator A in A)
An instruction is a binary command used to execute an operation inside the microprocessor over a given data. A
group of instructions that are supported by the 8085 microprocessor is known to be the instruction set of 8085
microprocessor.
Basically, 8085 is designed to have 5 functional categories of the instruction set. Here in this article, we will discuss
each instruction set in detail.
These instructions are used by the microprocessor in order to transfer the data from one location to another. More
specifically, it helps in transferring the data from source operand to destination operand, without making any
changes in the source data.
As the data present in the source is not modified. Thus it is more convenient to call it a data copy instruction. As
while transferring the data from source to destination, the data present in the source is just copied to the destination
also. Due to this no change in source data is noticed.
Basically, the instructions that come under this instruction set, are as follows:
This instruction helps to transfer the contents of register r2 into register r1. While the data in register r2 will remain
the same.
This instruction transfers the data in register B to an accumulator.
This instruction specifies the transfer of data present in the memory to the register. However, the address of the
memory location must be present in the HL register.
This instruction specifies the immediate transfer of data to a memory location. And the address of this memory
location is specified at the H-L registers.
It is load accumulator instruction. This instruction is used to copy the data present in the memory address specified
as the operand of the instruction to the accumulator. More specifically, in this case, the data present in the 16-bit
memory address is transferred to the accumulator.
It is load accumulator indirect instruction. In this instruction, the register that acts as operand holds a memory
location, where the actual data is present which is to be loaded at the accumulator.
STA is stored accumulator direct instruction. Whenever this instruction is passed, then the data present in the
accumulator is transferred to the memory address specified in the operand.
It is stored accumulator indirect instruction. The register present as the operand holds a memory address. So, the
data of the accumulator is copied to that particular memory location.
Example: STAX D
This instruction transfers the data of HL pair into the stack pointer.
Like the SPHL, this instruction copies the data of H-L register into the stack pointer by placing the higher order bytes
at H and lower order bytes at L.
In this instruction, the stack is loaded with the data present in the register given in the operand.
Firstly, the SP gets decremented and higher order bytes are copied to the stack. Further SP gets decremented in
order to load the lower order register bytes.
Example: PUSH C
This instruction specifies the transfer of the data present at the top of the stack to the register given as the operand.
Example: POP D
In case of OUT instruction, the data at the accumulator is copied to the I/O port. At the operand an 8-bit port address
is present.
Example: OUT 56 H
This instruction specifies the loading of data present at the I/O port to the accumulator. The operand holds the
address of the port from where the data is to be copied.
Example: IN, 5B H
Arithmetic Instruction
This instruction set allows arithmetic operations to be performed over the data in memory and register inside the
8085 microprocessor.
This instruction specifies that the data present in the register is to be added with the data present in the accumulator
and the result is to be stored in the accumulator itself.
Example: ADD B
This instruction is used to add the data of the memory address specified at the operand with the data present at the
accumulator. And the result of the addition is stored in the accumulator.
This instruction adds the 8-bit data at the operand and carry flag with the data present at the accumulator. After each
addition, the flag reflects the outcome of the addition.
In this instruction, the data at the register is added with the data present at the accumulator along with the carry bit
and outcome is reflected at the accumulator.
Example: ADC B
This instruction is used to add the data present at the memory location whose address is specified in the operand
given and the carry bit along with the data present in the accumulator. The result of the addition is stored in the
accumulator.
This instruction subtracts the data present at the register given at the operand from the data in the accumulator,
further the result is stored at the accumulator.
Example: SUB D
In this instruction, the data present at the memory location whose address is given by the H-L register is subtracted
from the data at the accumulator.
This instruction is used to immediately subtract the data given as operand in the instruction from the data present at
the accumulator. After each subtraction, the flag is modified so as to show the outcome of subtraction.
Example: SUI 55H
This instruction subtracts the 8-bit data given as the operand and the borrow bit from the data present at the
accumulator, and resultantly store the output achieved in the accumulator.
By the use of this instruction, the data at the register and the borrow bit is subtracted from the data at the
accumulator.
Example: SBB B
This instruction specifies the subtraction of data present at the memory location, whose address is present at the H-L
register and the borrow bit from the data at the accumulator.
This instruction increments the data by 1 which is present at the register given at the operand. The result of which is
stored at the same register.
Example: INX D
This instruction decrements the data present at the register by 1 and stores the result at the same register.
Example: DCX D
Sometimes in an instruction, the operand holds a memory location. The address of this memory location is present at
the H-L pair. So, the data present at that particular location is decremented by 1.
Logical Instruction
These instructions are used to perform logical or Boolean operations over the data present in either register or
memory. The logical instructions modify the flag bits according to the operation performed.
This instruction is used to compare the data at the accumulator with the data present at the register or memory
which is given as operand. According to the result obtained by the comparison, the flags are set. While the data being
compared remains unchanged.
Suppose,
o If the data present at the accumulator is smaller than that of register or memory, then carry flag is set.
o If the data in the accumulator is equal to the data in the register or memory, then it sets the zero flag.
o However, if the data in the accumulator is greater than the data present in the memory or register, then both
carry and zero flags are reset.
This instruction is used to compare the 8-bit data given as operand in the instruction with the data present in the
accumulator. The comparison result is shown by the flags.
This instruction performs the AND operation of the data present in the accumulator to the data present in the
register or memory. After the AND operation, S, P, Z are changed to show the result of the comparison. AC is set and
CY is reset.
Example: ANA D
This instruction is used to perform AND operation of the immediate 8-bit data given as operand with the data
present in the accumulator.
Example: ORA B
Here, 8-bit data given as operand is logically ORed with the data in the accumulator. The outcome of which is saved
in the accumulator.
This instruction performs XOR operation with data at the accumulator and the data at the register or memory. In this
case, CY and AC are reset.
This instruction performs XOR operation of the 8-bit data given as operand and the data at the accumulator. And
stores the result at the accumulator.
This instruction holds significance when there exists a need to rotate the bits present in the accumulator. Basically,
for an 8-bit value, each bit is rotated or shifted left by one position. Also, the rotation of last bit of the sequence i.e.,
D7, sets the CY flag.
This instruction rotates the bit to the right by one position. In this case, D0, sets the CY flag.
This instruction rotates the bits to the left by one of the data present in the accumulator through the carry flag.
Here, D7 is shifted to carry the flag and the bit in the carry flag is shifted to D0.
This instruction is used to rotate the bits of the data present in the accumulator to the right through the carry flag.
In this case, D0 is shifted to carry the flag and carry bit is shifted to D7 position.
This instruction sets the carry flag to 1, without affecting any other flags.
This instruction is used to generate the complement of data at the accumulator. The complement function does not
affect any of the flags.
This instruction complements the data present at the carry flag. Thus any other flag is not affected by this
instruction.
Branching Instruction
These instructions are used in order to switch or transfer the control of the microprocessor from one position to
another. More specifically we can say, it changes the general sequential flow.
This instruction is used to transfer the present program sequence to that memory location whose 16-bit address is
specified in operand of the instruction.
This instruction comes under conditional branching instruction, in which the present program sequence is
transferred to that particular location whose address is provided at the operand. But this transferring depends on
the given PSX flag.
Example: JZ 1600H
This instruction moves the control of recent program sequence to the memory address given at the operand. But
before transferring, the PC gets decremented.
This instruction is used to transfer the sequence from the main program to the interrupt service routine. Basically,
the transfer is performed over one of the 8 bits which are specified in the operand.
Control Instruction
As the name itself is suggesting that these instructions are used to control the operations of the microprocessor. The
control instructions are as follows:
It stands for no operation. Whenever the microprocessor fetches this instruction, then it is decoded but not executed.
It is used to disable the interrupts generated in the microprocessor. Resetting of interrupt enable flip-flop is
performed. This leads to disabling of all the interrupts except TRAP.
This instruction is used to enable the interrupt. This time the interrupt enable pin is set which leads to enabling of
the interrupts in the system.
Whenever HLT is decoded by the microprocessor, then it halts any other program and continuously executes the
current program which is under operation. To get out of the halt state either an interrupt or reset is required.
SIM stands for set interrupt mask. This instruction is used to implement the programming of hardware interrupts
7.5, 6.5 and 5.5 and serial output.
RIM stands for read interrupt mask. This instruction is used to put the desired data at the accumulator according to
the interrupt and serial input.
It is one of the best way to understand to process of micro-processor/controller. With the help of timing diagram we
can understand the working of any system, step by step working of each instruction and its execution, etc.
It is the graphical representation of process in steps with respect to time. The timing diagram represents the clock
cycle and duration, delay, content of address bus and data bus, type of operation ie. Read/write/status signals.
1. If an addressing mode is direct, immediate or implicit then No. of machine cycles = No. of bytes.
2. If the addressing mode is indirect then No. of machine cycles = No. of bytes + 1. Add +1 to the No. of machine cycles
if it is memory read/write operation.
3. If the operand is 8-bit or 16-bit address then, No. of machine cycles = No. of bytes +1.
Timing Diagram:
Where,
Instruction cycle= Fetch Cycle(FC) + Executecycle(EC).
Opcode fetch:The microprocessor requires instructions to perform any particular action. In order to perform these
actions microprocessor utilizes Opcode which is a part of an instruction which provides detail(ie. Which operation
µp needs to perform) to microprocessor.
Operation:During T1 state, microprocessor uses IO/M(bar), S0, S1 signals are used to instruct microprocessor to
fetch opcode.
During this operation 8085 transmits 16-bit address and also uses ALE signal for address latching.
At T2 state microprocessor uses read signal and make data ready from that memory location to read opcode from
memory and at the same time program counter increments by 1 and points next instruction to be fetched.
In this state microprocessor also checks READY input signal, if this pin is at low logic level ie. '0' then microprocessor
adds wait state immediately between T2 and T3.
At T3, microprocessor reads opcode and store it into instruction register to decode it further.
During T4 microprocessor performs internal operation like decoding opcode and providing necessary actions.
The opcode is decoded to know whether T5 or T6 states are required, if they are not required then µp performs next
operation.
Read and write timing diagram for memory and I/O Operation
Memory
Read:
It requires 3 T-States.
During T1, A8-A15 contains higher byte of address. At the same time ALE is high. Therefore Lower byte of address
A0-A7 is selected from AD0-AD7.
During T2 ALE goes low, RD(bar) goes low. Address is removed from AD0-AD7 and data D0-D7 appears on AD0-AD7.
Memory
Write:
Figure: Memory write timing diagram
It requires 3 T-States.
During T1, ALE is high and contains lower address A0-A7 from AD0-AD7.
During T2, ALE goes low, WR(bar) goes low and Address is removed from AD0-AD7 and then data appears on AD0-
AD7.
Operation:
It requires 3 T-States.
During T1, The Lower Byte of IO address is duplicated into higher order address bus A8-A15.
IO
Write:
Operation:
It requires 3 T-States.
During T1, the lower byte of address is duplicated into higher order address bus A8-A15.
During T2, ALE goes low, WR (bar) goes low and data appears on AD0-AD7 to write data into IO device.
Lecture Notes: