HOW TO WORK IN 8085 -...

34
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING Year & Sem : III & VI Name of the Subject: Microprocessor and Microcontroller Lab Branch : ECE HOW TO WORK IN 8085: Press ASM. Enter the starting address (8000). Press next (,). Type the mnemonic. Press enter twice. After completing the program, press esc. To give input data : press memory(m). Type the location. Enter data. Press next for each data to save. Press esc. To execute the program : press go (g). Enter the starting address of the main program. Press enter. To view the output: press memory (m). Give the location of the result. Press next to see the subsequent output.

Transcript of HOW TO WORK IN 8085 -...

Page 1: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING

Year & Sem : III & VI

Name of the Subject: Microprocessor and Microcontroller Lab Branch : ECE

HOW TO WORK IN 8085:

Press ASM.

Enter the starting address (8000).

Press next (,).

Type the mnemonic.

Press enter twice.

After completing the program, press esc.

To give input data : press memory(m).

Type the location. Enter data.

Press next for each data to save.

Press esc.

To execute the program : press go (g).

Enter the starting address of the main program.

Press enter.

To view the output: press memory (m).

Give the location of the result.

Press next to see the subsequent output.

Page 2: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

To view the program : press disp(z).

Give the starting and the ending address of the program.

Press next.

To edit the program : Press Asm and enter the corresponding address of the mnemonic to

be modified.

8085 PROGRAMS

8 BIT MULTIPLICATION:

LXI H, 0000

MVI B, 00

LDA 8080

MOV C, A

LDA 8081

MOV D, A

L2: DAD B

DCR D

JZ L1

JMP L2

L1: SHLD 9000

RST 1

Observation :

Input:

8080 : Input1

8081 : Input 2

Output:

9000 : Output 9001 : Carry

Page 3: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

8 BIT DIVISION:

LDA 8090

MOV B, A

LDA 8091

MVI C, 00

STEP1: CMP B

JC STEP2

SUB B

INR C

JMP STEP1

STEP2: STA 9000

MOV A, C

STA 9001

RST 1

Observation :

Input:

8090 : Divisor

8091 : Dividend

Output:

9000 : Quotient

9001 : Remainder

Page 4: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

16 BIT MULTIPLICATION:

LHLD 8080

SPHL

LHLD 8082

XCHG

LXI H, 0000

LXI B, 0000

L1: DAD SP

JNC NEXT

INX B

NEXT: DCX D

MOV A,E

ORA D

JNZ L1

SHLD 9000

MOV L, C

MOV H, B

SHLD 9001

RST 1

Observation :

Input:

8080 : LSB1

8081 : MSB1

8082 : LSB2

8083 : MSB2

Page 5: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

Output:

9000 : Output

9001 : Carry

16 BIT DIVISION:

LHLD 8080

XCHG

LHLD 8082

LXI B, 0000

LOOP: MOV A, L

SUB E

MOV L, A

MOV A, H

SBB D

MOV H, A

INX B

JNC LOOP

DCX B

DAD D

SHLD 9000

MOV A, C

STA 9001

MOV A, B

STA 9002

RST 1

Page 6: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

Observation :

Input:

8080 : LSB1

8081 : MSB1

8082 : LSB2

8083 : MSB2

Output:

9000 : Quotient LSB

9001 : Quotient MSB

9002 : Remainder

BIT MANIPULATION:

(To count number of 1’s)

LDA 8500H

MVI B, 00H

MVI C, 08H

BACK: RAR

JNC SKIP

INR B

SKIP: DCR C

JNZ BACK

MOV A, B

STA 8501H

RST 1

Page 7: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

Observation:

8500 : input

8501 : output

CODE CONVERSION:

BCD T0 HEXADECIMAL:

LDA 8500H

MOV B, A

ANI OFH

MOV C, A

MOV A, B

ANI FOH

RRC

RRC

RRC

RRC

MOV B, A

XRA A

MVI D, OAH

LOOP: ADD D

DCR B

JNZ LOOP

ADD C

STA 8501

RST 1

Page 8: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

Observation:

8500 : input BCD number

8501 : output Hexadecimal value

HEXADECIMAL TO BCD:

LXI H, 0000H

LXI B, 0000H

MOV A, M

LOOP1: SUI 64H

JC LOOP

INR B

JMP LOOP1

LOOP2: ADI 64H

LOOP4: SUI OAH

JC LOOP3

INR C

JMP LOOP4

LOOP3: ADI OAH

