Professional Documents
Culture Documents
UNIT I
Mr. S. VINOD
ASSISTANT PROFESSOR
EEE DEPARTMENT
8085 PROCESSOR
--Functional block diagram
--Signals
--Memory interfacing
--I/O ports and data transfer concepts
--Timing Diagram
--Interrupt structure.
The 8085 Microprocessor
Architecture
• The 8085 is an 8-bit general purpose microprocessor
that can address 64K Byte of memory.
• It has 40 pins and uses +5V for power. It can run at a
maximum frequency of 3 MHz.
– The pins on the chip can be grouped into 6 groups:
• Address Bus.
• Data Bus.
• Control and Status Signals.
• Power supply and frequency.
• Externally Initiated Signals.
• Serial I/O ports.
The Address and Data Busses
• The address bus has 8 signal lines A8 – A15 which are
unidirectional.
• The other 8 address bits are multiplexed (time shared)
with the 8 data bits.
– So, the bits AD0 – AD7 are bi-directional and serve as
A0 – A7 and D0 – D7 at the same time.
• During the execution of the instruction, these lines
carry the address bits during the early part, then
during the late parts of the execution, they carry
the 8 data bits.
– In order to separate the address from the data, we
can use a latch to save the value before the function
of the bits changes.
The Control and Status Signals
• There are 4 main control and status signals. These are:
• ALE: Address Latch Enable. This signal is a pulse that
become 1 when the AD0 – AD7 lines have an address on
them. It becomes 0 after that. This signal can be used to
enable a latch to save the address bits from the AD lines.
• RD: Read. Active low.
• WR: Write. Active low.
• IO/M: This signal specifies whether the operation is a
memory operation (IO/M=0) or an I/O operation (IO/M=1).
• S1 and S0 : Status signals to specify the kind of operation
being performed .Usually un-used in small systems.
Frequency Control Signals
• There are 3 important pins in the frequency control group.
– X0 and X1 are the inputs from the crystal or clock generating
circuit.
• The frequency is internally divided by 2.
– So, to run the microprocessor at 3 MHz, a clock running
at 6 MHz should be connected to the X0 and X1 pins.
– CLK (OUT): An output clock pin to drive the clock of the rest of
the system.
Logic operations
Examples:
15
Simple Data Transfer Operations
Example:
OUT 05 D3
05
16
Simple Memory Access Operations
17
Simple Memory Access Operations
18
Arithmetic Operations
19
Arithmetic Operations
20
Arithmetic Operations
21
Arithmetic Operations
22
Overview of Logic Operations
23
Logic Operations
24
Logic Operations
25
Logic Operations
26
Branching Operations
27
Branching Operations
28
Data transfer operation
– LHLD Load H & L Registers Directly from Memory
– SHLD Store H & L Registers Directly in Memory
– LXI Load Register Pair with Immediate data
– LDAX Load Accumulator from Address in Register Pair
– STAX Store Accumulator in Address in Register Pair
– XCHG Exchange H & L with D & E
– XTHL Exchange Top of Stack with H & L
Arithmetic Operations
• ADC Add to Accumulator Using Carry Flag
• ACI Add Immediate data to Accumulator Using Carry
• SBB Subtract from Accumulator Using Borrow (Carry) Flag
• SBI Subtract Immediate from Accumulator Using Borrow
(Carry) Flag
• INX Increment Register Pair by One
• DCX Decrement Register Pair by One
• DAD Double Register Add; Add Content of Register
Pair to H & L Register Pair
Logic Operations
The Compare instructions compare the content of an 8-bit value with
the contents of the accumulator
• CMP Compare
• CPI Compare Using Immediate Data
The rotate instructions shift the contents of the accumulator one bit
position to the left or right:
• RLC Rotate Accumulator Left
• RRC Rotate Accumulator Right
• RAL Rotate Left Through Carry
• RAR Rotate Right Through Carry
Complement and carry flag instructions:
• CMA Complement Accumulator
• CMC Complement Carry Flag
• STC Set Carry Flag
Branching Operations
the conditional branching instructions are specified as follows:
Jumps Calls Returns
C CC RC (Carry)
INC CNC RNC (No Carry)
JZ CZ RZ (Zero)
JNZ CNZ RNZ (Not Zero)
JP CP RP (Plus)
JM CM RM (Minus)
JPE CPE RPE (Parity Even)
JP0 CPO RPO (Parity Odd)
Two other instructions can affect a branch by replacing the contents or the
program counter:
PCHL Move H & L to Program Counter
RST Special Restart Instruction Used
with Interrupts
Stack I/O and Machine Control
Instructions
The following instructions affect the Stack and/or Stack
Pointer:
PUSH Push Two bytes of Data onto the Stack
POP Pop Two Bytes of Data off the Stack
XTHL Exchange Top of Stack with H & L
SPHL Move content of H & L to Stack Pointer
The Machine Control instructions are as follows:
EI Enable Interrupt System
DI Disable Interrupt System
HLT Halt
NOP No Operation
TIMING DIAGRAM
Timing Diagram is a graphical representation. It represents the
execution time taken by each instruction in a graphical format. The
execution time is represented in T-states.
Instruction Cycle:
The time required to execute an instruction is called instruction cycle.
Machine Cycle:
The time required to access the memory or input/output devices is
called machine cycle.
T-State:
The machine cycle and instruction cycle takes multiple clock periods.
A portion of an operation carried out in one system clock period is
called as T-state.
MACHINE CYCLES OF 8085
The 8085 microprocessor has 5 (seven) basic machine cycles.
• Opcode fetch cycle (4T)
• Memory read cycle (3 T)
• Memory write cycle (3 T)
• I/O read cycle (3 T)
• I/O write cycle (3 T)
Opcode fetch cycle (4T)
Memory Read Machine Cycle
Memory Write Machine Cycle
• The memory write machine cycle is executed by the processor to write a data byte
in a memory location.
• The processor takes, 3T states to execute this machine cycle.
I/O Write Cycle
• The I/O write machine cycle is executed by the processor to write a data byte in
the I/O port or to a peripheral, which is I/O, mapped in the system.
• The processor takes, 3T states to execute this machine cycle
Timing diagram for STA 526AH
• 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.
Timing diagram for IN C0H
• Fetching the Opcode DBH from the memory 4125H.
• Read the port address C0H from 4126H.
• Read the content of port C0H and send it to the accumulator.
• Let the content of port is 5EH.
INTERRUPT STRUCTURE
• Interrupt is signals send by an external device to the processor, to
request the processor to perform a particular task or work.
• Mainly in the microprocessor based system the interrupts are used
for data transfer between the peripheral and the microprocessor.
• The processor will check the interrupts always at the 2nd T-state
of last machine cycle.
• If there is any interrupt it accept the interrupt and 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.
• It returned to main program by RET instruction.
TYPES OF INTERRUPTS:
It supports two types of interrupts.
• Hardware
• Software
Software interrupts:
(1) TRAP
(2) RST 7.5
(3) RST6.5
(4) RST 5.5
(5) INTR
TRAP
• This interrupt is a non-maskable interrupt. It is unaffected by any
mask or interrupt enable.
• TRAP is the highest priority and vectored interrupt.
• TRAP interrupt is edge and level triggered. This means hat the
TRAP must go high and remain high until it is acknowledged.
• In sudden power failure, it executes a ISR and send the data from
main memory to backup memory.
• The signal, which overrides the TRAP, is HOLD signal. (i.e., If the
processor receives HOLD and TRAP at the same time then HOLD is
recognized first and then TRAP is recognized).
• There are two ways to clear TRAP interrupt.