SlideShare a Scribd company logo
1 of 21
8051
Part II
8051 ALP to load data from 50h to 54h
● org 0h
mov 50h,#0ah
mov 51h,#25h
mov 52h,#74h
mov 53h,#99h
mov 54h,#0bch
end
8051 ALP to move a block of data from 50-54h to
60-64h
● org 0h
mov a,50h
mov 60h,a
mov a,51h
mov 61h,a
mov a,52h
mov 62h,a
mov a,53h
mov 63h,a
mov a,54h
mov 64h,a
end
8051 ALP to block exchange w.r.t external ram using
loops
● org 0h
clr c
mov r5,#03
mov r0,#20h
mov dptr,#20h
up:movx a,@dptr
xch a,@r0
movx @dptr,a
inc r0
inc dptr
djnz r5,up
end
8051 ALP to find a given number is even or odd
● org 0h
clr c
mov a,#35h
rrc a
jc odd
mov a,#0aah
sjmp l1
odd:mov a,#0aah
l1:nop
end
8051 ALP to identify even and odd in an given array
● org 0h
clr c
mov r7,#05h
mov r4,#00h
mov r5,#00h
mov r0,#20h
up:mov a,@r0
rrc a
jc odd
inc r4
sjmp down
odd:inc r5
down:inc r0
djnz r7,up
end
8051 ALP to arrange in ascdending order
●
org 0h
mov r4,#04h
here:mov r0,#03h
mov r1,#30h
this:mov a,@r1
inc r1
mov b,@r0
cjne a,b,next
sjmp down
next:jc down
dec r0
mov @r0,b
inc r0
mov @r0,a
down:djnz r1,this
djnz r4,here
end
8051 ALP to indicate no of 1’s and 0’s
● org 0h
mov r6,#00h
mov r5,#00h
mov r7,#08h
mov a,#37h
up:rrc a
jc one
inc r6
sjmp down
one:inc r5
down:djnz r7,up
end
8051 ALP To add two 32-bit numbers
R6 R4 R2 R0
23 15 60 70
+
30 40 63 77
R7 R5 R3 R1
● org 0h
mov r0,#70h
mov r1,#77h
mov r2,#60h
mov r3,#63h
mov r4,#15h
mov r5,#40h
mov r6,#23h
mov r7,#30h
mov a,r0
add a,r1
mov 43h,a
mov a,r2
addc a,r3
mov 42h,a
addc a,r5
mov 41h,a
mov a,r6
addc a,r7
mov 40h,a
end
8051 ALP to subtract two 8-bit numbers
● org 0000h
mov a,40h
subb a,41h
mov 50h,a
end
8051 ALP to subtract two 16-bit numbers
● org 0h
mov r0,41h
mov r1,51h
mov r2,40h
mov r3,50h
mov a,r0
subb a,r1
mov 61h,a
mov a,r2
subb a,r3
mov 60h,a
end
8051 ALP to multiply two 16-bit numbers
● org 0h
mov r1,#0ffh
mov r2,#0ffh
mov r3,#0ffh
mov r4,#0ffh
mov a,r3
mov b,r4
mul ab
mov 44h,a
mov 43h,b
mov b,r1
mov a,r4
mul ab
add a,43h
mov 43h,a
mov a,b
addc a,#0h
mov 42h,a
mov a,r3
mov b,r2
mul ab
mov 53h,a
mov 52h,b
mov b,r1
mov a,r2
mul ab
add a,52h
mov 52h,a
mov a,b
addc a,#0h
mov 51h,a
clr c
mov 64h,44h
mov a,43h
add a,53h
mov 63h,a
mov a,42h
addc a,#0h
add a,52h
mov 62h,a
mov a,51h
addc a,#00h
mov 61h,a
end
8051 ALP to compute average
of n numbers
● org 0h
mov r3,#09h
mov r0,#20h
mov a,@r0
mov r6,a
inc r5
back: inc r0
mov a,@r0
addc a, r6
mov r6, a
inc r5
djnz r3, back
mov b, r5
end
8051 ALP to compute factorial
● org 0h
mov r4, #4h
mov r1, #1h
mov a, r1
back: inc r1
mov b, r1
mul ab
djnz r4, back
end
8051 ALP to compute gcd
● org 0h
mov a, #6h
mov b, #10h
back: mov r1, b
div ab
mov a, r1
into r1
cjne r1, #00h, back
end
8051 ALP to compute lcm
● org 0h
mov a, #6h
mov r6, a
mov b, #10h
mov r7, b
back: mov r1, b
div ab
mov a, r1
mov r1, b
cjne r1, #00h, back
mov r5, a
mov a, r6
mov b, r7
mul ab
mov b, r5
end
ALP to find number of positive numbers in an array of 10
number
● org 0h
mov r3, #05h
mov r0, #40h
check: mov a, @r0
inc r0
rlc a
jc down
inc r5
down: djnz r3, check
end
THANK YOU

