Sei sulla pagina 1di 51

Sri Bharathi Women’s Arts & Science College ∎ Page |1

1. SQUARE (8- bit)

Date of the exp:

AIM:
To write an assembly language program to find square of a number using 8085

PROCEDURE
a) Facilities required doing the experiment:
1. 8085 Microprocessor Kit 1
2. DC Power Supply 5V 1
b) Procedure for doing the experiment:
1. Start the program. Store the 16-bit data into the accumulator.
2. Initialize the counter. Move the content of accumulator to the data pointer.
3. Terminate the program

c) Program:
SQUARE OF 8-BIT

ADDRESS MNEMONICS OPCODE COMMENTS


8100 LDA 8300 3A,00,83
8103 MOV C , A 4F
8104 MOV B , A 47
8105 XRA A AF
8106 (L1) ADD B 80
8107 DCR C 0D
8108 JNZ (L1) C2,06,81
810B STA 8400 32,00,84
810E HLT 76

d) Output:

i/p Add 8300 o/p Add 8400


02 04
03 09
04 10
0D 09
07 31
0E C4
3F 81
e) Result:

Department of Physics | M Gopinathan


Sri Bharathi Women’s Arts & Science College ∎ Page |2

2. SQUARE ROOT (8 – bit)

Date of the exp:

AIM:
To write an assembly language program to find square and cube of a number using 8085

PROCEDURE
a) Facilities required doing the experiment:
1. 8085 Microprocessor Kit 1
2 .DC Power Supply 5V 1
b) Procedure for doing the experiment:
1. Start the program. Store the 16-bit data into the accumulator.
2. Initialize the counter. Move the content of accumulator to the data pointer.
3. Terminate the program.
c) Program:
8-BIT SQUARE ROOT

ADDRESS MNEMONICS OPCODE COMMENTS


8100 LDA 8200 3A,00,82
8103 MVI C , 00 0E, 00
8105 MVI D , 00 16 , 01
8107 (L2)INR C 0C
8108 SUB D 92
8109 JZ (L1) CA,11,81
810C INR D 14
810D INR D 14
810E JMP (L2) C3,07,81
8111 (L1)MOV A,C 79
8112 STA 8500 32,00,85
8115 HLT 76

d) Output:

i/p Add 8200 o/p Add 8500


25 05
64 0A
81 3F
49 1D
09 03
36 1D
0A 1D

e) Result:

Department of Physics | M Gopinathan


Sri Bharathi Women’s Arts & Science College ∎ Page |3

3. SQUARE (16-bit)

Date of the exp:

AIM:
To write an assembly language program to find square of a 16-bit number using 8085

PROCEDURE
a) Facilities required doing the experiment:

1. 8085 Microprocessor Kit 1


2. DC Power Supply 5V 1

b) Procedure for doing the experiment:

1. Start the program. Store the 16-bit data into the accumulator.
2. Initialize the counter. Move the content of accumulator to the data pointer.
3. Terminate the program.

c) Program:

SQUARE OF 16-BIT

ADDRESS MNEMONICS OPCODE COMMENTS


8100 LXI H 8200 21,00,82
8103 MOV A , M 7E
8104 ANI 0F E6 , 0F
8106 MOV C,A 4F
8107 MOV A,M 7E
8108 ANI F0 E6 , F0
810A RRC 0F
810B RRC 0F
810C RRC 0F
810D RRC 0F
810E MOV D ,A 57
810F XRA A AF
8110 MVI E , 0A 1E , 0A
8112 (L1)ADD D 82
8113 DCR E 1D
8114 JNZ (L1) C2,12,81
8115 ADD C 81
8116 INX H 23
8117 MOV M ,A 77
8118 XRA A AF
811B LXI D ,0000 11,00,00
811E (L2)MOV A,E 7B

Department of Physics | M Gopinathan


Sri Bharathi Women’s Arts & Science College ∎ Page |4

811F DCX H 2B
8120 ADC M 86
8121 DAA 27
8122 MOV E ,A 5F
8123 CC DC,00,86
8126 INX H 23
8127 DCR M 35
8128 JNZ(L2) C2,1E,81
812B XCHG EB
812C SHLD 8700 22,00,87
812F HLT 76

CALL SUBROUTINE

ADDRESS MNEMONICS OPCODE COMMENTS


8600 MOV A ,D 7A
8601 ADI 01 C6 , 01
8603 DAA 27
8604 MOV D , A 57
8605 RET C9

d) Output:

i/p Add o/p Add


8201 MSB 8200 LSB 8701 MSB 8700 LSB
00 03 00 09
00 14 01 96
00 96 92 16
00 87 75 69
00 23 05 29
00 81 01 21

e) Result:

Department of Physics | M Gopinathan


Sri Bharathi Women’s Arts & Science College ∎ Page |5

4. SQUARE ROOT (16-BIT)

Date of the exp:

AIM:
To write an assembly language program to find square root of a 16-bit number using 8085

PROCEDURE
a) Facilities required doing the experiment:
1. 8085 Microprocessor Kit 1
2 .DC Power Supply 5V 1

b) Procedure for doing the experiment:

1. Start the program. Store the 16-bit data into the accumulator.
2. Initialize the counter. Move the content of accumulator to the data pointer.
3. Terminate the program.

c) Program:

16-bit square root

ADDRESS MNEMONICS OPCODE COMMENTS


8100 XRA A AF
8101 LXI H 0000 21,00,00
8104 LXI D 03E8H 11,E8,03
8107 LDA 8201 3A,01,82
810A ANI F0 E6 , F0
810C JZ (L1) CA,16,81
810F RRC 0F
8110 RRC 0F
8111 RRC 0F
8112 RRC 0F
8113 CALL 8500 CD,00,85
8116 (L1)LXI D,0064 11,64,00
8119 LDA 8201 3A,01,82
811C ANI 0F E6 , 0F
811E JZ (L2) CA,24,81
8121 CALL 8500 CD,00,85
8124 L2)LXI D 000A 11,0A,00
8127 LDA 8200 3A,00,82
812A ANI F0 E6 , F0
812C JZ (L3) CA,36,81
812F RRC 0F
8130 RRC 0F
8131 RRC 0F

Department of Physics | M Gopinathan


Sri Bharathi Women’s Arts & Science College ∎ Page |6

Continue….next page