INX H

MOV M, B

MOV B, A

MOV A, C

RLC

RLC

RLC

RLC

Page 9: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

ADD B

INX H

MOV M, A

RST 1

Observation:

8500 : input Hexadecimal number

8501 : output BCD value

HEXADECIMAL TO ASCII:

LXI H, 8500H

LXI D, 8502

MOV A, M

CPI OAH

JNC NEXT

ADI 30H

JMP LOOP

NEXT: ADI 37H

LOOP1: STAX D

RST 1

LXI H, 8500H

LXI D, 8502H

MVI C, 05H

LOOP: MOV A,M

CPI OAH

JNC NEXT

ADI 30H

Page 10: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

JMP LOOP1

NEXT: ADI 37H

LOOP1: STAX D

INX H

INX D

DCR C

JNZ LOOP

RST 1

Observation:

8500 : input Hexadecimal number

8501 : output ASCII value

HOW TO WORK IN 8086:

Press asm twice.

Type sg 0000

Press enter

Type da starting address (4000)

Press enter

Press new(n)

Give one space and type the mnemonic.

Press enter once and new(n) twice.

After completing the program, press shift + 1 (!)

To give input value: press exam byte(e) for 8 bit data. Give the location, type the data and

press next.

Press exam word (w) fro 16 bit data. Give the location, type the data and press next.

To execute the program : press go(g).

Page 11: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

Give the starting address of the main program.

Press enter.

To view the result : press exam byte(e) for 8 bit data. Enter the location of the output.

Press exam word (w) for 16 bit data. Enter the location of the output.

Press e and r, to view the value stored in the register.

To display the program : press asm and type di space starting address space ending

address. Press enter.

To edit the program : press asm and give the corresponding address of the mnemonics to be

modified. Type the mnemonic and press enter.

8086 PROGRAMS

SUBROUTINE - PROGRAM:

MOV AX, 3231

CALL ADDITION

PUSH AX

MOV CX, AX

INT 3

ADDITION: ADD AX, 4135

PUSH AX

MOV BX, 5314

POP AX

ADD AX, BX

RET

Observation:

Output: Register A

Page 12: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

PROGRAM TO ACCESS STACK:

MOV AX, 3231

ADD AX, 4135

PUSH AX

MOV BX, 5314

POP AX

ADD AX, BX

MOV CX, BX

PUSH CX

INT 3

Observation:

Output: Register A

PROGRAM TO FIND THE FACTORIAL OF A NUMBER:

MOV SI, 5000

MOV DI, 7000

MOV CX, [SI]

MOV AX, CX

DEC CX

AGAIN: MUL CX

DEC CX

JNZ AGAIN

MOV [DI], AX

INT 3

Observation:

Input : at 5000 Output : at 7000

Page 13: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

PROGRAM TO FIND SQUARE ROOT OF A PROGRAM:

MOV SI, 5000

MOV DI, 7000

MOV CX, 0001

MOV BX, 0000

MOV AL, [SI]

UP: SUB AL, CL

JL STORE

INC BL

ADD CL, 02

JMP UP

STORE: MOV [DI], BL

INT 3

Observation:

Input : at 5000

Output : at 7000

PROGRAM TO SORT THE NUMBERS IN DESCENDING ORDER:

MOV AH, O8H

DEC AH

LOOP3: MOC CL, AH

MOV BX, 4100H

LOOP2: MOV AL, [BX]

INC BX

CMP AL, [BX]

JNC LOOP1

Page 14: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

MOV DL, [BX]

MOV [BX], AL

DEC BX

MOV [BX], DL

INX BX

LOOP1: DEC CL

JNZ LOOP2

DEC AH

JNZ LOOP3

INT 3

Observation:

Input : From 4100 to 4107

Output : From 4100 to 4107

PROGRAM TO SORT THE NUMBERS IN ASCENDING ORDER:

MOV AH, O8H

DEC AH

LOOP3: MOC CL, AH

MOV BX, 4100H

LOOP2: MOV AL, [BX]

INC BX

CMP AL, [BX]

JC LOOP1

MOV DL, [BX]

MOV [BX], AL

DEC BX

Page 15: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

MOV [BX], DL

INX BX

LOOP1: DEC CL

JNZ LOOP2

DEC AH

JNZ LOOP3

INT 3

Observation:

Input : From 4100 to 4107

Output : From 4100 to 4107

8255 INTERFACING WITH 8085:

