Unit 1
Unit 1
Introduction
Microprocessor: A silicon chip that contains a CPU. A microprocessor is a
computer processor where the data processing logic and control is included on a
single integrated circuit, or a small number of integrated circuits. The
microprocessor contains the arithmetic, logic, and control circuitry required to
perform the functions of a computer's central processingunit.
8085 Architecture
8085 consists of various units as shown in and each unit performs its own
functions. The various units of a microprocessor are listed below
Accumulator
Arithmetic and logic Unit
General purpose register
Program counter
Stack pointer
Temporary register
Flags
Instruction register and Decoder
Timing and Control unit
Interrupt control
Address buffer and Address-Data buffer
Address bus and Data bus
2
Dr. N. Karuppiah & Dr. S. Ravivarman
Accumulator
Accumulator is nothing but a register which can hold 8-bit data.
Accumulator aids in storing two quantities. The data to be processed by
arithmetic and logic unit is stored in accumulator. It also stores the result of the
operation carried out by the Arithmetic and Logic unit. The accumulator is also
called an 8-bit register. The accumulator is connected to Internal Data bus and
ALU (arithmetic and logic unit). The accumulator can be used to send or receive
data from the Internal Data bus.
3
Dr. N. Karuppiah & Dr. S. Ravivarman
program counter. A program counter stores the address of the next instruction
to be executed. In other words, the program counter keeps track of the memory
address of the instructions that are being executed by the microprocessor and
the memory address of the next instruction that is going to be executed.
Microprocessor increments the program whenever an instruction is being
executed, so that the program counter points to the memory address of the next
instruction that is going to be executed. Program counter is a 16-bit register.
Stack pointer is also a 16-bit register which is used as a memory pointer. A
stack is nothing but the portion of RAM (Random access memory).
So, does that mean the stack pointer points to portion of RAM?
Yes. Stack pointer maintains the address of the last byte that is entered into
stack.
Each time when the data is loaded into stack, Stack pointer gets
decremented. Conversely it is incremented when data is retrieved from stack.
Temporary Register
As the name suggests this register acts as a temporary memory during the
arithmetic and logical operations. Unlike other registers, this temporary
register can only be accessed by the microprocessor and it is completely
inaccessible to programmers. Temporary register is an 8-bit register.
Flags
Flags are nothing but a group of individual Flip-flops. The flags are mainly
associated with arithmetic and logic operations. The flags will show either a
logical (0 or 1) (i.e.) a set or reset depending on the data conditions in
accumulator or various other registers. A flag is actually a latch which can hold
some bits of information. It alerts the processor that some event has taken
place.
D7 D6 D5 D4 D3 D2 D1 D0
S Z AC P CY
Fig. 1.2 Flag Register
Intel processors have a set of 5 flags.
1. Carry flag
2. Parity flag
3. Auxiliary carry flag
4. Zero flag
5. Sign flag
Consider two binary numbers.
For example
1100 0000
4
Dr. N. Karuppiah & Dr. S. Ravivarman
1000 0000
When we add the above two numbers, a carry is generated in the most
significant bit. The number in the extreme right is least significant bit, while the
number in extreme left is most significant bit. So, a ninth bit is generated due to
the carry. So how to accommodate 9th bit in an 8-bit register?
For this purpose, the Carry flag is used. The carry flag is set whenever a
carry is generated and reset whenever there is no carry. But there is an
auxiliary carry flag? What is the difference between the carry flag and auxiliary
carry flag?
Let’s discuss with an example. Consider the two numbers given below
0000 1100
0000 1001
When we add both the numbers a carry is generated in the fourth bit from
the least significant bit. This sets the auxiliary carry flag. When there is no
carry, the auxiliary carry flag is reset. So, whenever there is a carry in the most
significant bit Carry flag is set. While an auxiliary carry flag is set only when a
carry is generated in bits other than the most significant bit.
Parity checks whether it’s even or add parity. This flag returns a 0 if it is
odd parity and returns a 1 if it is an even parity. Sometimes they are also called
as parity bit which is used to check errors while data transmission is carried
out.
Zero flag shows whether the output of the operation is 0 or not. If the value
of Zero flag is 0 then the result of operation is not zero. If it is zero the flag
returns value 1.
Sign flag shows whether the output of operation has positive sign or
negative sign. A value 0 is returned for positive sign and 1 is returned for
negative sign.
5
Dr. N. Karuppiah & Dr. S. Ravivarman
Timing and control unit is a very important unit as it synchronizes the
registers and flow of data through various registers and other units. This unit
consists of an oscillator and controller sequencer which sends control signals
needed for internal and external control of data and other units. The oscillator
generates two-phase clock signals which aids in synchronizing all the registers
of 8085 microprocessor.
Signals that are associated with Timing and control unit are:
Control Signals: RD’, WR’, ALE
ALE is used for provide control signal to synchronize the
components of microprocessor and timing for instruction to
perform the operation.
RD (Active low) and WR (Active low) are used to indicate whether
the operation is reading the data from memory or writing the data
into memory respectively.
6
Dr. N. Karuppiah & Dr. S. Ravivarman
cycle HLDA goes low after the Hold request is removed. The CPU
takes the bus one half-clock cycle after HLDA goes low.
READY: This signal synchronizes the fast CPU and the slow memory,
peripherals. If READY is high during a read or write cycle, it
indicates that the memory or peripheral is ready to send or receive
data. If READY is low, the CPU will wait an integral number of clock cycle for
READY to go high before completing the read or write cycle. READY must
conform to specified setup and hold times.
Interrupt control
As the name suggests this control interrupts a process. Consider that a
microprocessor is executing the main program. Now whenever the interrupt
signal is enabled or requested the microprocessor shifts the control from main
program to process the incoming request and after the completion of request,
the control goes back to the main program. For example, an Input/output
device may send an interrupt signal to notify that the data is ready for input.
The microprocessor temporarily stops the execution of main program and
transfers control to I/O device. After collecting the input data, the control is
transferred back to main program. Interrupt signals present in 8085 are:
INTR
RST 7.5
RST 6.5
RST 5.5
TRAP
INTR is maskable 8080A compatible interrupt. When the interrupt occurs
the processor fetches from the bus one instruction, usually one of these
7
Dr. N. Karuppiah & Dr. S. Ravivarman
instructions: One of the 8 RST instructions (RST0 - RST7). The processor saves
current program counter into stack and branches to memory location N * 8
(where N is a 3 - bit number from 0 to 7 supplied with the RST instruction).
8
Dr. N. Karuppiah & Dr. S. Ravivarman
also to the internal data bus which consists of 8-bits. The address data buffer
can both send and receive data from internal data bus.
9
Dr. N. Karuppiah & Dr. S. Ravivarman
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.
1
0
Dr. N. Karuppiah & Dr. S. Ravivarman
Multiplexed Address/Data Bus; Lower 8 bits of the memory address (or I/0
address) appear on the bus during the first clock cycle of a machine state. It
then becomes the data bus during the second and third clock cycles. 3
stated during Hold and Halt modes.
It occurs during the first clock cycle of a machine state and enables the
address to get latched into the on chip latch of peripherals. The falling edge
of ALE is set to guarantee setup and hold times for the address information.
ALE can also be used to strobe the status information. ALE is never 3stated.
SO, S1 (OUTPUT)
RD (Output 3state)
READ: indicates the selected memory or 1/0 device is to be read and that
the Data Bus is available for the data transfer.
WR (Output 3state)
WRITE: Indicates the data on the Data Bus is to be written into the selected
1
memory or 1/0 location. Data is set up at the trailing edge of WR. 3 stated
1
during Hold and Halt modes.
READY (Input)
Dr. N. Karuppiah & Dr. S. Ravivarman
If Ready is high during a read or write cycle, it indicates that the memory or
peripheral is ready to send or receive data. If Ready is low, the CPU will
wait for Ready to go high before completing the read or write cycle.
HOLD (Input)
It indicates that another Master is requesting the use of the Address and
Data Buses. The CPU, upon receiving the Hold request will relinquish the
use of buses as soon as the completion of the current machine cycle.
Internal processing can continue.
ADDRESS BUS
Unidirectional
Identifying peripheral or memory location
DATA BUS
Bidirectional
Transferring data
CONTROL BUS
Synchronization signals
Timing signals
Control signal
1
2