ADDRESS MNEMONICS OPCODE COMMENTS


8132 RRC 0F
8133 CALL 8500 CD,00,85
8136 L3)LXI D,0000 11,00,00
8139 LDA 8200 3A,00,82
813C ANI 0F E6 , 0F
813E MOV E , A 5F
813F DAD D 19
8140 SHLD 8300 22,00,83
8143 MVI C , FF 0E , FF
8145 L4) INR C 0C
8146 LXI H,0000 21,00,00
8149 LXI D,0000 11,00,00
814C MOV B , C 41
814D MOV E , C 59
814E L6) DAD D 19
814F DCR B 05
8150 JNZ (L6) C2,4E,81
8153 XRA A AF
8154 LDA 8300 3A,00,83
8157 SUB L 95
8158 LDA 8301 3A,01,83
815B SBB H 9C
815C JNC (L4) D2,45,81
815F DCR C 0D
8160 MOV A , C 79
8161 MVI D , FF 16 , FF
8163 L5) INR D 14
8164 SUI 0A D6 , 0A
8166 JNC (L5) D2,63,81
8169 ADI 0A C6 , 0A
816B MOV E , A 5F
816C MOV A , D 7A
816D RRC 0F
816E RRC 0F
816F RRC 0F
8170 RRC 0F
8171 ADD E 83
8172 STA 8600 32,00,86
8175 HLT 76

Department of Physics | M Gopinathan


Sri Bharathi Women’s Arts & Science College ∎ Page |7

CALL SUBROUTINE
8500 L) DAD D 19
8501 DCR A 3D
8502 JNZ (L) C2,00,85
8505 RET C9

d) Output:

i/p Add o/p Add


8201 MSB 8200 LSB 8600
00 81 09
00 25 05
01 25 11
02 25 15
98 01 99
03 66 19

e) Result:

Department of Physics | M Gopinathan


Sri Bharathi Women’s Arts & Science College ∎ Page |8

5. BCD TO HEX (8-bit)

Date of the exp:

AIM:
To write an assembly language program to convert a 2-digit BCD (8-bit) data to Hex
decimal

PROCEDURE

a) Facilities required doing the experiment:

1. 8085 Microprocessor Kit 1


2. DC Power Supply 5V 1

b) Procedure for doing the experiment:

1. Get the BCD data in A reg and save in E reg.


2 .Mark the lowest nibble (units) of the BCD data in A reg.
3. Rotate the upper nibble to lower nibble position and save in B reg.
4. Clear the accumulator.
5. Move 0AH to C reg.
6. Decrement C reg. If ZF=0, go to step 6 else ZF=1, go to next step.
7. Save the product in B reg.
8 .Get the BCD data in A reg from E reg and mark the upper nibble.
9 .Add the content of A reg to product (B reg).
10. Store the binary value (A reg).
11. Terminate the program.

Department of Physics | M Gopinathan


Sri Bharathi Women’s Arts & Science College ∎ Page |9

c) Program: BCD TO HEX DECIMAL 8-BIT

ADDRESS MNEMONICS OPCODE COMMENTS


8500 LXI H, 8200 21,00,82
8503 MOV A , M 7E
8504 ANI 0F E6 , 0F
8506 MOV C , A 4F
8507 MOV A , M 7E
8508 ANI F0 E6 , F0
850A RRC 0F
850B RRC 0F
850C RRC 0F
850D RRC 0F
850E MOV E , A 5F
850F MVI D , 0A 16 , 0A
8511 XRA A AF
8512 (L1)ADD E 83
8513 DCR D 15
8514 JNZ (L1) C2 ,12,85
8517 ADD C 81
8518 STA 8300 32,00,83
851B HLT 76

d) Output:

BCD 8200( I/P) HEX 8300 (O/P)


22 16
40 28
15 0F
54 36
75 4B
92 5C
0B 0B
FF A5
0C 0D
e) Result:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 10

6. HEX TO BCD (8-bit)

Date of the exp:

AIM:
To write an assembly language program to convert an 8-bit Hex to BCD

PROCEDURE
a) Facilities required doing the experiment:

1 8085 Microprocessor Kit 1


2 DC Power Supply 5V 1

b) Procedure for doing the experiment:

1. Clear D and E reg to account for hundreds and tens.


2 .Load the binary data in A reg.
3 .Compare A reg with 64th if carry flag is set go to step 7 else go to next step.
4 .Subtract 64th from A reg.
5 .Increment E reg(hundreds) go to step 3
6. Compare the A reg with 0AH if carry flag is set go to step 1 else go to next step.
7 .Subtract 0AH from A reg.
8 .Increment D reg(tens) go to step 7.
9. Combine the terms to form 8 bit result.
10. Save the tens and hundred in memory.
11. Terminate the program.

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 11

c) Program:
HEX TO BCD 8-BIT

ADDRESS MNEMONICS OPCODE COMMENTS


8500 XRA A AF
8501 LXI H 8200 21,00,82
8504 MOV A , M 7E
8505 MVI D , FF 16,FF
8507 MVI B , 64H 06, 64
8509 (L1)INR D 14
850A SUB B 90
850B JNZ (L1) D2,09,85
850E ADD B 80
850F MVI C , FF 0E,FF
8511 MVI E , 0AH 1E,0A
8513 (L2) INR C 0C
8514 SUB E 93
8515 JNC (L2) D2,13,85
8518 ADD E 83
8519 STA 8300 32,00,83
851C MOV A , C 79
851D STA 8301 32,01,83
8520 MOV A , D 7A
8521 STA 8302 32,02,83
8524 HLT 76

d) Output: HEX TO BCD

HEXA NO BCD OUTPUT DECIMAL


I/P (8200) 100’S(8302) 10’S(8301) 1’S (8300) EQUIVALANT

2B 00 04 03 43
0A 00 01 00 10
5A 00 09 00 90
60 00 09 06 96
5F 00 09 05 95

e) Result:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 12

7. BCD TO HEX (16-bit)

Date of the exp:

AIM:
To write an assembly language program to convert a 2-digit BCD (16-bit) data to Hex
decimal

PROCEDURE
a) Facilities required doing the experiment:

1. 8085 Microprocessor Kit 1


2. DC Power Supply 5V 1

b) Procedure for doing the experiment:

1. Get the BCD data in A reg and save in E reg.


