+ All Categories
Home > Documents > 8085 and 8051 presentation

8085 and 8051 presentation

Date post: 10-Apr-2015
Category:
Upload: jitendra-chuugh
View: 1,402 times
Download: 0 times
Share this document with a friend
54
SUMMER TRAINING PRESENTATION ON MICROPROCESSOR 8085 AND MICROCONTROLLER 8051
Transcript
Page 1: 8085 and 8051 presentation

SUMMER TRAINING PRESENTATION ON MICROPROCESSOR

8085 AND MICROCONTROLLER

8051

Page 2: 8085 and 8051 presentation

MICROPROCESSOR 8085

An Introduction to its architecture and

assembly language programming

Page 3: 8085 and 8051 presentation

8085 INTRODUCTION

The features of INTEL 8085 are :

• It is an 8 bit processor.

• It is a single chip N-MOS device with 40 pins.

• It has multiplexed address and data bus.(AD0-AD7).

• It works on 5 Volt dc power supply.

• The maximum clock frequency is 3 MHz.

• It provides 74 instructions with 4 different addressing modes.

Page 4: 8085 and 8051 presentation

8085 INTRODUCTION It provides 16 address lines so it can access 2^16

=64K bytes of memory. It generates 8 bit I/O address so it can access

2^8=256 input ports. It provides 5 hardware interrupts:TRAP, RST 5.5,

RST 6.5, RST 7.5,INTR. It provides Acc ,one flag register ,6 general purpose

registers and two special purpose registers(SP,PC). It provides serial lines SID ,SOD.So serial peripherals

can be interfaced with 8085 directly.

Page 5: 8085 and 8051 presentation

8085 PIN DIAGRAM

Page 6: 8085 and 8051 presentation

8085 PIN DESCRIPTION

Some important pins are : AD0-AD7: Multiplexed Address and data lines.

A8-A15: Tri-stated higher order address lines. ALE: Address latch enable is an output signal.It

goes high when operation is started by processor . S0,S1: These are the status signals used to

indicate type of operation. RD¯: Read is active low input signal used to read

data from I/O device or memory. WR¯:Write is an active low output signal used

write data on memory or an I/O device.

Page 7: 8085 and 8051 presentation

8085 PIN DESCRIPTION

o READY:This an output signal used to check the status of output device.If it is low, µP will WAIT until it is high.

o TRAP:It is an Edge triggered highest priority , non mask able interrupt. After TRAP, restart occurs and execution starts from address 0024H.

o RST5.5,6.5,7.5:These are maskable interrupts and have low priority than TRAP.

o INTR¯&INTA:INTR is a interrupt request signal after which µP generates INTA or interrupt acknowledge signal.

o IO/M¯:This is output pin or signal used to indicate whether 8085 is working in I/O mode(IO/M¯=1) or Memory mode(IO/M¯=0 ).

Page 8: 8085 and 8051 presentation

8085 PIN DESCRIPTION

o HOLD&HLDA:HOLD is an input signal .When µP receives HOLD signal it completes current machine cycle and stops executing next instruction.In response to HOLD µP generates HLDA that is HOLD Acknowledge signal.

o RESET IN¯:This is input signal.When RESET IN¯ is low µp restarts and starts executing from location 0000H.

o SID: Serial input data is input pin used to accept serial 1 bit data .

o X1X2 :These are clock input signals and are connected to external LC,or RC circuit.These are divide by two so if 6 MHz is connected to X1X2, the operating frequency becomes 3 MHz.

o VCC&VSS:Power supply VCC= +5Volt& VSS=-GND reference.

Page 9: 8085 and 8051 presentation

REGISTER GROUP Temporary registers (W,Z):These are not available for

user. These are loaded only when there is an operation being performed.

General purpose:There are six general purpose registers in 8085 namely B,C,D,E,H,L.These are used for various data manipulations.

Accumulator :All the arithmetic and logical operations are performed here.

Special purpose :There are two special purpose registers in 8085:

1. SP :Stack Pointer.2. PC:Program Counter.

Page 10: 8085 and 8051 presentation

REGISTER GROUP Stack Pointer: This is a temporary storage memory 16

bit register. Since there are only 6 general purpose registers, there is a need to reuse them .

Whenever stack is to be used previous values are PUSHED on stack and then after the program is over these values are POPED back.

Program Counter: It is 16 bit register used to point the location from which the next instruction is to be fetched.

When a single byte instruction is executed PC is automatically incremented by 1.

Upon reset PC contents are set to 0000H and next instruction is fetched onwards.

Page 11: 8085 and 8051 presentation

FLAG REGISTER

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.

SS ZZ XX ACAC XX PP XX CYCY

Page 12: 8085 and 8051 presentation

8085 ARCHITECTURE

Page 13: 8085 and 8051 presentation