More Related Content

Similar to 8051 -2

Winter training,Readymade Projects,Buy Projects,Corporate Training
Winter training,Readymade Projects,Buy Projects,Corporate TrainingWinter training,Readymade Projects,Buy Projects,Corporate Training
Winter training,Readymade Projects,Buy Projects,Corporate TrainingTechnogroovy
 
New text document
New text documentNew text document
New text documentzocaniveb
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontrollerjokersclown57
 
Microcontroller 8051 soft
Microcontroller 8051  softMicrocontroller 8051  soft
Microcontroller 8051 softbaluusa8
 
Maicrocontroller lab basic experiments
Maicrocontroller lab basic experimentsMaicrocontroller lab basic experiments
Maicrocontroller lab basic experimentsnoorahamed tahasildar
 
Maicrocontroller lab basic experiments
Maicrocontroller lab basic experiments Maicrocontroller lab basic experiments
Maicrocontroller lab basic experiments noorahamed tahasildar
 
Microcontroller (8051) general and simple alp n cprograms
Microcontroller (8051) general and simple alp n cprogramsMicrocontroller (8051) general and simple alp n cprograms
Microcontroller (8051) general and simple alp n cprogramsVedavyas PBurli
 
Linux Binary Exploitation - Return-oritend Programing
Linux Binary Exploitation - Return-oritend ProgramingLinux Binary Exploitation - Return-oritend Programing
Linux Binary Exploitation - Return-oritend ProgramingAngel Boy
 
1347 assemblylanguageprogrammingof8051-100523023308-phpapp01
1347 assemblylanguageprogrammingof8051-100523023308-phpapp011347 assemblylanguageprogrammingof8051-100523023308-phpapp01
1347 assemblylanguageprogrammingof8051-100523023308-phpapp01bvenkanna
 
Microcontroller 8051- soft.ppt
Microcontroller 8051- soft.pptMicrocontroller 8051- soft.ppt
Microcontroller 8051- soft.pptsteffydean
 
Embedded Systems Training & Live Projects @Technogroovy Systems India Pvt Ltd
Embedded Systems Training & Live Projects @Technogroovy Systems India Pvt Ltd Embedded Systems Training & Live Projects @Technogroovy Systems India Pvt Ltd
Embedded Systems Training & Live Projects @Technogroovy Systems India Pvt Ltd Technogroovy India
 
Buy Embedded Systems Projects Online,Buy B tech Projects Online
Buy Embedded Systems Projects Online,Buy B tech Projects OnlineBuy Embedded Systems Projects Online,Buy B tech Projects Online
Buy Embedded Systems Projects Online,Buy B tech Projects OnlineTechnogroovy
 
lec15_x86procedure_4up.pdf
lec15_x86procedure_4up.pdflec15_x86procedure_4up.pdf
lec15_x86procedure_4up.pdfhasan58964
 
The 8051 microcontroller
The 8051 microcontrollerThe 8051 microcontroller
The 8051 microcontrollerPallaviHailkar
 
8051 addressing modes
 8051 addressing modes 8051 addressing modes
8051 addressing modesghoshshweta
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051Dr. AISHWARYA N
 