2 .Mark the lowest nibble (units) of the BCD data in A reg.
3. Rotate the upper nibble to lower nibble position and save in B reg.
4. Clear the accumulator.
5. Move 0AH to C reg.
6. Decrement C reg. If ZF=0,go to step 6 else ZF=1, go to next step.
7. Save the product in B reg.
8 .Get the BCD data in A reg from E reg and mark the upper nibble.
9 .Add the content of A reg to product (B reg).
10. Store the binary value (A reg).
11. Terminate the program.

b) Program for BCD to HEX 16-bit

ADDRESS MNEMONICS OPCODE COMMENTS


8100 XRA A AF
8101 LXI H,0000 21,00,00
8104 LXI D,03E8 11,E8,03
8107 LDA 8300 3A,00,83
810A ANI F0 E6 , F0
810C JZ (L1) CA,16,81
810F RRC 0F
8110 RRC 0F
8111 RRC 0F
8112 RRC 0F
8113 CALL 8200 CD,00,82
8116 L1)LXI D,0064 11,64,00
8119 LDA 8301 3A,01,83
811C ANI 0F E6 , F0

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 13

811E JZ (L2) CA,24,81


8121 CALL 8200 CD,00,82
8124 L2)LXI D,000A 11,0A,00
8129 LDA 8300 3A,00,83
812A ANI F0 E6 , F0
812C JZ (L3) CA,36,81
812F RRC 0F
8130 RRC 0F
8131 RRC 0F
8132 RRC 0F
8133 CALL 8200 CD,00,82
8136 L3)LXI D,0000 11,00,00
8139 LDA 8301 3A,01,83
813C ANI 0F E6 , 0F
813E MOV E , A 5F
813F DAD D 19
8140 SHLD 8600 22,00,86
8143 HLT 76

CALLSUROUTINE:

ADDRESS MNEMONICS OPCODE COMMENTS


8200 L) DAD D 19
8201 DCR A 3D
8202 JNZ (L) C2,00,82
8205 RET C9

C) Output
BCD to Hex 16-bit

INPUT BCD OUTPUT HEXA


MSB ( 8301 ) LSB ( 8300 ) MSB ( 8601 ) LSB ( 8600 )
00 02 00 00
01 03 00 01
02 0A 00 02
03 0B 00 03
04 0C 00 04
05 0D 00 05

e) Result:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 14

8. HEX TO BCD (16-BIT)

Date of the exp:


AIM:
To write an assembly language program to convert a 16-bit Hex to BCD.
PROCEDURE
a) Facilities required doing the experiment:
1 8085 Microprocessor Kit 1
2 DC Power Supply 5V 1
b) Procedure for doing the experiment:
1. Clear D and E reg to account for hundreds and tens.
2 .Load the binary data in A reg.
3 .Compare A reg with 64th if carry flag is set go to step 7 else go to next step.
4 .Subtract 64th from A reg.
5 .Increment E reg(hundreds) go to step 3
6. Compare the A reg with 0AH if carry flag is set go to step 1 else go to next step.
7. Subtract 0AH from A reg.
8. Increment D reg(tens) go to step 7.
9. Combine the terms to form 8 bit result.
10. Save the tens and hundred in memory.
c) Program for Hex to BCD 16-bit:

ADDRESS MNEMONICS OPCODE COMMENTS


8100 XRA A AF
8101 LHLD 8200 2A,00,82
8104 LXI D,2710H 11,10,27
8107 CALL 8300 CD,00,83
810A STA 8500 32,00,85
810D LHLD 8200 2A,00,82
8110 LXI D,03E8H 11,E8,03
8113 CALL 8300 CD,00,83
8116 STA 8501 32,01,85
8119 LHLD 8200 2A,00,82
811C LXI D,0064H 11,64,00
811F CALL 8300 CD,00,83
8122 STA 8502 32,02,85
8125 LHLD 8200 2A,00,82
8128 LXI D,000AH 11,0A,00
8126 CALL 8300 CD,00,83
812E STA 8503 32,03,85
8131 LHLD 8200 2A,00,82
8134 MOV A, L 7D
8135 STA 8504 32,04,85
8138 HLT 76

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 15

CALL SUBROUTINE:

ADDRESS MNEMONICS OPCODE COMMENTS


8300 MVI B , FF 06 , FF
8302 L)SHLD 8200 22,00,82
8305 INR B 04
8306 MOV A , L 7D
8307 SUB E 93
8308 MOV L , A 6F
8309 MOV A , H 7C
830A SBB D 9A
830B MOV H , A 67
830C JNC (L) D2,02,83
830F MOV A ,B 78
8310 RET C9

d) Output
Hex to BCD 16-bit

Input Hex No: Output BCD


MSB LSB 10,000’s 1000’s 100’s 10’s 1’s Decimal
8201 8200 8500 8501 8502 8503 8504 Equivalent
FF FF 06 05 05 03 05 65503
00 15 00 00 00 02 01 21
01 15 00 00 02 07 07 277
1E 2F 00 07 07 02 07 7727
03 E8 00 01 00 00 00 1000
EA EA 06 00 01 03 08 60138
00 0A 00 00 00 01 00 00010

e) Result:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 16

9. BINARY TO ASCII (8- bit)


Date of the exp:

AIM:
To write an assembly language program to convert a 8-bit Binary number to ASCII
Code.

PROCEDURE
a) Facilities required doing the experiment:

1 8085 Microprocessor Kit 1


2 DC Power Supply 5V 1

b) Procedure for doing the experiment:

1. Load the given data in A reg and move to B reg.


2 .Mark the upper nibble of binary (Hex) data in A reg.
3. Call subroutine code to get ASCII code of the lower nibble and store in memory.
4 .Move B reg to A reg and mark the lower nibble.
5. Rotate the upper nibble position.
6. Call subroutine code to get the ASCII code of upper nibble and store in memory.
7. Terminate the program.

For Subroutine:
1. Compare the content of A reg with 0AH.
2 .If CY=1 go to step 4, If CY=0 go to next step.
3. Add 07H to A reg.
4. Add 30H to A reg.
5. Return to main program.

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 17

c) Program:

8-BIT BINARY TO ASCII

ADDRESS MNEMONICS OPCODE COMMENTS


