28
8085 MICROPROCESSOR ARCHITECTURE AND PROGRAMMING

8085 microprocessor(1)

Embed Size (px)

Citation preview

Page 1: 8085 microprocessor(1)

8085 MICROPROCESSOR ARCHITECTURE AND PROGRAMMING

Page 2: 8085 microprocessor(1)

• Presented by:

PRATIK DATTA Roll no-10900311051

REEVU PAL Roll no-10900311070

PRATIP GHOSH Roll no-10900311052

RANADIP SAHA Roll no-10900311069

Page 3: 8085 microprocessor(1)

WHAT IS A MICROPROCESSOR A microprocessor is a multipurpose, programmable electronic device that accepts binary data as input ,processes the data and provides results as output.

It works in tandem with the storage memory containing data and instructions along with control unit, input and output devices amd forms a microcomputer.

Every microprocessor recognizes and processes ‘n’ number of binary digits(bits) at time and is known as the word length.It may vary from 4-bit to 64-bit.

MICROPROCESSOR

3

ALU REGISTER

ARRAY

CONTROL UNIT

INPUT/OUTPUT

MEMORY

SYSTEM BUS

Slide # 1of 26

Page 4: 8085 microprocessor(1)

8085- AN INTRODUCTION

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

Slide # 2 of 26

Page 5: 8085 microprocessor(1)

8085

High-OrderAddress Bus

MultiplexedAddress/Data

Bus

ALES0

S1IO/

HLDA

𝑊𝑅

𝑅𝐸𝑆𝐸𝑇𝐼𝑁

𝐼𝑁𝑇𝐴

HOLD

RST 6.5RST 5.5INTR

READY

TRAP

𝑅𝐷

RST 7.5

+5 V

GND

CLK OUTRESET OUT

6

78

910

3539

36

3811

21

19

12

3029

33

3432

31

A8

373

20401

vssvccX1 X2

2

28A15

AD0

AD7

PIN CONFIGURATION

SIDSOD

5

4

Slide #3 of 26

Page 6: 8085 microprocessor(1)

THE ADDRESS AND DATA BUSES 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.

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.

Slide # 4 of 26

Page 7: 8085 microprocessor(1)

DEMULTIPLEXING AD7-AD0 The basic requirement of demultiplexing is to save the total

16bit address for the entire duration of execution of an instruction.

To make sure we have the entire address for the full three clock

cycles, we will use an external latch to save the value of AD7–

AD0 when it is carrying the address bits. We use the ALE

signal ,which is kept high to enable this latch.

Then when ALE goes low, the address is saved and the AD7– AD0

lines carry the data bits D7-D0.

8085

ALE

A15-A8

LatchAD7-AD0 A7- A0

D7- D0

Slide # 5 of 26

Page 8: 8085 microprocessor(1)

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.

RD : Read- Active low,signifying ‘read’ operation WR : Write- Active low,signifying ‘write’ operation. IO/ : This signal specifies whether the operation is a memory operation (IO/=0) or an I/O operation (IO/=1).

S1 and S0 : Status signals to specify the kind of operation being performed

Slide # 6 of 26

Page 9: 8085 microprocessor(1)

CLOCK SIGNALS AND PINS

• 8085 MPU has 3 pins that control or present the clock signal.

• X1 and X2 pins determinethe clock frequency.

• CLK OUT is a square-wave output clock.

• The CLOCK OUT is one-half the crystal frequency.

8085A

X1 CLK OUT

X2

6 MHz

Slide # 7 of 26

Page 10: 8085 microprocessor(1)

INTERRUPT AND EXTERNALLY INITIATED SIGNALS

• INTR and are general purpose interrupts,the former being an input signal from peripherals and later being output to the corresponding source.

• RST 7.5,6.5,5.5 are vectored interrupts that transfer the program control to specified memory locations.The priority order is 7.5>6.5>5.5.

• TRAP is a Non-maskable interrupt that has the highest priority.

• HOLD , READY(Input) and HLDA are used for communication with other devices and peripherals.

Slide # 8 of 26

Page 11: 8085 microprocessor(1)

BLOCK DIAGRAM OF 8085 MICROPROCESSOR

INTERRUPT CONTROL SERIAL I/O CONTROL

ACCUMULATOR

TEMP.REGISTE

RS

TIMING AND CONTROL UNIT

INSTRUCTION

REGISTERS

INSTRUCTION DECODER &

MACHINE CYCLE

ENCODING

ADDRESS(HIGH) BUFFER

ADDRESS(LOW)/DATA BUFFER

B Register

C Register

D Register

E Register

H Register

L Register

Stack Pointer

Program Counter

+5VGNDX1

X2

CLK OUT READ

Y 𝑅𝐷 ALE

S0

S1HLDA𝑅𝐸𝑆𝐸𝑇 𝐼𝑁

RESET OUT

𝑊𝑅 IO/ HOLD

8 BIT INTERNAL REGISTER

REGISTER ARRAY

SID

SOD