Https _doc-0o-c4-apps-viewer.googleusercontent
Https  _doc-0o-c4-apps-viewer.googleusercontent Https  _doc-0o-c4-apps-viewer.googleusercontent
Https _doc-0o-c4-apps-viewer.googleusercontent vijaydeepakg
 
Logic, shift and rotate instruction
Logic, shift and rotate instructionLogic, shift and rotate instruction
Logic, shift and rotate instructionkashif Shafqat
 

Similar to 8051 -2 (20)

Winter training,Readymade Projects,Buy Projects,Corporate Training
Winter training,Readymade Projects,Buy Projects,Corporate TrainingWinter training,Readymade Projects,Buy Projects,Corporate Training
Winter training,Readymade Projects,Buy Projects,Corporate Training
 
New text document
New text documentNew text document
New text document
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontroller
 
mup
mupmup
mup
 
Microcontroller 8051 soft
Microcontroller 8051  softMicrocontroller 8051  soft
Microcontroller 8051 soft
 
Maicrocontroller lab basic experiments
Maicrocontroller lab basic experimentsMaicrocontroller lab basic experiments
Maicrocontroller lab basic experiments
 
Maicrocontroller lab basic experiments
Maicrocontroller lab basic experiments Maicrocontroller lab basic experiments
Maicrocontroller lab basic experiments
 
Arm chap 3 last
Arm chap 3 lastArm chap 3 last
Arm chap 3 last
 
Microcontroller (8051) general and simple alp n cprograms
Microcontroller (8051) general and simple alp n cprogramsMicrocontroller (8051) general and simple alp n cprograms
Microcontroller (8051) general and simple alp n cprograms
 
Linux Binary Exploitation - Return-oritend Programing
Linux Binary Exploitation - Return-oritend ProgramingLinux Binary Exploitation - Return-oritend Programing
Linux Binary Exploitation - Return-oritend Programing
 
1347 assemblylanguageprogrammingof8051-100523023308-phpapp01
1347 assemblylanguageprogrammingof8051-100523023308-phpapp011347 assemblylanguageprogrammingof8051-100523023308-phpapp01
1347 assemblylanguageprogrammingof8051-100523023308-phpapp01
 
Microcontroller 8051- soft.ppt
Microcontroller 8051- soft.pptMicrocontroller 8051- soft.ppt
Microcontroller 8051- soft.ppt
 
Embedded Systems Training & Live Projects @Technogroovy Systems India Pvt Ltd
Embedded Systems Training & Live Projects @Technogroovy Systems India Pvt Ltd Embedded Systems Training & Live Projects @Technogroovy Systems India Pvt Ltd
Embedded Systems Training & Live Projects @Technogroovy Systems India Pvt Ltd
 
Buy Embedded Systems Projects Online,Buy B tech Projects Online
Buy Embedded Systems Projects Online,Buy B tech Projects OnlineBuy Embedded Systems Projects Online,Buy B tech Projects Online
Buy Embedded Systems Projects Online,Buy B tech Projects Online
 
lec15_x86procedure_4up.pdf
lec15_x86procedure_4up.pdflec15_x86procedure_4up.pdf
lec15_x86procedure_4up.pdf
 
The 8051 microcontroller
The 8051 microcontrollerThe 8051 microcontroller
The 8051 microcontroller
 
8051 addressing modes
 8051 addressing modes 8051 addressing modes
8051 addressing modes
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051
 
Https _doc-0o-c4-apps-viewer.googleusercontent
Https  _doc-0o-c4-apps-viewer.googleusercontent Https  _doc-0o-c4-apps-viewer.googleusercontent
Https _doc-0o-c4-apps-viewer.googleusercontent
 
Logic, shift and rotate instruction
Logic, shift and rotate instructionLogic, shift and rotate instruction
Logic, shift and rotate instruction
 

Recently uploaded

electrical installation and maintenance.
electrical installation and maintenance.electrical installation and maintenance.
electrical installation and maintenance.benjamincojr
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsMathias Magdowski
 