INSTRUCTIONS SET OF 8085

Page 14: 8085 and 8051 presentation

DATA TRANSFER GROUP MOV Rd, M (Move data from Memory to Rd).

MOV Rd, Rs.(Move data from Rs to Rd). MVI R, Data.(Move Immediate data to

Register). LXI Rp,16 bit .(Load 16 bit data to Register pair

Immediate). LHLD address.(Load HL pair with data from

address). OUT 8 bit address (Move the data from Acc to

address)

Page 15: 8085 and 8051 presentation

ARITHMETIC GROUP ADD R (ADD register content with Acc and result in A ).

ADD M(ADD H or L Register content with Acc and result in A).

ADI Data(ADD immediate data with Acc and result in A ).

ADC R (ADD register content with Acc and carry and result in A ).

DAD Rp (Add specified register pair with HL pair)

INR R (Increment register content by 1 ).

DCR R (Decrement register content by 1 ).

INX Rp (Increment register pair content by 1 ).

Page 16: 8085 and 8051 presentation

LOGICAL GROUP ANA R (Logically AND register content with Acc and

result in A ). ANI Data (Logically AND immediate data with Acc and

result in A ). ORA R (Logically OR register content with Acc and

result in A5 ). ORI Data (Logically OR immediate data with Acc and

result in A ). XRA R (Logically XOR register content with Acc and

result in A ). CMP R (Compare register content with Acc and result

in A ).

Page 17: 8085 and 8051 presentation

LOGICAL GROUP CPI Data (Compare immediate data with Acc ).

RLC (Rotate accumulator left ).

RAL (Rotate accumulator left with carry ).

RRC (Rotate accumulator right ).

Page 18: 8085 and 8051 presentation

BRANCH GROUP

JMP address(Unconditional jump to address) RET (Return from subroutine) RST (Restart instruction)

Page 19: 8085 and 8051 presentation

CALL ADDRESS(UNCONDITIONAL CALL FROM ADDRESS)

Example:CALL C200H. After this instruction the Program Counter is

loaded with this location and starts executing and the contents of PC are loaded on Stack.

Flags Affected :No Flags are affected.Addressing mode:Immediate

Page 20: 8085 and 8051 presentation

BRANCH GROUPConditional Jump Instructions. JC (Jump if Carry flag is set) JNC (Jump if Carry flag is reset) JZ (Jump if zero flag set) JNZ (Jump if zero flag is reset) JPE (Jump if parity flag is set) JPO (Jump if parity odd or P flag is reset ) JP (Jump if sign flag reset ) JM (Jump if sign flag is set or minus)

Page 21: 8085 and 8051 presentation

ADDRESSING MODES OF 8085

Immediate addressing: Immediate data is transferred to address or

register.Example:MVI A,20H. Transfer immediate data 20H to

accumulator. Number of bytes:Either 2 or 3 bytes long.1st byte is opcode.2nd byte 8 bit data .3rd byte higher byte data of 16 bytes.

Page 22: 8085 and 8051 presentation

ADDRESSING MODES OF 8085

Register addressing:Data is transferred from one register to other.Example:MOV A, C :Transfer data from C register to

accumulator. Number of bytes:Only 1 byte long.One byte is opcode.

Page 23: 8085 and 8051 presentation

ADDRESSING MODES OF 8085

Direct addressing: Data is transferred from direct address to other

register or vice-versa.Example:LDA C200H .Transfer contents from C200H to Acc. Number of bytes:These are 3 bytes long.1st byte is opcode.2nd byte lower address.3rd byte higher address.

Page 24: 8085 and 8051 presentation

ADDRESSING MODES OF 8085

Indirect addressing: Data is transferred from address pointed by

the data in a register to other register or vice-versa.

Example:MOV A, M: Move contents from address pointed

by M to Acc. Number of bytes:These are 3 bytes long.1st byte is opcode.2nd byte lower address.3rd byte higher address.

Page 25: 8085 and 8051 presentation

TIMING AND STATE DIAGRAM

The µP operates with reference to clock signal.The rise and fall of the pulse of the clock gives one clock cycle.

Each clock cycle is called a T state and a collection of several T states gives a machine cycle.

Important machine cycles are :1. Op-code fetch.2. Memory read.3. Memory write. 4. I/Op-read.5. I/O write.

Page 26: 8085 and 8051 presentation

TIMING AND STATE DIAGRAM

Op-code Fetch:It basically requires 4 T states from T1-T4

The ALE pin goes high at first T state always. AD0-AD7 are used to fetch OP-code and store the

lower byte of Program Counter. A8-A15 store the higher byte of the Program

Counter while IO/M¯ will be low since it is memory related operation.

RD¯ will only be low at the Op-code fetching time. WR¯ will be at HIGH level since no write operation