RST 7.5

RST 5.5

TRAPINTR

𝐼𝑁𝑇𝐴

FLAG FLIP-FLOPS

ARITHMETIC

LOGIC UNIT

RST 6.5

Slide # 9 of 26

Page 12: 8085 microprocessor(1)

PROGRAMMING MODEL OF 8085

Accumulator: It is 8 bit general purpose register connected to ALU.

Performs arithmetic and logical operations.

Result of an operation is stored in accumulator

Temporary register: All the arithmetic and logical operations are done in the temporary register but user can’t access it.

It is not available for user.

Accumulator

ALU

Flags

Instruction Decoder

Register Array

Memory Pointer

Registers

Timing and Control Unit

16-bit Address Bus

8-bit Data Bus

Control Bus

Slide # 10 of 26

Page 13: 8085 microprocessor(1)

FLAG REGISTERS

Flag Register: It is a group of 5 flip flops used to know status of various operations done and is given by:

S: Sign flag is set when result of an operation is negative. Z: Zero flag is set when result of an operation is 0. AC: Auxiliary carry flag is set when there is a carry out of lower

nibble or lower four bits of the operation. CY: Carry flag is set when there is carry generated by an

operation. P: Parity flag is set when result contains even number of 1’s.

Rest(X) are don’t care flip flops. 8085 uses these flags in decision-making process.

S Z X AC X P X CY

Slide # 11 of 26

Page 14: 8085 microprocessor(1)

INSTRUCTION SET OF 8085

An instruction is a binary pattern designed inside a microprocessor to perform a specific function.

8085 has 246 instructions. Each instruction is represented by an 8-bit binary value. These 8-bits of binary value is called Op-Code or Instruction Byte.

8085 instructions can be classified as:

1. Data Transfer (Copy)

2. Arithmetic

3. Logical and Bit manipulation

4. Branch

5. Machine Control

Slide # 12 of 26

Page 15: 8085 microprocessor(1)

DATA TRANSFER (COPY) OPERATIONSThese instructions move data between registers, or between memory and registers, from source to destination.

Before Instructions After Instructions

Load a 8-bit number 4F in register B:MVI B, 4FH B B

Copy from Register B to Register A:MOV A,B A A

B B

Load a 16-bit number 2050 in H H

Register pair HL:LXI H, 2050H L L

Copy from Register B to H H Memory Address 2050 Containing data 9FH:MOV M,B L L B B

XX 4FH

XX4FH4FH

4FH

XXXX

20H50H

2050

2050

XX 9FH

Slide # 14 of 26

Page 16: 8085 microprocessor(1)

ARITHMETIC OPERATIONS / INSTRUCTIONS

These instructions perform the operations like: Addition, Subtraction, Increment Decrement , etc. Before Instructions After

Instructions

Add a 8-bit number 32H to Accumulator: ADI 09H A A Data

Add contents of Register B to Accumulator: ADD B A A B B

Subtract a 8-bit no.32H from Accumulator: SUI 32H

Subtract contents of Register C from Accumulator: SUB C

Increment the contents of Register D by 1: INR D D D

Decrement the contents of Register E by 1: DCR E E E

07H

09H

10H

07H

09H

10H

09H

FFH 00H

FFHFEH

Slide # 15 of 26

Page 17: 8085 microprocessor(1)

LOGICAL & BIT MANIPULATION OPERATIONS

1.Logically AND Register H with Accumulator: ANA H2.Logically OR Register L with Accumulator: ORA L3.Logically XOR Register B with Accumulator: XRA B4.Compare contents of Register C with Accumulator:

CMP C

5.Complement Accumulator: CMA6.Rotate Accumulator Left: RAL

Slide # 16 of 26

Page 18: 8085 microprocessor(1)

BRANCHING OPERATIONSThese operations are used to control the flow of program execution

1. Jump to a 16-bit Address 2080H if Carry flag is SET: JC 2080H

2. Unconditional Jump: JMP 2050H

3. Call a subroutine with its 16-bit Address: CALL 3050H

4. Return back from the Call: RET

5. Call a subroutine with its 16-bit Address if Carry flag is RESET: CNC 3050H

6. Return if Zero flag is SET: RZ

MACHINE CONTROL INSTRUCTIONS

7. Stop program execution: HLT

8. Do not perform any operation: NOP

Slide # 17 of 26

Page 19: 8085 microprocessor(1)

TIMING DIAGRAM FOR STA 526AH :Slide # 18 of 26

Page 20: 8085 microprocessor(1)

STACK AND SUBROUTINES• The Stack is a set of Memory locations ,either specified by the user or is allotted by default , which stores information bytes temporarily.

• Say, If stack pointer is loaded with 2099H,the storing of bytes begins at 2098H and

continues in decreasing order such as 2098H,2097H etc.

• Instruction ‘PUSH’ is used to store data bytes(two at a time) on the stack and ‘POP’ is used to retrieve data back to the respective registers.

• EG: LXI SP,2099H

LXI D,42F2H