Software Engineering Practical File Front Pages.pdf
Software Engineering Practical File Front Pages.pdfSoftware Engineering Practical File Front Pages.pdf
Software Engineering Practical File Front Pages.pdfssuser5c9d4b1
 
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptxSLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptxCHAIRMAN M
 
Seizure stage detection of epileptic seizure using convolutional neural networks
Seizure stage detection of epileptic seizure using convolutional neural networksSeizure stage detection of epileptic seizure using convolutional neural networks
Seizure stage detection of epileptic seizure using convolutional neural networksIJECEIAES
 
What is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, FunctionsWhat is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, FunctionsVIEW
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Ramkumar k
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...josephjonse
 
Adsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptAdsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptjigup7320
 
Interfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdfInterfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdfragupathi90
 
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024EMMANUELLEFRANCEHELI
 
Independent Solar-Powered Electric Vehicle Charging Station
Independent Solar-Powered Electric Vehicle Charging StationIndependent Solar-Powered Electric Vehicle Charging Station
Independent Solar-Powered Electric Vehicle Charging Stationsiddharthteach18
 
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...drjose256
 
Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..MaherOthman7
 
5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...archanaece3
 
handbook on reinforce concrete and detailing
handbook on reinforce concrete and detailinghandbook on reinforce concrete and detailing
handbook on reinforce concrete and detailingAshishSingh1301
 
15-Minute City: A Completely New Horizon
15-Minute City: A Completely New Horizon15-Minute City: A Completely New Horizon
15-Minute City: A Completely New HorizonMorshed Ahmed Rahath
 
engineering chemistry power point presentation
engineering chemistry  power point presentationengineering chemistry  power point presentation
engineering chemistry power point presentationsj9399037128
 
History of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & ModernizationHistory of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & ModernizationEmaan Sharma
 
Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfKira Dess
 

Recently uploaded (20)

electrical installation and maintenance.
electrical installation and maintenance.electrical installation and maintenance.
electrical installation and maintenance.
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility Applications
 
Software Engineering Practical File Front Pages.pdf
Software Engineering Practical File Front Pages.pdfSoftware Engineering Practical File Front Pages.pdf
Software Engineering Practical File Front Pages.pdf
 
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptxSLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
 
Seizure stage detection of epileptic seizure using convolutional neural networks
Seizure stage detection of epileptic seizure using convolutional neural networksSeizure stage detection of epileptic seizure using convolutional neural networks
Seizure stage detection of epileptic seizure using convolutional neural networks
 
What is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, FunctionsWhat is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, Functions
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
 
Adsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptAdsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) ppt
 
Interfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdfInterfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdf
 
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
 
Independent Solar-Powered Electric Vehicle Charging Station
Independent Solar-Powered Electric Vehicle Charging StationIndependent Solar-Powered Electric Vehicle Charging Station
Independent Solar-Powered Electric Vehicle Charging Station
 
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
 
Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..
 
5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...
 
handbook on reinforce concrete and detailing
handbook on reinforce concrete and detailinghandbook on reinforce concrete and detailing
handbook on reinforce concrete and detailing
 
15-Minute City: A Completely New Horizon
15-Minute City: A Completely New Horizon15-Minute City: A Completely New Horizon
15-Minute City: A Completely New Horizon
 
engineering chemistry power point presentation
engineering chemistry  power point presentationengineering chemistry  power point presentation
engineering chemistry power point presentation
 
History of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & ModernizationHistory of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & Modernization
 
Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdf
 