8200 MVI A , (XX) 3E , (XX)
8202 CPI 0A FE,0A
8204 JC (L) DA,09,82
8207 ADI 07 C6,07
8209 (L) ADI 30 C6 , 30
820B STA 8400 32,00,84
820E HLT 76

d) Output:

BINARY I/P (XX) ASCII O/P (8400)


(8200)
0E 46
0E 45
0C 43
0A 41
04 34
00 30
06 36

e) Result:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 18

10. ASCII TO BINARY (8 – bit)

Date of the exp:

AIM:
To write an assembly language program to convert an array of ASCII Code to
Corresponding binary (hex) value

PROCEDURE
a) Facilities required doing the experiment:

1 8085 Microprocessor Kit 1


2 DC Power Supply 5V 1

b) Procedure for doing the experiment:

1. Set HL pair as pointer for ASCII array.


2. Set D reg as counter for number of data in the array.
3. Set BC pair as pointer for binary (hex) array.
4. Increment HL pair and move a data of ASCII array A reg.
5. Call subroutine BIN to find the binary (hex) value.
6. The binary (hex) value in A reg is stored in memory.
7. Increment BC pair.
8. Decrement D reg if ZF=0 then go to step 4, If ZF=1 then stop.
9. Terminate the program.
For Subroutine:
1. Subtract 30H from A reg.
2. Compare the content of A reg with 0AH.
3. If CY=1 go to step 4, If CY=0 go to next step.
4. Subtract 07H from A reg.
5. Return to main program.

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 19

c) Program:

ASCII TO BINARY 8-BIT

ADDRESS MNEMONICS OPCODE COMMENTS


8200 MVI A , XX 3E , XX
8202 SUI 30 D6 , 30
8204 CPI 0A FE , 0A
8206 JC (L) DA,0B,82
8209 SUI 07 D6 , 07
820B (L) STA 8400 32,00,84
820E HLT 76

d) Output:

ASCII I /p 8201 ( XX) BINARY o /p 8400


32 02
35 05
37 07
44 0D
33 03
42 0B
38 08

e) Result:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 20

11. STEPPER MOTOR INTERFACING WITH 8085

Date of the exp:

AIM:
To write an assembly language program to rotate the motor in forward and reverse
Direction using 8085
PROCEDURE
a) Facilities required doing the experiment:
1. 8085 Microprocessor Kit 1
2 .8279 interfacing Kit 1
3 .DC Power Supply 5V 1
b) Procedure for doing the experiment:
1. Start the program.
2. The port and 8279 are initiated. Set the count for 4-stepping sequence.
3. Call subroutine wait for 1ms. Decrement the counter.
4. Count zero is checked then set the count for 4-stepping sequence else go to
initializing ports.
5. Terminate the program.
c) Program-I (for Continuous Rotation)

ADDRESS MNEMONICS OPCODE COMMENTS


8100 MVI A , 80H 3E,80H
8102 OUT DF D3 , DF
8104 MVI D , 04 16 , 04
8106 L3) MVI C (DATA OE , ________
8108 L2)LXIH 8050 21,50,80
810B MVI B , 04 06 , 04
810D L1) MOV A , M 7E
810E OUT DC D3 , DC
8110 DCR C 0D
8111 JZ ( L ) CA ,1E,81
8114 CALL 8600 CD,00,86
8117 INX H 23
8118 DCR B 05
8119 JNZ (L1) C2,0D,81
811C JMP (L2) C3,08,81
811F (L) CALL 8600 CD,00,86
8122 CALL 8600 CD,00,86
8125 CALL 8600 CD,00,86
8128 CALL 8600 CD,00,86
812B CALL 8600 CD,00,86
812E CALL 8600 CD,00,86
8131 DCR D 15
8132 JNZ (L3) C2,06,81
8135 HLT 76

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 21

CALL TIME DELAY FOR CONTINUOUS ROTATION

ADDRESS MNEMONICS OPCODE COMMENTS


8600 PUSH D D5
8601 LXI D , OF , OF 11,OF ,OF
8604 L4) DCX D 1B
8605 MOV A , E 7B
8606 ORD D B2
8607 JNZ (L4) C2, 04, 86
860A POP D D1
860B RET C9

DIRECTION

CLOCK WISE ANTI CLOCK WISE


8050 09 8050 0A
8051 05 8051 06
8052 06 8052 05
8053 0A 8053 09

Program –II (for Rotation through a required angle)

ADDRESS MNEMONICS OPCODE COMMENTS


8100 MVI A , 80H 3E,80
8102 OUT DF D3, DF
8104 MVI C (data) 0E , ________
8106 L2)LXI H 8050 21, 50, 80
8109 MVI B , 04 06 , 04
810B L1)MOV A , M 7E
810C OUT DC D3 , DC
810E DCR C 0D
810F JZ (L3) CA , 24, 81
8112 LXI D , 0F ,0F 11,0F,0F
8115 L)NOP 00
8116 DCX D 1B
8117 MOV A , E 7B
8118 ORA D B2
8119 JNZ (L) C2 , 15, 81
811C INX H 23
811D DCR B 05
811E JNZ (L1) C2, 0B, 81
8121 JMP (L2) C3, 06, 81
8124 L3) HLT 76

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 22

ANGLE DECIMAL EQUIVALENT HEX EQIUVALANT


8105 (DATA)
360 50 32
180 25 19
90 13 0D
45 06 06

RESULT:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 23

12. BLINKING OF LED


Date of the exp:
AIM:
To initialize the analog to digital conversion process by means of software and to
execute the program which converts the analog input at channel and displays the
output through the LED.
PROCEDURE
a) Facilities required doing the experiment:
1 8085 Microprocessor Kit 1
2 DC Power Supply 5V 1
b) Procedure for doing the experiment:
1 Move immediately the value of accumulator output.
2 Move immediately as another value of accumulator.
3 EX-OR the value for 3 times.
4 Initialize A reg as 00.
5 Get the output at 00.
6 Terminate the program.
c) Program for Blinking of LED

ADDRESS MNEMONICS OPCODE COMMENTS


8100 MVI A , 80H 3E , 80
8102 OUT 0F D3 , 0F
8104 L1)MVI A ,FF 3E , FF
8106 OUT 0C D3 , 0C
8108 CALL 8500 CD,00,85
810B MVI A , 00 3E , 00
810D OUT 0C D3 , 0C
810F CALL 8500 CD , 00 .85
8112 JMP (L1) C3 , 04, 81
CALL SUBROUTINE:

ADDRESS MNEMONICS OPCODE COMMENTS


8500 MVI H , 04 26 , 04
8502 L3) MVI B , F5 06 , F5
8504 L2) MVI C , F2 0E , F2
8506 L1) DCR C 0D
8507 JNZ (L1) C2 , 06, 85
850A DCR B 05
850B JNZ (L2) C2, 04, 85
850E DCR H 25
850F JNZ (L3) C2, 04, 85
8512 RET C9
e) Result:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 24

13. DAC INTERFACING – WAVE FORM GENERATION


SQUARE WAVE, TRIANGLEWAVE, AND RAMP WAVE GENERATION

Date of the exp:

AIM:
To generate the square wave, Triangle wave, Ramp wave at the DAC output.

PROCEDURE
a) Facilities required doing the experiment:

1 8085 Microprocessor Kit 1


2 DC Power Supply 5V 1

b) Procedure for doing the experiment:

1 Load the initial value (00) to Accumulator and move it to DAC.


2 Call the delay program.
3 Load the final value (FF) to accumulator and move it to DAC.
4 Call the delay program.
5 Repeat the steps 2 and 4
6 Terminate the program.

C) Port checking program:

ADDRESS MNEMONICS OPCODE


8200 MVI A , 80 3E , 80
8202 OUT DF D3 , DF
8204 MVI A , FF 3E , FF
8206 OUT DC (PORT A) D3 , DC
8208 HLT 76

8255A Chip

PORT A DC
PORT B DD
PORT C DE
CONTROL WORD DF

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 25

CIRCUIT:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 26

D) Program for Square Wave:

ADDRESS MNEMONICS OPCODE COMMENTS


8300 MVI A , 80 3E , 80
8302 OUT DF (CW) D3 , DF
8304 L) MVI A ,FF 3E , FF
8306 OUT DC (PA) D3 , DC
8308 CALL TD CD, 00, 81
830B MVI A , 00 3E , 00
830D OUT DC (PA) D3 , DC
830F CALL TD CD, 00, 81
8313 JMP (L) C3, 00, 83

E) Program for Triangular wave:

ADDRESS MNEMONICS OPCODE COMMENTS


8300 MVI A , 80 3E , 80
8302 OUT DF D3 , DF
8304 L3)MVI A,00 3E , 00
8306 L1)OUT DC D3 , DC
8308 INR A 3C
8309 JNZ (L1) C2, 06, 83
830C MVI A,FF 3E , FF
830E L2)OUT DC DC
8312 DCR A 3D
8313 JNZ (L2) C2,0E, 83_
8316 JMP (L3) C3, 04, 83

F) Program for Saw Tooth Wave:

ADDRESS MNEMONICS OPCODE COMMENTS


8300 MVI A , 80H 3E , 80
8302 OUT , DF D3 , DF
8304 MVI A , 00 3E , 00
8306 L) OUT DC D3 , DC
8308 INR A * 3C
8309 JMP (L) C3, 06, 84

NOTE: * INR A (3C) - POSITIVE / DCR A (3D) - NEGATIVE

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 27

G) TIME DELAY: FOR ALL WAVE FORM

( e.g SQUARE , TRIANGLE,SINE,RAMP WAVE)

ADDRESS MNEMONICS OPCODE COMMENTS


8100 PUSH , PSW F5
8101 LXIB ,COUNT 01,XX,YY
8104 L)DCX B 0B
8105 MOV A , B 78
8106 ORA C B1
8107 JNZ (L) C2,04,81
810A POP PSW F1
810B RET C9

H) DATA:

COUNT Xx Yy PERIOD FREQUENCY


0037 37 00 1 m sec 1 KHz
0074 74 00 2 m sec 500 Hz
00FF FF 00 4 m sec 250 Hz
FFFF FF FF Toggling Low

PASTE TRACE PAPER HERE

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 28

PASTE TRACE PAPER HERE

I) Result:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 29

14. CLOCK PROGRAM- USING 8085

Date of the exp:

AIM:
To write an assembly language program to display time using 8085.

PROCEDURE
a) Facilities required doing the experiment:

1. 8051 Microprocessor Kit 1


2 .8279 interfacing Kit 1
3 .DC Power Supply 5V 1

b) Procedure for doing the experiment:

1. Start the process


2. Initialization of display chip 8279 to display in left entry mode
3. Initializing HL pair with Second, Minutes, and Hours
4. Initializing B reg as a counter for hour, minutes, and seconds store the memory in
Accumulator.
5. Call display Subroutine for Seconds, minutes, hours in the display chip
6. Get the seconds values in H and increment by 1.Give 1 sec time delay before
increment.
7. Compare for 60 sec. If sec to display of sec 60 reset.
8. Get the minutes; give 1 sec time display increment by 1. Compare for 60 minutes
display of 60 min. has reached if and increment H.
9. Get the hours, increment by 1 after 60 min. display it. Compare for 12 hours if this
condition is reached reset if display.
10. The display subroutine is used to display and the value are given in the table.
11. Stop the process.

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 30

c) Program:

Clock Program

ADDRESS MNEMONICS OPCODE COMMENTS


8010 LXI H, 8600 21,00,86
8013 CALL DISPL CD,F0,13
8016 INX H 23
8017 INX H 23
8018 CALL TD CD,00,81
801B MOV A , M 7E
801C INR A 3C
801D DAA 27
801E MOV M , A 77
801F CPI 60H (sec) FE , 60
8021 JNZ ,REP C2,10,80
8024 XRA A AF
8025 MOV M , A 77
8026 DCX H 2B
8027 MOV A , M 7E
8028 INR A 3C
8029 DAA 27
802A MOV M , A 77
802B CPI 60H (min) FE , 60
802D JNZ ,REP C2,10,80
8030 XRA A AF
8031 MOV M , A 77
8032 DCX H 2B
8033 MOV A , M 7E
8034 INR A 3C
8035 DAA 27
8036 MOV M , A 77
8037 CPI,24/12 (hour) FE , 24/12
8039 JNZ , REP C2,10,80
803C XRA A AF
803D MOV M , A 77
803E JMP , REP C3,10,80

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 31

CALL SUBROUTINE PROGRAM: TIME DELAY (TD)