is done. S0=1,S1=1 for Op-code fetch cycle.

Page 27: 8085 and 8051 presentation

TIMING AND STATE DIAGRAM

Op-code fetch cycle :

Page 28: 8085 and 8051 presentation

TIMING AND STATE DIAGRAM

Memory Read Cycle: It basically requires 3T states from T1-T3 .

The ALE pin goes high at first T state always. AD0-AD7 are used to fetch data from memory and

store the lower byte of address. A8-A15 store the higher byte of the address while IO/M¯

will be low since it is memory related operation. RD¯ will only be low at the data fetching time. WR¯ will be at HIGH level since no write operation is

done. S0=0,S1=1 for Memory read cycle.

Page 29: 8085 and 8051 presentation

TIMING AND STATE DIAGRAM

Memory write Cycle: It basically requires 3T states from T1-T3 .

The ALE pin goes high at first T state always. AD0-AD7 are used to fetch data from CPU and

store the lower byte of address. A8-A15 store the higher byte of the address while

IO/M¯ will be low since it is memory related operation.

RD¯ will be HIGH since no read operation is done. WR¯ will be at LOW level only when data fetching

is done. S0=1,S1=0 for Memory write cycle.

Page 30: 8085 and 8051 presentation

INTERRUPTS IN 8085 Interrupt is a process where an external device

can get the attention of the microprocessor. An interrupt is considered to be an emergency

signal that may be serviced. The Microprocessor may respond to it as soon as

possible.

Classification of Interrupts Interrupts can be classified into two types:

Maskable Interrupts (Can be delayed or Rejected) Non-Maskable Interrupts (Can not be delayed or Rejected)

Page 31: 8085 and 8051 presentation

INTERRUPTS IN 8085 The 8085 has 5 interrupt inputs.

The INTR input. The INTR input is the only non-vectored interrupt. INTR is mask-able using the EI/DI instruction pair.

RST 5.5, RST 6.5, RST 7.5 are all automatically vectored.

RST 5.5, RST 6.5, and RST 7.5 are all mask-able.

TRAP is the only non-mask-able interrupt in the 8085 TRAP is also automatically vectored.

Page 32: 8085 and 8051 presentation

SIM INSTRUCTION-SET INTERRUPT MASK

32

SO

DS

DE

XX

XR

7.5

MS

EM

7.5

M6.

5M

5.5

01234567

RST5.5 Mask

RST6.5 MaskRST7.5 Mask

} 0 - Available1 - Masked

Mask Set Enable0 - Ignore bits 0-21 - Set the masks according to bits 0-2

Force RST7.5 Flip Flop to resetNot Used

Enable Serial Data0 - Ignore bit 71 - Send bit 7 to SOD pin

Serial Out Data

•SIM Instruction helps activate a particular interrupt.

•It can also mask a maskable interrupt.

Page 33: 8085 and 8051 presentation

RIM INSTRUCTION-READ INTERRUPT MASK

Serial Data In

RST5.5 Interrupt Pending

RST6.5 Interrupt PendingRST7.5 Interrupt Pending

0 - Available1 - Masked

Interrupt EnableValue of the Interrupt EnableFlip Flop

SD

IP

7.5

P6.

5P

5.5

IEM

7.5

M6.

5M

5.5

01234567

RST5.5 Mask

RST6.5 MaskRST7.5 Mask

}

•Using the RIM instruction, it is possible to read the status of the interrupt lines and find if there are any pending interrupts.

Page 34: 8085 and 8051 presentation

Microcontrollers

8051

Page 35: 8085 and 8051 presentation

MICROPROCESSOR Vs MICRO CONTROLLER

General-purpose microprocessors

Must add RAM, ROM, I/O ports, and timers externally to make them functional

Make the system bulkier and much more expensive

Have the advantage of versatility on the amount of RAM, ROM, and I/O ports

Microcontroller The fixed amount of on-

chip ROM, RAM, and number of I/O ports makes them ideal for applications in which cost and space are critical.

In many applications, the space it takes, the power it consumes, and the price per unit are much more critical considerations than the computing power

Page 36: 8085 and 8051 presentation

MICROPROCESSOR Vs MICRO CONTROLLER

Page 37: 8085 and 8051 presentation

FEATURES: The Intel 8051 is used in embedded

systems8-bit CPU4k bytes ROM for the program128 BYTES of RAM for variables32 I/O lines ( 4 PORTS WITH 8 EACH )2 timers1 Serial port6 interrupt sources

Page 38: 8085 and 8051 presentation

BLOCK DIAGRAM

CPU

InterruptControl

OSC BusControl

4kROM

Timer 1Timer 2

Serial

128 bytes RAM

4 I/O Ports

TXD RXD

External Interrupts

P0 P2 P1 P3Addr/Data