8051 -2

  • 2. 8051 ALP to load data from 50h to 54h ● org 0h mov 50h,#0ah mov 51h,#25h mov 52h,#74h mov 53h,#99h mov 54h,#0bch end
  • 3. 8051 ALP to move a block of data from 50-54h to 60-64h ● org 0h mov a,50h mov 60h,a mov a,51h mov 61h,a mov a,52h mov 62h,a mov a,53h mov 63h,a mov a,54h mov 64h,a end
  • 4. 8051 ALP to block exchange w.r.t external ram using loops ● org 0h clr c mov r5,#03 mov r0,#20h mov dptr,#20h up:movx a,@dptr xch a,@r0 movx @dptr,a inc r0 inc dptr djnz r5,up end
  • 5. 8051 ALP to find a given number is even or odd ● org 0h clr c mov a,#35h rrc a jc odd mov a,#0aah sjmp l1 odd:mov a,#0aah l1:nop end
  • 6. 8051 ALP to identify even and odd in an given array ● org 0h clr c mov r7,#05h mov r4,#00h mov r5,#00h mov r0,#20h up:mov a,@r0 rrc a jc odd inc r4 sjmp down odd:inc r5 down:inc r0 djnz r7,up end
  • 7. 8051 ALP to arrange in ascdending order ● org 0h mov r4,#04h here:mov r0,#03h mov r1,#30h this:mov a,@r1 inc r1 mov b,@r0 cjne a,b,next sjmp down next:jc down dec r0 mov @r0,b inc r0 mov @r0,a down:djnz r1,this djnz r4,here end
  • 8. 8051 ALP to indicate no of 1’s and 0’s ● org 0h mov r6,#00h mov r5,#00h mov r7,#08h mov a,#37h up:rrc a jc one inc r6 sjmp down one:inc r5 down:djnz r7,up end
  • 9. 8051 ALP To add two 32-bit numbers R6 R4 R2 R0 23 15 60 70 + 30 40 63 77 R7 R5 R3 R1 ● org 0h mov r0,#70h mov r1,#77h mov r2,#60h mov r3,#63h
  • 10. mov r4,#15h mov r5,#40h mov r6,#23h mov r7,#30h mov a,r0 add a,r1 mov 43h,a mov a,r2 addc a,r3 mov 42h,a addc a,r5 mov 41h,a mov a,r6 addc a,r7 mov 40h,a end
  • 11. 8051 ALP to subtract two 8-bit numbers ● org 0000h mov a,40h subb a,41h mov 50h,a end
  • 12. 8051 ALP to subtract two 16-bit numbers ● org 0h mov r0,41h mov r1,51h mov r2,40h mov r3,50h mov a,r0 subb a,r1 mov 61h,a mov a,r2 subb a,r3 mov 60h,a end
  • 13. 8051 ALP to multiply two 16-bit numbers ● org 0h mov r1,#0ffh mov r2,#0ffh mov r3,#0ffh mov r4,#0ffh mov a,r3 mov b,r4 mul ab mov 44h,a mov 43h,b mov b,r1 mov a,r4 mul ab
  • 14. add a,43h mov 43h,a mov a,b addc a,#0h mov 42h,a mov a,r3 mov b,r2 mul ab mov 53h,a mov 52h,b mov b,r1 mov a,r2 mul ab add a,52h mov 52h,a mov a,b addc a,#0h
  • 15. mov 51h,a clr c mov 64h,44h mov a,43h add a,53h mov 63h,a mov a,42h addc a,#0h add a,52h mov 62h,a mov a,51h addc a,#00h mov 61h,a end
  • 16. 8051 ALP to compute average of n numbers ● org 0h mov r3,#09h mov r0,#20h mov a,@r0 mov r6,a inc r5 back: inc r0 mov a,@r0 addc a, r6 mov r6, a inc r5 djnz r3, back mov b, r5 end
  • 17. 8051 ALP to compute factorial ● org 0h mov r4, #4h mov r1, #1h mov a, r1 back: inc r1 mov b, r1 mul ab djnz r4, back end
  • 18. 8051 ALP to compute gcd ● org 0h mov a, #6h mov b, #10h back: mov r1, b div ab mov a, r1 into r1 cjne r1, #00h, back end
  • 19. 8051 ALP to compute lcm ● org 0h mov a, #6h mov r6, a mov b, #10h mov r7, b back: mov r1, b div ab mov a, r1 mov r1, b cjne r1, #00h, back mov r5, a mov a, r6 mov b, r7 mul ab mov b, r5 end
  • 20. ALP to find number of positive numbers in an array of 10 number ● org 0h mov r3, #05h mov r0, #40h check: mov a, @r0 inc r0 rlc a jc down inc r5 down: djnz r3, check end