ADDRESS MNEMONICS OPCODE COMMENTS


8100 PUSH H E5
8101 PUSH PSW F5
8102 MVI B , 02H 06 , 02
8104 L2)LXIH,F5FF 21,FF,F5
8107 L1) DCX H 2B
8108 MOV A , H 7C
8109 ORA L B5
810A JNZ (L1) C2, 07, 81
810D DCR B 05
810E JNZ (L2) C2, 04, 81
8111 POP PSW F1
8112 POP H E1
8113 RET C9

TIME & HOUR DATA:

8600 00 to 23 hours
8601 00 to 59 min
8602 00 to 59 sec

d) Result:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 32

15. DAC-UNIPOLAR & BIPOLAR USING 8085

Date of the exp:

AIM:
To write an assembly language program to convert 8-bit digital input into analog
output Unipolar and Bipolar method using 8085.

PROCEDURE
a) Facilities required doing the experiment:

1. 8085 Microprocessor Kit 1


2 .8255 port interfacing Kit 1
3 .DC Power Supply 5V 1
4. DAC IC-0800, IC 741, Resistance box, Capacitance box and Digital multi meter.

b) Procedure for doing the experiment:

1. Start the process


2. Get the digital value
3. Convert the digital value into its corresponding output voltage
4. Stop the process.

C) Program for Unipolar & Bipolar:

ADDRESS MNEMONICS OPCODE COMMENTS


8100 MVI A ,80 H 3E , 80
8102 OUT DF (cw) D3 , DF
8104 MVI A , FF 3E , FF
8106 OUT DC(o/p) D3 , DC
8108 HLT 76

CW- control word o/p-output port


8255A Chip

PORT A DC
PORT B DD
PORT C DE
CONTROL WORD DF

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 33

CIRCUIT:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 34

D) OUTPUT

UNIPOLAR BIPOLAR

RF = RF =

INPUT HEXA OUTPUT INPUT HEXA OUTPUT


VOLTAGE VOLTAGE
00 00
0F 0F
1F 1F
2F 2F
3F 3F
4F 4F
5F 5F
6F 6F
7F 7F
8F 8F
9F 9F
AF AF
BF BF
CF CF
DF DF
EF EF
FF FF

RESULT:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 35

16. DAC- R-2R NETWORK USING 8085

Date of the exp:

AIM:
To write an assembly language program to convert 8-bit digital input into analog output
R – 2R method using 8085.

PROCEDURE
a) Facilities required doing the experiment:

1. 8085 Microprocessor Kit 1


2 .8255 port interfacing Kit 1
3 .DC Power Supply 5V 1
4. IC 741, Resistances and Digital multi meter.

b) Procedure for doing the experiment:

1. Start the process


2. The program peripheral interface chip 8255 is initialized with all ports as output
ports
3. The control word is entered into the control word Register.
4. The digital voltage is o be converted into analog voltage is loaded.
5. The analog volt obtained in the output terminal of op-amp.
6. Stop the process.

Formula:
𝑒𝑟𝑟𝑜𝑟
Accuracy = ×100%
𝑓𝑢𝑙𝑙 𝑠𝑐𝑎𝑙𝑒 𝑟𝑒𝑎𝑑𝑖𝑛𝑔

1
Resolution = × 100%
2𝑛 −1

n-Number of bits ( 8-bits )



Linearity Error =

8255A Chip

PORT A DC
PORT B DD
PORT C DE
CONTROL WORD DF

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 36

CIRCUIT:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 37

C) Program for R-2R Network

ADDRESS MNEMONICS OPCODE COMMENTS


8100 MVI A , 80 H 3E , 80
8102 OUT DF (CW) D3 , DF
8104 MVI A , i/p 3E , i/p
8106 OUT DC( port A) D3 , DC
8108 HLT 76

Find the Calculation for _______________________________( in volts )

Rf = KΩ ( kilo ohm )

Digital input (i/p) Analog output


00
0F
1F
2F
3F
4F
5F
6F
7F
8F
9F
AF
BF
CF
DF
EF
FF

D) Result :

i) Linearity Error for R – 2R method =

ii) Resolution =

iii) Accuracy =

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 38

17. INTERFACING OF HEX KEY BOARD USING 8085

Date of the exp:

AIM:
To write an assembly language program to interface a Hex Keyboard using 8085.

PROCEDURE
a) Facilities required doing the experiment:

1. 8085 Microprocessor Kit 1


2. IC- 8255
3 .DC Power Supply 5V 1
4. Hex-Keyboard.

b) Procedure for doing the experiment:

1. Start the process


2. Initialize IC-8255
3. Check for key press
4. If Number of key is pressed go to step 3
5. Identification of key pressed
6. Get the display code
7. Display the key press
8. Go to step 3
9. Stop the process.
LOOK UP TABLE:

ADDRESS OPCODE
8600 3F
8601 06
8602 5B
8603 4F
8604 66
8605 6D
8606 7D
8607 07
8608 7F
8609 6F
860A 77
860B 7C
860C 39
860D 5E
860E 79
860F 71

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 39

C) Program for Hex Key board:

ADDRESS MNEMONICS OPCODE COMMENTS


8010 MVI A , 83H 3E , 83
8012 OUT DF D3 , DF
8014 L2) MVI C,04H 0E , 04
8016 MVI B, 00 H 06, 00
8018 MVI E , EF 1E , EF
801A L1) MOV A , E 7B
801B OUT DC D3 , DC
801D RLC 07
801E MOV E , A 5F
801F IN DE DB , DE
8021 ANI 0F E6 , 0F
8023 CPI OF FE , 0F
8025 JNZ (L3) C2 , 33, 80
8028 MOV A , B 78
8029 ADI 04H C6 , 04
802B MOV B , A 47
802C DCR C 0D
802D JNZ (L1) C2 , 1A, 80
8030 JMP (L2) C3 , 14, 80
8033 L3) CPI 0E FE , 0E
8035 JZ (L4) CA , 45, 80
8038 INR B 04
8039 CPI 0D FE , 0D
803B JZ (L4) CA , 45, 80
803E INR B 04
803F CPI 0B FE , 0B
8041 JZ (L4) CA , 45, 80
8044 INR B 04
8045 L4) MOV A,B 78
8046 CALL DISPL CD , 80 , 13
8049 LXIH , 8600 21 , 00, 86
804C MOV L ,B 68
804D MOV A , M 7E
804E OUT DC D3 , DC
8050 MVI A , 08 H 3E , 08
8052 OUT DC D3 , DC
8054 JMP (L2) C3 , 14, 80