Page 39: 8085 and 8051 presentation

1234567891011121314151617181920

4039383736353433323130292827262524232221

P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7RST

(RXD)P3.0(TXD)P3.1

(T0)P3.4(T1)P3.5

XTAL2XTAL1

GND

(INT0)P3.2(INT1)P3.3

(RD)P3.7(WR)P3.6

VccP0.0(AD0)P0.1(AD1)P0.2(AD2)P0.3(AD3)P0.4(AD4)P0.5(AD5)P0.6(AD6)P0.7(AD7)EA/VPPALE/PROGPSENP2.7(A15)P2.6(A14)P2.5(A13)P2.4(A12)P2.3(A11)P2.2(A10)P2.1(A9)P2.0(A8)

8051

8051 – 40 PIN IC

Page 40: 8085 and 8051 presentation

PORT PORT3 MULTIPLE FUNCTIONS

Page 41: 8085 and 8051 presentation

IMPORTANT PINS

PSENPSEN (out): (out): PProgram rogram SStore tore EnEnable, the read signal able, the read signal for external program memory (active low).for external program memory (active low).

ALEALE (out): (out): AAddress ddress LLatch atch EEnable, to latch address nable, to latch address outputs at Port0 and Port2outputs at Port0 and Port2

EAEA (in): (in): EExternal xternal AAccess Enable, active low to ccess Enable, active low to access external program memory locations 0 to 4K access external program memory locations 0 to 4K

RXDRXD,,TXDTXD: UART pins for serial I/O on Port 3: UART pins for serial I/O on Port 3

XTAL1XTAL1 & & XTAL2XTAL2: Crystal inputs for internal : Crystal inputs for internal oscillator.oscillator.

Page 42: 8085 and 8051 presentation

SIGNALS - OPERATION

Vcc ( pin 40):Vcc provides supply voltage to the chip. The voltage source is +5V.

GND ( pin 20): ground XTAL1 and XTAL2 ( pins 19,18):

These 2 pins provide external clock.Way 1 : using a quartz crystal oscillator Way 2 : using a TTL oscillator

Page 43: 8085 and 8051 presentation

REGISTERS

0706050403020100

R7R6R5R4R3R2R1R0

0F

08

17

10

1F

18

Bank 3

Bank 2

Bank 1

Bank 0

Four Register BanksEach bank has R0-R7

Page 44: 8085 and 8051 presentation

PROGRAM STATUS WORD

Page 45: 8085 and 8051 presentation

A PIN OF PORT

8051 IC

D Q

Clk Q

Vcc

Load(L1)

Read latch

Read pin

Write to latch

Internal CPU bus

M1

P1.X pinP1.X

TB1

TB2

Page 46: 8085 and 8051 presentation

TIMERS/COUNTERS

The 8051 has 2 timers/counters: Timer/Counter 0 Timer/Counter 1

They can be used as1. The Timer :Used as a time delay generator.

The clock source is the internal crystal frequency of the 8051.

2. An event counter. External clock pulse from input pin to count the

number of events on registers.

Page 47: 8085 and 8051 presentation

TMOD REGISTER

Both Timer 0 &Timer 1 use the same Mode register TMOD.

It is an-8-bit register which is used to control the timers. The lower 4-bits are meant for Timer 0 &the upper 4-bits are meant for Timer 1

It is used similar to any other register of 8051 . For ex: MOV TMOD,#21H

GATE C/T M1 M0 GATE C/T M1 M0Timer 1 Timer 0

(MSB) (LSB)

Page 48: 8085 and 8051 presentation

TCON:TIMER/COUNTER CONTROL

REGISTER

Page 49: 8085 and 8051 presentation

8051- SERIAL 8051- SERIAL COMMUNICATIONCOMMUNICATION

Page 50: 8085 and 8051 presentation

BASICS OF SERIAL COMMUNICATION

Page 51: 8085 and 8051 presentation

TYPES OF SERIAL COMMUNICATION

Page 52: 8085 and 8051 presentation

SCON

Page 53: 8085 and 8051 presentation

Each interrupt has a specific place in code memory where program execution (interrupt service routine) begins.

Reset : 0000h INT0 : 0003h Timer 0 overflow(TF0): 000Bh INT1 : 0013h Timer 1 overflow(TF1): 001Bh Serial : 0023h

VECTOR INTERRUPTS

Page 54: 8085 and 8051 presentation

EA : Global enable/disable. --- : Undefined. ET2 :Enable Timer 2 interrupt. ES :Enable Serial port interrupt. ET1 :Enable Timer 1 interrupt. EX1 :Enable External 1 interrupt. ET0 : Enable Timer 0 interrupt. EX0 : Enable External 0 interrupt.

INTERRUPT ENABLE REGISTER


Recommended