PUSH D POP B

• Subroutine is a group of instructions written separately to perform a functionwhich occurs repeatedly in the main program.

• ‘CALL’ is used to transfer execution to specified address and ‘RET’ is used to resume main program execution.

MEMORY

MEM ADDRESS

F2 2097

42 2098

XX 2099

D 42 F2 E

B 42

C F2

PUSH

POP

Slide # 19 of 26

Page 21: 8085 microprocessor(1)

COUNTERS AND DELAY

• A counter is designed by loading a number into one of the registers and using INR/DCR/INX/DCX instructions.

• A loop is established to update the count and checking is done through JNZ/JZ instructions whether or not to continue the loop.

• For a certain clock period, depending upon the No. of T-states of instructions, every count generates a different time delay.

• Eg.: MVI C,FFH

LOOP: DCR C JNZ LOOP

MVI takes 7 T-states , JNZ takes 10.Hence for a clock period of

0.5µsec, the loop continues for 255(FFH) times and a delay of 1.8ms

is generated.

• For larger amount of delay , a Register pair as well as a loop within loop techniques can be used to achieve the required delay.

Slide # 20 of 26

Page 22: 8085 microprocessor(1)

MICROPROCESSOR BASED TRAFFIC CONTROL SYSTEM

The Basic Objective is to design a Traffic control System with a provided on/off time to three traffic lights-GREEN, YELLOW and RED.

This is done by using 8255 peripheral interface which can be programmed to transfer data under given conditions.

Fig. shows the interfacing diagram to control 12 LED’s. Port A is used to control lights on N-S road and Port B is used to control lights on W-E road.

For understanding the basic application of 8085here we have demonstrated only for North-South and East-West movement only. Further development can be done once the basic procedure is understood

22

Slide # 21 of 26

Page 23: 8085 microprocessor(1)

SOFTWARE FOR TRAFFIC LIGHT CONTROL

• Control word for Initialisation of 8255: 80H

I/O Mode Port A in Mode0 Port A=Output Port B in Mode0 Port B=Output

• Data bytes to be sent for specific combination

Similarly to glow Y1 and Y2 Port A output=12H , Y3 and Y4 Port

B output=12H.

To glow R3 and R4 Port A output=09H , G1 and G2 Port B

output=24H.

IO/BSR MODE A

PORT A PORT C H

MODE B

PORT B PORT C L

1 0 0 0 X 0 0 X

TO GLOW

PA7

PA6

PA5

PA4

PA3

PA2

PA1

PA0

PORT A OUTPUT

PB7

PB6

PB5

PB4

PB3

PB2

PB1

PB0

PORT B OUTPUT

R1,R2,G3,G4

X X 1 0 0 1 0 0 24H X X 0 0 1 0 0 1 09H

Slide # 22 of 26

Page 24: 8085 microprocessor(1)

FLOW CHART FOR PROGRAM EXECUTION

Address of Control Register=83H

Data for port A=24H,port B=09H

Delay Generated= 10sec

Data for port A=12H,Port B=12H

Delay generated=03 sec

Send Data to Port A,B to glow

R1,R2,G3,G4

Call Delay subroutine using

count of 14H

Send Data to Port A,B to glow

Y1,Y2,Y3,Y4

24

Slide # 23 of 26

Initialize Port A,B of 8255 in output

mode

Call Delay

subroutine using count of

06H

Page 25: 8085 microprocessor(1)

Send Data to Port A,B to glow

R3,R4,G1,G2Data for Port A=09H,Port B=24H

Call Delay Subroutine using

count of 14H

Send Data to Port A,B to glow Y1,Y2,Y3,Y4

Delay generated=10 sec

Data for Port A=12H,Port B=12H

Call Delay Subroutine using

count of 06H

Delay Generated=06 sec

Use Unconditional Jump to startingaddress: JMP START 25

Slide # 24 of 26

Return to start and continue the

process

Page 26: 8085 microprocessor(1)

CONCLUSION

The 8085 processor was used in a few early personal computers, produced from1977 to early-to-mid-1980’s.

Now-a-days, in many engineering schools the 8085 processor is used in introductory microprocessor courses.

However with time, better quality microprocessors have been developed with greater bit processing capability(32 and 64 bit ) along with huge no of other modifications

Slide # 25 of 26

Page 27: 8085 microprocessor(1)

REFERENCES AND BIBLIOGRAPHY• BOOKS:

• Microprocessor Architecture, Programming and Applications with the 8085 by Ramesh Gaonkar.

• Fundamentals of Microprocessors and Microcontroller by B.Ram .

• INTERNET:

• http://en.wikipedia.org/wiki/Intel_8085

• http://www.nptel.ac.in/courses/Webcourse-contents/IISc-BANG/Microprocessors and Microcontrollers

• http://instrumentationandcontrollers.blogspot.in/2011/01/microprocessor-based-traffic-light.html

Slide # 26 of 26

Page 28: 8085 microprocessor(1)

THANK YOU