D) RESULT:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 40

18. SUM OF SIMPLE SERIES AND ARITHMETIC PROGRESSION

Date of the exp:

AIM:
To write an assembly language program for sum of simple series and arithmetic
program of an N-elements of 8-bit using 8085

PROCEDURE
a) Facilities required doing the experiment:

1. 8085 Microprocessor Kit 1

b) Procedure for doing the experiment:

1. Start the process


2. Get the number of terms in series
3. Get the common different of the series
4. Get the first term of the series
5. Get calculated N-1
6. Multiply d with N-1
7. The result of the step 5 store the memory
8. Compare two times of step with the result
9. Add the result of step with the result
10. Obtain result of step 8
11. Divide the result obtained from step 9 with 2
12. Stop the process.

C) Program for sum of N-elements:

ADDRESS MNEMONICS OPCODE COMMENTS


8200 LXIH , 8400 21 , 00, 84
8203 MOV C , M 4E
8204 INX H 23
8205 MVI E , 00 1E , 00
8207 XRA A AF
8208 L2) ADD M 86
8209 JNC (L1) D2 , 0D, 82
820C INR E 1C
820D L1) INX H 23
820E DCR C 0D
820F JNZ (L2) C2 , 08, 82
8212 STA 8600 32 , 00, 86
8215 MOV A , E 7B
8216 STA 8601 32 , 01, 86
8219 HLT 76

Department of Physics | M Gopinathan


No. of
SUM OF N- ELEMENTS INPUT DATA OUTPUT DATA
element

8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 840A 840B 8601 8600

Department of Physics
04 01 5C 0A 03 00 6A

05 4C 1D 04 5F 0F 00 DB

06 5F 3E 06 08 0A 1B 00 D0

07 7F 2B 1D 09 5B 2C 5D 01 B4

|
08 25 3E 5F 2A 1E 3F 20 15 01 7E

09 5C 30 12 1C 2A 5B 50 15 3D 01 E1

0A 15 6E 4C 09 83 5F 32 14 1D 3A 02 57

0B 20 14 0F 8C 2D 3B 18 06 29 5B 6C 02 45
S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 41

M Gopinathan
S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 42

𝒏
Program for sum of series arithmetic progression: S=𝟐 [𝟐𝒂 + (𝒏 − 𝟏)𝒅]

ADDRESS MNEMONICS OPCODE COMMENTS


8400 LXI B 0000 01 , 00 , 00
8403 LXI H 0000 21 , 00 ,00
8406 LXI D , 0000 11 , 00 ,00
8409 LDA 8200 3A , 00, 82
840C DCR A 3D
840D MOV C , A 4F
840E LDA 8201 3A , 01, 82
8411 L1) DAD B 09
8412 DCR A 3D
8413 JNZ (L1) C2 , 11, 84
8416 XCH G EB
8417 LDA 8202 3A , 02, 82
841A MOV L ,A 6F
841B DAD H 29
841C DAD D 19
841D XCH G EB
841E LXI H 0000 21 , 00 , 00
8421 LDA 8200 3A , 00, 82
8424 L2) DAD D 19
8425 DCR A 3D
8426 JNZ (L2) C2 , 24, 84
8429 LXI B , 0000 01 , 00 ,00
842C L3) INX B 03
842D DCX H 2B
842E DCX H 2B
842F MOV A , L 7D
8430 ORA H B4
8431 JNZ (L3) C2 , 2C, 84
8434 MOV A , C 79
8435 STA 8600 32 , 00, 86
8438 MOV A , B 78
8439 STA 8601 32 , 01, 86
843C HLT 76

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 43

TABLE:

SUM OF SERIES AND ARITHMETIC PROGRESSION:-

𝒏
N d a S= [𝟐𝒂 + (𝒏 − 𝟏)𝒅]
𝟐
( 8200 ) (8201) ( 8202) (8601) (8600)
0A 04 03 00 24
06 02 07 00 48
05 0A 01 00 69
08 05 0C 00 EC
0A 0F 0B 03 11
0C 0E 0D 04 38

Result:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 44

19. STEPPER MOTOR INTERFACE USING MICROCONTROLLER-8051

Date of the exp:

AIM:
To write a program to run a stepper motor using stepper motor with
microcontroller - 8051
PROCEDURE
a) Facilities required doing the experiment:
1. 8051 Microcontroller Kit 1
2. DC Power Supply 5V 1
b) Procedure for doing the experiment:
1. Start the process
2. Select the mode of rotation
3. Rotate the motor
4. Stop the process
Rotation through a degree for 4 times
1. Choose the angle to rotate the number for 4 times through the selected angle.
2. Stop the process.

c) Program: I ) Stepper motor interface continuous rotation

ADDRESS MNEMONICS OPCODE COMMENTS


90C0 MOV DPTR ,FF23 90,FF,23
90C3 MOV A , 80 74 , 80
90C5 MOV X @DPTR,A F0
90C6 MOV DPTR,FF,22 90,FF,22
90C9 MOV A , 02 74 , 02
90CB MOV X @ DPTR,A F0
90CC MOV R0,04 78 , 04
90CE MOV DPTR ,9050 90,90,50
90D1 MOV A @ DPTR E0
90D2 PUSH DPH C0 , 83
90D4 PUSH DPL C0 , 82
90D6 MOV DPTR,FF20 90,FF,20
90D9 MOV X @ DPTR,A F0
90DA MOV R1, DC 79 , DC
90DC MOV R2, 0A 7A , 0A
90DF DJNZ R2 LOOP DA , FE
90F0 DJNZ R1 AGAIN D9 , FA
90E2 POP DPL D0 , 82
90E4 POP DPH D0 , 83
90E6 INC DPTR A3
90E7 DJNZ R0 ,CONT D8 , E8
90E9 SJMP START 80 , E1

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 45

DIRECTION LOOK UP TABLE:

CLOCK ANTI- ANGLE HEXA DATA


