0% found this document useful (0 votes)
17 views3 pages

Assembly Language Programming Basic and Loop Based

The document provides assembly language programs (ALPs) for the 8051 microcontroller, including routines for adding 16-bit and 8-bit numbers, performing BCD addition, division, calculating factorials, generating the Fibonacci series, and finding the maximum number in a set. Each program is presented with specific instructions and comments for clarity. The document serves as a practical guide for programming the 8051 microcontroller using assembly language.

Uploaded by

Yashwant Sahoo
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views3 pages

Assembly Language Programming Basic and Loop Based

The document provides assembly language programs (ALPs) for the 8051 microcontroller, including routines for adding 16-bit and 8-bit numbers, performing BCD addition, division, calculating factorials, generating the Fibonacci series, and finding the maximum number in a set. Each program is presented with specific instructions and comments for clarity. The document serves as a practical guide for programming the 8051 microcontroller using assembly language.

Uploaded by

Yashwant Sahoo
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ASSEMBLY LANGUAGE PROGRAMMING

8051 MICROCONTROLLER

1. Write an ALP for adding 2 16 bit numbers.


MOV DPTR,#2040H
MOV A,#22H
MOV B,#42H
ADDC A,DPH
MOV DPH,A
MOV A,B
ADDC A,DPL
MOV DPL,A
END

2. Write an ALP for adding 2 8 bit numbers


MOV A,#10H
MOV B,#10H
ADD A,B
END

3. Write an ALP for performing 16 BIT BCD addition


(i) MOV DPTR,#2040H
MOV A,#22H
MOV B,#42H
ADDC A,DPL
DA A
MOV DPL,A
MOV A,B
ADDC A,DPH
DA A
MOV DPH,A
END
(ii) MOV A,#20H
MOV B,#70H
ADD A,B
DA A
4. Write an ALP for performing division
MOV A,#02H
MOV B,#03H
DIV AB

5. Write an ALP for performing factorial


MOV DPTR,#1000H
MOVX A,@DPTR
MOV R1,A
MOV A,#01H
LOOP:MOV B,R1
MUL AB
DJNZ R1,LOOP
MOVX @DPTR,A
END

6. Write an ALP for finding the finbonacci series


MOV DPTR,#1000H
MOV R0,#09H
MOV A,#00H
MOV B,#01H
DEC R0
DEC R0
MOVX @DPTR, A
INC DPTR
MOV A,B
MOVX @DPTR,A
MOV A,#00H
MOV B,#01H
LOOP:ADD A,B
INC DPTR
MOVX @DPTR,A
XCH A,B
DJNZ R0,LOOP
END

7. Write an ALP for finding the maximum number


MOV DPTR,#1000H
MOV R1,#05H
MOV B,#00H
AGAIN: MOVX A,@DPTR
CJNE A,B,LABEL1
SJMP LABEL2
LABEL1:JC LABEL2
MOV B,A
LABEL2:INC DPTR
DJNZ R1,AGAIN
END

You might also like