MVI A, 80(PORT A OUTPUT)

OUT 33H

AGAIN: MVI A, 55H

OUT 31H ADDRESS:

OUT 30H

CALL DELAY

MVI A, AAH

OUT 31H

OUT 30H

CALL DELAY

JMP AGAIN

RST 1

DELAY: MVI B, FFH

LOOP2: MVI C, FFH

PORT A : 30H

PORT B : 31H

PORT C : 32H

CONTROL REG : 33H

Page 16: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

LOOP1: DCR C

JNZ LOOP1

DCR B

JNZ LOOP2

RET

Interfacing Connection:

Through P6.

Input:

Through switch (port1) / immediate value

Output:

LED display

8255 OPERATING IN STROBED INPUT MODE (MODE1):

ORG FFABH

JMP E200H

ORG E200H

MOV A,B

CPI 01H

JNZ AHEAD

IN 30H

OUT 31H

JMP RETURN

AHEAD: MOV A,C

CMA

MOV C,A

Page 17: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

OUT 31H

RETURN: EI

RET

ORG E000H

LXI SP,FFFAH

MVI B,01H

MVI A,B4H

OUT 33H

MVI A,09H

OUT 33H

MVI A,03H

OUT 33H

MVI A,0AH

OUT 33H

MVI A,0FH

OUT 33H

MVI A,0DH

SIM

EI

BACK: IN 32

ANI 08H

CPI 08H

JNZ BACK ;

Page 18: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

NOP

NOP

BCK: JMP BCK

RST 1

Interfacing Connection:

Through P6.

Output:

LED display

8255 OPERATING IN STROBED OUTPUT MODE (MODE 1) :

ORG FFABH

JMP E200H

ORG E200H

MOV A,B

CPI 01H

JNZ AHEAD

IN 30H

OUT 31H

JMP RETURN

AHEAD: MOV A,C

CMA

MOV C,A

OUT 31H

RETURN: EI

RET

ORG E000H

MVI A,B4H

OUT 33H

Page 19: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

MVI B,02H

MVI A,0EH

SIM

EI

LXI H,E100H

MOV A,M

MOV E,A

MOV C,E

MVI A,05H

OUT 33H

MVI A,0AH

OUT 33H

MVI A,0FH

OUT 33H

MOV A,C

OUT 31H

MVI A,0DH

SIM

EI

BACK1: IN 32H

ANI 01H

CPI 01H

JNZ BACK1

NOP

NOP

BCK1: JMP BCK1

RST 1

Interfacing Connection:

Through P6.

Output: LED display

Page 20: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

PROGRAM TO TEST 8255 IN MODE 2 (BIDIRECTIONAL STROBED

INPUT MODE):

ORG FFABH

JMP E200H

ORG E200H

IN 30H

OUT 31H

STA FFF9H ;TEMP

EI

RET

ORG E000H

MVI A,C0H;

OUT 33H

MVI A,09H

OUT 33H

MVI A,0DH

SIM

EI

BACK: IN 32H

ANI 20H

JZ BACK

NOP

HERE: JMP HERE

RST 1

Page 21: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

Interfacing Connection:

Through P6.

Output:

LED display

PROGRAM TO TEST 8255 IN MODE 2 (BIDIRECTIONAL STROBE I/O

MODE):

ORG E000H ADDRESS:

LXI SP,FD00H

MVI A,C1H

OUT 33H

MVI A,09H

OUT 33H

MVI A,0DH

OUT 33H

MVI A,0EH

SIM

EI

MVI A,0DH

SIM

EI

LXI H,E100H

MOV A,M

INTR_LO: IN 32H

ANI 08H

PORTA : 30H

PORT B : 31H

PORT C : 32H

PORT CP : 33H

TEMP : FFF9H

DELAY : 06D3H; 057FH

Page 22: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

JZ INTR_LO

NOP

HERE: JMP HERE

ORG FFABH

JMP E200H

ORG E200H

IN 32H

ANI 20H

JNZ READ

MVI A,0EH

SIM

EI

LXI H,E100H

MOV A,M

OUT 30H

MVI A,0DH

OUT 33H

MVI A,03H

OUT 33H

MVI A,0DH

SIM

JMP TERM

READ: IN 30H

OUT 31H

TERM: EI

Page 23: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

RET

RST 1

Interfacing Connection:

Through P6.

Output:

LED display

8253 INTERFACING WITH 8085:

MVI A, 36H (Counter0, mode3) ADDRESS:

OUT 33

MVI A, 00H

OUT 30

MVI A, 3C

OUT 30

RST 1

Interfacing Connection :

Through P6.

Output:

In TCON1 : Pin 1 :: + ve

Pin 4 :: - ve

8279 INTERFACING WITH 8085:

MVI A, 00H (if left entry 00 ; if right entry means 10)

OUT 31

MVI A, 31H

OUT 31

L2: MVI A, D0H

COUNTER 0 : 30H

COUNTER1 : 31H

COUNTER2 : 32H

CONTROL REG : 33H

Page 24: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

OUT 31

CALL DELAY

MVI A, 90H

OUT 31

LXI H, 8800

MVI C, 08H

L1: MOV A, M

OUT 30

CALL DELAY

INX H

DCR C

JNZ L1

CALL DELAY

JMP L2

RST 1

DELAY: MVI B, FFH

HERE2: MVI D, FFH

HERE1: DCR D

JNZ HERE1

DCR B

JNZ HERE2

RET

Interfacing connection:

Through P6.

Input: From 8800 to 8807

Page 25: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

DAC INTERFACING WITH 8085:

MVI A, 80H

OUT DB ADDRESS:

AGAIN: MVI A, 55

OUT DB

CALL DELAY

MVI A, 00

OUT DB

CALL DELAY

JMP AGAIN

RST 1

DELAY: MVI A, FF

HERE1: MVI B, 55

HERE: DCR B

JNZ HERE

DCR A

JNZ HERE1

RET

Interfacing connection:

Through P6.

OUTPUT:

In JP4, out1 :: + ve

Gnd :: Gnd

PORT A : D8H

PORT B : D9H

PORTC : DAH

Control Reg : DBH

Page 26: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

ADC PROGRAMMING:

;NIFC07A WITH 85MEL. ADC POLLED MODE

ORG E000H ADDRESS:

LXI H,CHANNEL

MOV A,M

STA TEMP

MVI H,00

MOV L,A

SHLD FFF7H

MVI A,87H

AD00: MVI A,90H

OUT CTL_PORT

LDA TEMP

OUT PORTC

MVI A,0FH

OUT CTL_PORT

LXI D,0AH

CALL DELAY

MVI A,0EH

OUT CTL_PORT

MVI A,0CH

OUT CTL_PORT

AD01: IN PORTA

ANI 80H

CPI 80H

JNZ AD01

MVI A,0DH

OUT CTL_PORT

IN PORTA

STA FFF9H

PORTA : D8H

PORT B : D9H

PORT C : DAH

CTRL_PORT : DBH

UPDDT : 07D1H

CLR_DSP : 14A9H

LBL5 : 0042H

TEMP : F202H

CHANNEL : E100H

Page 27: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

MVI A,C7H

STA FFC2H

CALL UPDDT

CALL DELAY

JMP AD00

DELAY: LXI D,1FFFH

BLOOP: DCX D

MOV A,D

ORA E

JNZ BLOOP

RET

RST 1

Interfacing Connection:

Through P3.

Input:

At E100 : give channel number as 07 to choose channel 8.

Output:

In IC0809, Pin 13 :: Gnd

Pin 12 :: VRef

Pin 5 :: VAin

HOW TO WORK IN 8051:

Press Asm. Enter the starting address (8000).

Type the mnemonic. Press enter twice.

Press esc to save the program.

To give the input data : press Substitute memory (S).

For address 0000 to 0255 : press IDM.

For other address : press EDM.

Type the address and give the data. Press next (,) to save the data.

Page 28: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

To execute the program : press Go(G) and give the starting address of the main program.

Press enter.

To view the output: press substitute memory (S). For IDM/EDM, give the output location

and press next.

Press register(R), to view result in register. Eg: to see data in R0, press 0.

To display the program : press Disasm (D), give the starting address of the program. Press

next (,) and hit the down arrow to view the next line.

To edit the program : press asm and enter the corresponding address of the mnemonic to

be modified.

8051 PROGRAMS

8 BIT ADDITION:

MOV A, #04

MOV B, #03

ADD A, R0

LCALL 0003

Observation:

Output: Register A

8 BIT MULTIPLICATION:

MOV A,#06

MOV 0F0 (B), #02

MUL AB

LCALL 0003

Observation:

Output: Register A

Page 29: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

8 BIT DIVISION:

MOV A, #08

MOV OFO (B),#02

DIV AB

LCALL 0003

Observation:

Output: Register A

8 BIT SUBTRACTION:

MOV A, #08

MOV R0,#02

SUBB A, R0

LCALL 0003

Observation:

Output: Register A

AVERAGE OF 10 NUMBERS:

MOV R2, #0A

MOV R1, #00

MOV A, R1

MOV R0, #50

AGAIN: ADD A,@R0

JNC LOOP

INC R1

LOOP: INC R0

DJNZ R2, AGAIN

MOV 0F0,#0A

Page 30: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

MOV R3, #00

MOV R5, #00

MOV R4, A

LOOP1: MOV A, R4

SUBB A, 0F0

MOV R4, A

MOV A, R1

SUBB A, R5

MOV R1.A

INC R3

JNC LOOP1

DCR R3

LCALL 0003

Observation:

Input: From 50 to 59

Output: R3 : LSB

R1 : MSB

16 BIT ADDITION:

MOV DPTR, #4000H

MOVX A,@DPTR

MOV R0, A

INC DPTR

MOVX A,@DPTR

MOV R1, A

INC DPTR

Page 31: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

MOVX A,@DPTR

ADD A, R0

MOV R0, A

INC DPTR

MOVX A,@DPTR

ADDC A, R1

LCALL 0003

Observation:

Input:

4000 : LSB1

4002: MSB1

4003 : LSB2

4004 : MSB2

Output:

R0 : LSB of output

R1 : MSB of output

PORT PROGRAMMING:

BACK: SETB 97(P1.7)

LCALL DELAY1

CLRB 97(P1.7)

LCALL DELAY2

SJMP BACK

DELAY1: MOV R0, #X

LOOP2: MOV R1, #0A

LOOP1: DJNZ R1, LOO1

Page 32: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

DJNZ R0, LOOP2

RET

DELAY2: MOV R0, #X

LOOP4: MOV R1, #0A

LOOP3: DJNZ R1, LOO3

DJNZ R0, LOOP4

RET

Output:

P1.7 :: +ve

GND :: GND

TIMER PROGRAMMING:

MOV 89, #10

MOV 8B, #OA4 (Calculated value of LSB)

MOV 8D,#0FF (Calculated value of MSB)

CPL P1. 7(97)

SETB TR1 (8E)

JNB TF1 (8F), BACK

CLR TR1 (8E)

CLR TF1 (8F)

SJMP AGAIN

Output:

P1.7 :: +ve

GND :: GND

Page 33: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

SERIAL COMMUNICATION:

MOV TMOD, #20 ADDRESS:

MOV TH1, #FD

MOV SCON, #5

SETB TR1

AGAIN: MOV SBUF, # ’C’(43)

HERE: JNB TI, HERE

CLR TI

SJMP AGAIN

Output:

Interface using RS232.

Step 1 : Go to All programs → Accessories → Communication → Hyperterminal.

Step 2 : Give file name.

Step 3 : Select COM1.

Step 4 : Restore Defaults as

a) Baud rate :: 9600

b) Data bits :: 8

c) Parity :: None

d) Stop bit :: 1

e) Flow control :: None

Step 5: connect to view the data received.

STEPPER MOTOR INTERFACING USING 8255:

MOV A, #80H (Port A as output)

MOV DPTR, #2043H

MOVX @DPTR, A

TMOD : 89H

TH1 : 8DH

SCON : 98H

TR1 : 8EH

SBUF : 99H

TI : 99H

Page 34: HOW TO WORK IN 8085 - chettinadtech.ac.inchettinadtech.ac.in/storage/14-01-02/14-01-02-14-20-13-msksaran.pdf · how to work in 8085: ... how to work in 8086: press asm twice. ...

START: MOV A, #ODH Example for Input Sequence:

MOV DPTR, #2042H

MOVX @DPTR, A

LCALL DELAY

MOV A, #OEH

MOV DPTR, #2042H

MOVX @DPTR, A

LCALL DELAY

MOV A, #O7H

MOV DPTR, #2042H

MOVX @DPTR, A

LCALL DELAY

MOV A, #OBH

MOV DPTR, #2042H

MOVX @DPTR, A

LCALL DELAY

SJMP START

DELAY: MOV R0, #F7H

AGAIN: MOV R1, #FFH

BACK: DJNZ R1, BACK

DJNZ R0, AGAIN

RET

Interfacing connection : Through P3.

CLOCKWISE ANTI-CLOCKWISE

OD OB

OE 07

07 0E

0B 0D