WISE CLOCKWISE
9050 - 09 9050 – 0A 360 32
9051 – 05 9050 - 06 180 19
9052 – 06 9052 – 05 90 0D
9053 – 0A 9053- 09 45 06
II) Rotation required angle:

ADDRESS MNEMONICS OPCODE COMMENTS


9120 MOV DPTR,FF23 90,FF,23
9123 MOV A,80 74 , 80
9125 MOV X @ DPTR,A F0
9126 MOV R3,(data) 76 , (data)
9128 MOV DPTR,FF22 90,FF,22
912B MOV A ,02 74 , 02
912D MOV X @ DPTR,A F0
912E MOV R0 , 04 78 , 04
9130 MOV DPTR ,9050 90 ,90 ,50
9133 MOV X @ DPTR E0
9134 PUSH DPH C0 , 83
9136 PUSH DPL C0 , 82
9138 MOV DPTR,FF20 90,FF,20
913B MOV X @ DPTR,A F0
913C MOV R1 , FF 79 , FF
913E MOV R2 , FF 7A , FF
9140 DJNZ R2,LOOP DA , FE
9142 DJNZ R1,AGAIN D9 , FA
9144 DJNZ R3,RPT DB , 02
9146 SJMP ENT 80 , 09
9148 POP DPL D0 , 82
914A POP DPH D0 , 83
914C INC DPTR A3
914D DJNZ R0 CONT D8 , E4
914F SJMP START 80 , DD
9151 MOV DPTR,FF22 90,FF,22
9154 MOV A , 00 74 , 00
9156 MOV X @ DPTR,A F0
9157 LJMP MONITOR 02,00,00

RESULT:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 46

20. ADDITION AND SUBTRACTION USING MICROCONTROLLER-8051

Date of the exp:

AIM:
To write an assembly language program for Addition and Subtraction using
microcontroller - 8051.

PROCEDURE
a) Facilities required doing the experiment:

1. 8051 Microcontroller Kit 1


2. DC Power Supply 5V 1

b) Procedure for doing the experiment:

ADDITION
1. Clear the program status word
2. Select the register bank by giving proper values to Rs1 and RS0 of PSW
3. Load the accumulator A reg with any decided 8-bit
4. Load the register R0 with the 2nd 8-bit data
5. Add these two 8-bit number
6. Store the data
7. Stop the process
SUBTRACTION

1. Clear the carry flag


2. Initialize the reg for borrow
3. Get the first operand into the accumulator
4. Subtract the second operand from the accumulator
5. If a borrow result in memory location
6. Store the data
7. Stop the process.

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 47

ADDITION PROGRAM

ADDRESS MNEMONICS OPCODE COMMENTS


8100 MOV DPTR,#9000 90,90,00
8103 MOV X A,@DPTR E0
8104 MOV R0 , A F8
8105 INC DPTR A3
8106 MOV X A@DPTR E0
8107 ADD A , R0 28
8108 INC DPTR A3
8109 MOV X@ DPTR , A F0
810A LJMP , MONITOR 02 , 00 , 00

ADDITION TABLE:

INPUT OUTPUT
9000 9001 9002
05 03 08
03 07 0A
02 02 04
AF 03 62
CD FF BC
0F 5F 6E

RESULT:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 48

SUTRACTION PROGRAM

ADDRESS MNEMONICS OPCODE COMMENTS


8200 MOV DPTR,#9200 90,92,00
8203 MOV X A,@DPTR E0
8204 MOV B , A F5 , F0
8205 INC DPTR A3
8206 MOV X A@DPTR E0
8207 CLR C A4
8208 SUBB A , R0 98
8209 INC DPTR A3
820A MOV X@ DPTR , A F0
820B LJMP , MONITOR 02 , 00 , 00

SUTRACTION TABLE

INPUT OUTPUT
9000 9001 9002
03 05 02
04 07 03
0F 5F 50
37 47 10
AE EF 41
DE FE 20

RESULT:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 49

21. MULTIPLICATION AND DIVISION USING MICROCONTROLLER-8051

Date of the exp:

AIM:
To write an assembly language program for multiplication and division using
microcontroller - 8051.

PROCEDURE
a) Facilities required doing the experiment:

1. 8051 Microcontroller Kit 1


2. DC Power Supply 5V 1

b) Procedure for doing the experiment:

MULTIPLICATION
1. Get the multiple in the accumulator
2. Get the multiplicand in the B reg
3. Multiply A with B reg
4. Store the result in memory location
5. Stop the process

DIVISION

1. Get the dividend in the accumulator A reg


2. Get the divisor in the register B
3. Divide A reg by B reg
4. Store the result in memory location
5. Stop the program.

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 50

MULTIPLICATION:-

ADDRESS MNEMONICS OPCODE COMMENTS


8300 MOV DPTR,#9200 90,92,00
8303 MOV X A,@DPTR E0
8304 MOV B , A F5 , F0
8306 INC DPTR A3
8307 MOV X A@DPTR E0
8308 MUL AB A4
8309 INC DPTR A3
830A MOV X@ DPTR , A F0
830B LJMP , MONITOR 02 , 00 , 00

MULTIPLICATION TABLE:

INPUT OUTPUT
9200 9201 9202
04 00 00
0A 0C 78
1A 2E AC
8A 0E 8C
03 05 0F
0F 5F 91
06 02 0C
0A 05 14

RESULT:

Department of Physics | M Gopinathan


S r i B h a r a t h i W o m e n ’ s A r t s & S c i e n c e C o l l e g e ∎ P a g e | 51

DIVISION:-

ADDRESS MNEMONICS OPCODE COMMENTS


8400 MOV DPTR,#9300 90 , 93 , 00
8403 MOV X A@DPTR E0
8404 MOV B , A F5 , F0
8406 INC DPTR A3
8407 MOV X A@DPTR E0
8408 DIV AB 84
8409 INC DPTR A3
840A MOV X @DPTR F0
840B MOV A, B E5 , F0
840D INC DPTR A3
840E MOV X@DPTR, A F0
840F JUMP, MONITOR 02, 00 ,00

INPUT OUTPUT
9300 - DIVISOR 9301- DIVIDEND 9302 - QUOTIENT 9303- REMAINDER
04 02 02 00

9301>9300 9301 is big number e.g. =4


9300 is small number e.g. =2 [4/2] =2

RESULT:-

Department of Physics | M Gopinathan

Potrebbero piacerti anche