SlideShare a Scribd company logo
Basic Experiments
(Using ALP code)
Data Movement
a) Move a block of data within internal RAM
8051 ALP code
ORG 00H
MOV R1,#50H
MOV RO,#60H
MOV R3,#0AH
LOOP:MOV A,@R1
MOV @R0,A
INC R1
INC R0
DJNZ R3,LOOP
HERE:SJMP HERE
END
Result : Enter 10 numbers in the memory location d:0x59.Run
the program and see the result in memory location d:0x60 to
0x69
Sample Run:
Before execution: d:0x50 = 45 25 60 25 60 55 44 12 41 58
After execution : d:0x60 = 45 25 60 25 60 55 44 12 41 58
b) Exchange a block of data between internal RAM and
External memory
8051 ALP code
ORG 00H
MOV R0,#50H //SOURCE ADDRESS
MOV DPTR,#0150H //DESTINATION ADDRESS
MOV R3,#05H //COUNT
BACK:MOV A,@R0
MOV R2,A
MOVX A,@DPTR
MOV @R0,A
XCH A,R2
MOVX @DPTR,A
INC R0
INC DPTR
DJNZ R3,BACK
HERE:SJMP HERE
END
Sample Run:
Before execution: d:0x50 = 45 58 52 92 25
After execution : x:0x0150 = 45 58 52 92 25
Arithmetic Operation :
a)Evaluatesimple arithmetic expression such as y=((5*2)-(4-1))/3)%2
8051 ALP code
ORG 00H
MOV A,#4
MOV R1,#1
ADD A,R1
MOV R1,A
MOV B,#05H
MOV A,#02H
MUL AB
SUBB A,R1
MOV B,#03H
DIV AB
MOV 30H,A
HERE:SJMP HERE
END
Sample Run:
Before execution: d:0x30 = 00
After execution : d:0x30 = 01
b)Additionof three 8-bit BCD numbers and obtainresult in BCD form
8051 ALP code
ORG 00H
START:MOV R0,#02H
MOV R2,#00H
MOV R1,#50H
MOV A,@R1
INC R1
UP : ADD A,@R1
DA A
JNC NEXT
INC R2
NEXT : INC R1
DJNZ R0,UP
MOV O3H,A
HERE:SJMP HERE
END
Sample Run:
Before execution: d:0x50 = 05 06 04
After execution : d:0x02 = 00 15
Logical Operation :
a)Evaluate logical expression Y=a&&b||c^!d where a,b,c and d
are 8-bit data
8051 ALP code
ORG 00H
MOV R0,40H
MOV A,41H
ANL A,R0
MOV B,A
MOV R0,42H
MOV A,43H
CPL A
XRL A,R0
ORL A,B
MOV 44H,A
HERE:SJMP HERE
END
Sample Run:
Before execution: d:0x40 = 45 56 14 85
After execution : d:0x44 = 6E
b)Rotation or Shift operation on 16 bit data
8051 ALP code
ORG 00H
CLR C
MOV A,41H
RLC A
MOV B,A
MOV A,40H
RLC A
MOV 40H,A
MOV A,B
MOV ACC.0,C
MOV 41H,A
HERE:SJMP HERE
END
Sample Run:
Before execution: d:0x40 = 45 56
After execution : d:0x44 = 8A A C
Code Conversions :
a)(1)Two digit packed BCD to unpacked BCD
8051 ALP code
ORG 00H
MOV A,40H
MOV B,A
ANL A,#0F0H
SWAP A
MOV 41H,A
MOV A,B
ANL A,#0FH
MOV 42H,A
HERE:SJMP HERE
END
Sample Run:
Before execution: d:0x40 = 32
After execution : d:0x41 = 03 02
a)(2)Two digit unpacked BCD to packed BCD
8051 ALP code
ORG 00H
MOV A,40H
SAWP A
ORL A,41H
MOV 42H,A
HERE:SJMP HERE
END
Sample Run:
Before execution: d:0x40 = 03 02
After execution : d:0x44 = 32
b)(1) BCD to Binary Conversion
8051 ALP code
ORG 00H
MOV DPTR,#40H
MOVX A,@DPTR
ANL A,#0F0H
SWAP A
MOV B,#0AH
MUL AB
MOV R1,A
MOVX A,@DPTR
ANL A,0FH
ADD A,R1
INC DPTR
MOVX @DPTR,A
HERE:SJMP HERE
END
Sample Run:
Before execution: X:0x0040 = 45(Decimal/BCD)
After execution : X:0x0041 = 2D(Hex/Binary value)
b)(2) Binary to BCD Conversion
8051 ALP code
ORG 00H
MOV DPTR,#9000H
MOVX A,@DPTR
MOV B,#10
DIV AB
INC DPTR
XCH A,B
MOVX @DPTR,A
XCH A,B
MOV B,#10
DIV AB
INC DPTR
MOVX A,@DPTR
HERE:SJMP HERE
END
Sample Run:
Before execution: X:0x9000 = FF(Hex/Binary value)
After execution : X:0x9001 = 05(BCD Value)lower digit first
X:0x9002H = 05(BCD Value)
X:0x9002H = 02(BCD Value)Higher digit first
c)(1) Two digit packed BCD to ASCII
8051 ALP code
ORG 00H
MOV R1,#50H
MOV A,@R1
MOV R2,A
SWAP A
ANL A,#OFH
ORL A,#30H
INC R1
MOV @R1,A
MOV A,R2
ANL A,#0FH
ORL A,#30H
INC R1
MOV @R1,A
HERE:SJMP HERE
END
Sample Run:
Before execution: d:0x50 = 48
After execution : d:0x51 = 34 38
b)(2) Binary to BCD Conversion
8051 ALP code
ORG 00H
CLR C
MOV A,40H
SUBB A,#30H
SWAP A
MOV B,A
CLR C
MOV A,41H
SUBB A,#30H
ADD A,B
MOV 42H,A
HERE:SJMP HERE
END
Sample Run:
Before execution: d:0x40 = 34 38
After execution : d:0x42 = 48
Program to search a given 8bit number in an array of N numbers.
8051 ALP code
ORG 00H
MOV R0,#40H
MOV R1,#0AH
MOV A,#76H
BACK:MOV B,@RO
CJNE A,B,NEXT
MOV A,OFFH
SJMP LAST
NEXT:INC R0
DJNZ R1,BACK
MOV A,#0AAH
LAST:MOV 78H,B
HERE:SJMP HERE
END
Sample Run:
Before execution: d:0x40 = 45 58 39 45 89 45 22 69 76 33
Reg B = 76
After execution : d:0x78 = FF
a)To sort an array of an 6 byte of data in ascending order.
8051 ALP code
ORG 00H
MOV R0,#50
L1:MOV DPTR,#9000H
MOV A,R0
MOV R1,A
L2:MOVX A,@DPTR
MOV B,A
INC DPTR
MOVX A,@DPTR
CLR C
MOV R2,A
SUBB A,B
JNC NOEXCHG
MOV A,B
MOVX @DPTR,A
DEC DPL
MOV A,R2
MOVX @DPTR,A
INC DPTR
NOEXCHG:DJNZ R1,L2 Sample Run:
DJNZ RO,L1 Before execution:X:0x9000 = 45 58 39 45 89 95
HERE:SJMP HERE After execution :X:0x9000 = 39 45 45 58 89 95
END
a)To sort an array of an 6 byte of data in descending order.
8051 ALP code
ORG 00H
MOV R0,#50
L1:MOV DPTR,#9000H
MOV A,R0
MOV R1,A
L2:MOVX A,@DPTR
MOV B,A
INC DPTR
MOVX A,@DPTR
CLR C
MOV R2,A
SUBB A,B
JC NOEXCHG
MOV A,B
MOVX @DPTR,A
DEC DPL
MOV A,R0
MOVX @DPTR,A
INC DPTR
NOEXCHG:DJNZ R1,L2 Sample Run:
DJNZ RO,L1 Before execution:X:0x9000 = 45 58 39 45 89 95
HERE:SJMP HERE After execution :X:0x9000 = 95 89 58 45 45 39
END
Program to count the number of ones and zeros in the data
saved in two consecutive memory location.
8051 ALP code
ORG 00H
MOV R0,#00H
MOV R1,#00H
MOV R2,#08H
MOV A,#0F0H
LOOP3:CLR C
RLC A
JC LOOP1
INC R0
SJMP LOOP2
LOOP1:INC R1
LOOP2:DJNZ R2,LOOP3
HERE:SJMP HERE
END
Sample Run:
Input for execution : Ri = OFOH
Output of execution : R0 = 04
R1 = 04
Program to toggle a particular bit in the internal RAM with the
delay of N ms given the clock frequency f MHz with the use of
delay subroutine.
8051 ALP code
ORG 00H
AGAIN:
SETB P1.2
ACALL DELAY
CLR P1.2
ACALL DELAY
SJMP AGAIN
DELAY:MOV TMOD,#10H
MOV TL1,#0B0H
MOV TH1,3CH
SETB TR1
BACK:
JNB TF1,BACK
CLR TR1
CLR TF1
RET
END
Result : Run the program and observe the toggling of P1.2 bit.

More Related Content

What's hot

8085 instruction-set
8085 instruction-set8085 instruction-set
8085 instruction-set
sudheerkethamreddy
 
8085 instruction-set
8085 instruction-set8085 instruction-set
8085 instruction-set
Muhammadalizardari
 
implementation of data instrucions in emu8086
implementation of data instrucions in emu8086implementation of data instrucions in emu8086
implementation of data instrucions in emu8086
COMSATS Abbottabad
 
mup
mupmup
Aeav 301 lec 19
Aeav 301 lec 19Aeav 301 lec 19
Aeav 301 lec 19
0mehdi
 
Intel codetable
Intel codetableIntel codetable
Intel codetable
J R7
 
Adc(pic)
Adc(pic)Adc(pic)
Adc(pic)
shahbhaumikk
 
Code 8051
Code 8051Code 8051
Code 8051
harihiet
 
Introduction to 8085 by adi ppt
Introduction to 8085 by adi pptIntroduction to 8085 by adi ppt
Introduction to 8085 by adi ppt
Prof. Dr. K. Adisesha
 
Lathe Spindle Sensor
Lathe Spindle SensorLathe Spindle Sensor
Lathe Spindle Sensor
JoeCritt
 
Boolean and comparison_instructions
Boolean and comparison_instructionsBoolean and comparison_instructions
Boolean and comparison_instructions
Army Public School and College -Faisal
 
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
Saumitra Rukmangad
 
Shift rotate
Shift rotateShift rotate
Shift rotate
fika sweety
 
Understanding Tomasulo Algorithm
Understanding Tomasulo AlgorithmUnderstanding Tomasulo Algorithm
Understanding Tomasulo Algorithm
onesuper
 
NetBeez - What's the ARP cache
NetBeez - What's the ARP cacheNetBeez - What's the ARP cache
NetBeez - What's the ARP cache
NetBeez, Inc.
 
Device Modeling of RSQB Flip Flop using PSpice
Device Modeling of RSQB Flip Flop using PSpiceDevice Modeling of RSQB Flip Flop using PSpice
Device Modeling of RSQB Flip Flop using PSpice
Tsuyoshi Horigome
 
Instruction Set 8085
Instruction Set 8085Instruction Set 8085
Instruction Set 8085
Stupidsid.com
 
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONSINTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
Swapnil Mishra
 

What's hot (18)

8085 instruction-set
8085 instruction-set8085 instruction-set
8085 instruction-set
 
8085 instruction-set
8085 instruction-set8085 instruction-set
8085 instruction-set
 
implementation of data instrucions in emu8086
implementation of data instrucions in emu8086implementation of data instrucions in emu8086
implementation of data instrucions in emu8086
 
mup
mupmup
mup
 
Aeav 301 lec 19
Aeav 301 lec 19Aeav 301 lec 19
Aeav 301 lec 19
 
Intel codetable
Intel codetableIntel codetable
Intel codetable
 
Adc(pic)
Adc(pic)Adc(pic)
Adc(pic)
 
Code 8051
Code 8051Code 8051
Code 8051
 
Introduction to 8085 by adi ppt
Introduction to 8085 by adi pptIntroduction to 8085 by adi ppt
Introduction to 8085 by adi ppt
 
Lathe Spindle Sensor
Lathe Spindle SensorLathe Spindle Sensor
Lathe Spindle Sensor
 
Boolean and comparison_instructions
Boolean and comparison_instructionsBoolean and comparison_instructions
Boolean and comparison_instructions
 
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
 
Shift rotate
Shift rotateShift rotate
Shift rotate
 
Understanding Tomasulo Algorithm
Understanding Tomasulo AlgorithmUnderstanding Tomasulo Algorithm
Understanding Tomasulo Algorithm
 
NetBeez - What's the ARP cache
NetBeez - What's the ARP cacheNetBeez - What's the ARP cache
NetBeez - What's the ARP cache
 
Device Modeling of RSQB Flip Flop using PSpice
Device Modeling of RSQB Flip Flop using PSpiceDevice Modeling of RSQB Flip Flop using PSpice
Device Modeling of RSQB Flip Flop using PSpice
 
Instruction Set 8085
Instruction Set 8085Instruction Set 8085
Instruction Set 8085
 
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONSINTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
 

Similar to Maicrocontroller lab basic experiments

Microcontroller 8051- soft.ppt
Microcontroller 8051- soft.pptMicrocontroller 8051- soft.ppt
Microcontroller 8051- soft.ppt
steffydean
 
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
Technogroovy
 
Programs using Microcontrollers.ppt
Programs using Microcontrollers.pptPrograms using Microcontrollers.ppt
Programs using Microcontrollers.ppt
SasiBhushan22
 
Microcontroller 8051 soft
Microcontroller 8051  softMicrocontroller 8051  soft
Microcontroller 8051 soft
baluusa8
 
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
 
Microprocessor system - summarize
Microprocessor system - summarizeMicroprocessor system - summarize
Microprocessor system - summarize
Hisham Mat Hussin
 
Micro task1
Micro task1Micro task1
Micro task1
ChetanShahukari
 
unit5_8051_microcontroller presentation.pdf
unit5_8051_microcontroller presentation.pdfunit5_8051_microcontroller presentation.pdf
unit5_8051_microcontroller presentation.pdf
tchandoo1
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontroller
jokersclown57
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
karthiga selvaraju
 
8085 paper-presentation
8085 paper-presentation8085 paper-presentation
8085 paper-presentation
JiMs ChAcko
 
Addressing mode and instruction set using 8051
Addressing mode and instruction set using 8051Addressing mode and instruction set using 8051
Addressing mode and instruction set using 8051
logesh waran
 
Microprocessor Part 3
Microprocessor    Part  3Microprocessor    Part  3
Microprocessor Part 3
Sajan Agrawal
 
microp-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :Pmicrop-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :P
Jathin Kanumuri
 
microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2
Jathin Kanumuri
 
3 jump, loop and call instructions
3 jump, loop and call instructions3 jump, loop and call instructions
3 jump, loop and call instructions
Channabasappa Kudarihal
 
New text document
New text documentNew text document
New text document
zocaniveb
 
8085 Architecture
8085 Architecture8085 Architecture
8085 Architecture
Kumar Anand Singh
 
6 arithmetic logic inst and prog
6 arithmetic logic inst and prog6 arithmetic logic inst and prog
6 arithmetic logic inst and prog
Channabasappa Kudarihal
 
Real Time Embedded System
Real Time Embedded SystemReal Time Embedded System
Real Time Embedded System
Vrushali Lanjewar
 

Similar to Maicrocontroller lab basic experiments (20)

Microcontroller 8051- soft.ppt
Microcontroller 8051- soft.pptMicrocontroller 8051- soft.ppt
Microcontroller 8051- soft.ppt
 
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
 
Programs using Microcontrollers.ppt
Programs using Microcontrollers.pptPrograms using Microcontrollers.ppt
Programs using Microcontrollers.ppt
 
Microcontroller 8051 soft
Microcontroller 8051  softMicrocontroller 8051  soft
Microcontroller 8051 soft
 
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
 
Microprocessor system - summarize
Microprocessor system - summarizeMicroprocessor system - summarize
Microprocessor system - summarize
 
Micro task1
Micro task1Micro task1
Micro task1
 
unit5_8051_microcontroller presentation.pdf
unit5_8051_microcontroller presentation.pdfunit5_8051_microcontroller presentation.pdf
unit5_8051_microcontroller presentation.pdf
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontroller
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
8085 paper-presentation
8085 paper-presentation8085 paper-presentation
8085 paper-presentation
 
Addressing mode and instruction set using 8051
Addressing mode and instruction set using 8051Addressing mode and instruction set using 8051
Addressing mode and instruction set using 8051
 
Microprocessor Part 3
Microprocessor    Part  3Microprocessor    Part  3
Microprocessor Part 3
 
microp-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :Pmicrop-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :P
 
microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2
 
3 jump, loop and call instructions
3 jump, loop and call instructions3 jump, loop and call instructions
3 jump, loop and call instructions
 
New text document
New text documentNew text document
New text document
 
8085 Architecture
8085 Architecture8085 Architecture
8085 Architecture
 
6 arithmetic logic inst and prog
6 arithmetic logic inst and prog6 arithmetic logic inst and prog
6 arithmetic logic inst and prog
 
Real Time Embedded System
Real Time Embedded SystemReal Time Embedded System
Real Time Embedded System
 

Recently uploaded

2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
PuktoonEngr
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
Divyam548318
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
mahammadsalmanmech
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
Wearable antenna for antenna applications
Wearable antenna for antenna applicationsWearable antenna for antenna applications
Wearable antenna for antenna applications
Madhumitha Jayaram
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
yokeleetan1
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
JamalHussainArman
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 

Recently uploaded (20)

2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
Wearable antenna for antenna applications
Wearable antenna for antenna applicationsWearable antenna for antenna applications
Wearable antenna for antenna applications
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 

Maicrocontroller lab basic experiments

  • 2. Data Movement a) Move a block of data within internal RAM 8051 ALP code ORG 00H MOV R1,#50H MOV RO,#60H MOV R3,#0AH LOOP:MOV A,@R1 MOV @R0,A INC R1 INC R0 DJNZ R3,LOOP HERE:SJMP HERE END Result : Enter 10 numbers in the memory location d:0x59.Run the program and see the result in memory location d:0x60 to 0x69 Sample Run: Before execution: d:0x50 = 45 25 60 25 60 55 44 12 41 58 After execution : d:0x60 = 45 25 60 25 60 55 44 12 41 58
  • 3. b) Exchange a block of data between internal RAM and External memory 8051 ALP code ORG 00H MOV R0,#50H //SOURCE ADDRESS MOV DPTR,#0150H //DESTINATION ADDRESS MOV R3,#05H //COUNT BACK:MOV A,@R0 MOV R2,A MOVX A,@DPTR MOV @R0,A XCH A,R2 MOVX @DPTR,A INC R0 INC DPTR DJNZ R3,BACK HERE:SJMP HERE END Sample Run: Before execution: d:0x50 = 45 58 52 92 25 After execution : x:0x0150 = 45 58 52 92 25
  • 4. Arithmetic Operation : a)Evaluatesimple arithmetic expression such as y=((5*2)-(4-1))/3)%2 8051 ALP code ORG 00H MOV A,#4 MOV R1,#1 ADD A,R1 MOV R1,A MOV B,#05H MOV A,#02H MUL AB SUBB A,R1 MOV B,#03H DIV AB MOV 30H,A HERE:SJMP HERE END Sample Run: Before execution: d:0x30 = 00 After execution : d:0x30 = 01
  • 5. b)Additionof three 8-bit BCD numbers and obtainresult in BCD form 8051 ALP code ORG 00H START:MOV R0,#02H MOV R2,#00H MOV R1,#50H MOV A,@R1 INC R1 UP : ADD A,@R1 DA A JNC NEXT INC R2 NEXT : INC R1 DJNZ R0,UP MOV O3H,A HERE:SJMP HERE END Sample Run: Before execution: d:0x50 = 05 06 04 After execution : d:0x02 = 00 15
  • 6. Logical Operation : a)Evaluate logical expression Y=a&&b||c^!d where a,b,c and d are 8-bit data 8051 ALP code ORG 00H MOV R0,40H MOV A,41H ANL A,R0 MOV B,A MOV R0,42H MOV A,43H CPL A XRL A,R0 ORL A,B MOV 44H,A HERE:SJMP HERE END Sample Run: Before execution: d:0x40 = 45 56 14 85 After execution : d:0x44 = 6E
  • 7. b)Rotation or Shift operation on 16 bit data 8051 ALP code ORG 00H CLR C MOV A,41H RLC A MOV B,A MOV A,40H RLC A MOV 40H,A MOV A,B MOV ACC.0,C MOV 41H,A HERE:SJMP HERE END Sample Run: Before execution: d:0x40 = 45 56 After execution : d:0x44 = 8A A C
  • 8. Code Conversions : a)(1)Two digit packed BCD to unpacked BCD 8051 ALP code ORG 00H MOV A,40H MOV B,A ANL A,#0F0H SWAP A MOV 41H,A MOV A,B ANL A,#0FH MOV 42H,A HERE:SJMP HERE END Sample Run: Before execution: d:0x40 = 32 After execution : d:0x41 = 03 02
  • 9. a)(2)Two digit unpacked BCD to packed BCD 8051 ALP code ORG 00H MOV A,40H SAWP A ORL A,41H MOV 42H,A HERE:SJMP HERE END Sample Run: Before execution: d:0x40 = 03 02 After execution : d:0x44 = 32
  • 10. b)(1) BCD to Binary Conversion 8051 ALP code ORG 00H MOV DPTR,#40H MOVX A,@DPTR ANL A,#0F0H SWAP A MOV B,#0AH MUL AB MOV R1,A MOVX A,@DPTR ANL A,0FH ADD A,R1 INC DPTR MOVX @DPTR,A HERE:SJMP HERE END Sample Run: Before execution: X:0x0040 = 45(Decimal/BCD) After execution : X:0x0041 = 2D(Hex/Binary value)
  • 11. b)(2) Binary to BCD Conversion 8051 ALP code ORG 00H MOV DPTR,#9000H MOVX A,@DPTR MOV B,#10 DIV AB INC DPTR XCH A,B MOVX @DPTR,A XCH A,B MOV B,#10 DIV AB INC DPTR MOVX A,@DPTR HERE:SJMP HERE END Sample Run: Before execution: X:0x9000 = FF(Hex/Binary value) After execution : X:0x9001 = 05(BCD Value)lower digit first X:0x9002H = 05(BCD Value) X:0x9002H = 02(BCD Value)Higher digit first
  • 12. c)(1) Two digit packed BCD to ASCII 8051 ALP code ORG 00H MOV R1,#50H MOV A,@R1 MOV R2,A SWAP A ANL A,#OFH ORL A,#30H INC R1 MOV @R1,A MOV A,R2 ANL A,#0FH ORL A,#30H INC R1 MOV @R1,A HERE:SJMP HERE END Sample Run: Before execution: d:0x50 = 48 After execution : d:0x51 = 34 38
  • 13. b)(2) Binary to BCD Conversion 8051 ALP code ORG 00H CLR C MOV A,40H SUBB A,#30H SWAP A MOV B,A CLR C MOV A,41H SUBB A,#30H ADD A,B MOV 42H,A HERE:SJMP HERE END Sample Run: Before execution: d:0x40 = 34 38 After execution : d:0x42 = 48
  • 14. Program to search a given 8bit number in an array of N numbers. 8051 ALP code ORG 00H MOV R0,#40H MOV R1,#0AH MOV A,#76H BACK:MOV B,@RO CJNE A,B,NEXT MOV A,OFFH SJMP LAST NEXT:INC R0 DJNZ R1,BACK MOV A,#0AAH LAST:MOV 78H,B HERE:SJMP HERE END Sample Run: Before execution: d:0x40 = 45 58 39 45 89 45 22 69 76 33 Reg B = 76 After execution : d:0x78 = FF
  • 15. a)To sort an array of an 6 byte of data in ascending order. 8051 ALP code ORG 00H MOV R0,#50 L1:MOV DPTR,#9000H MOV A,R0 MOV R1,A L2:MOVX A,@DPTR MOV B,A INC DPTR MOVX A,@DPTR CLR C MOV R2,A SUBB A,B JNC NOEXCHG MOV A,B MOVX @DPTR,A DEC DPL MOV A,R2 MOVX @DPTR,A INC DPTR NOEXCHG:DJNZ R1,L2 Sample Run: DJNZ RO,L1 Before execution:X:0x9000 = 45 58 39 45 89 95 HERE:SJMP HERE After execution :X:0x9000 = 39 45 45 58 89 95 END
  • 16. a)To sort an array of an 6 byte of data in descending order. 8051 ALP code ORG 00H MOV R0,#50 L1:MOV DPTR,#9000H MOV A,R0 MOV R1,A L2:MOVX A,@DPTR MOV B,A INC DPTR MOVX A,@DPTR CLR C MOV R2,A SUBB A,B JC NOEXCHG MOV A,B MOVX @DPTR,A DEC DPL MOV A,R0 MOVX @DPTR,A INC DPTR NOEXCHG:DJNZ R1,L2 Sample Run: DJNZ RO,L1 Before execution:X:0x9000 = 45 58 39 45 89 95 HERE:SJMP HERE After execution :X:0x9000 = 95 89 58 45 45 39 END
  • 17. Program to count the number of ones and zeros in the data saved in two consecutive memory location. 8051 ALP code ORG 00H MOV R0,#00H MOV R1,#00H MOV R2,#08H MOV A,#0F0H LOOP3:CLR C RLC A JC LOOP1 INC R0 SJMP LOOP2 LOOP1:INC R1 LOOP2:DJNZ R2,LOOP3 HERE:SJMP HERE END Sample Run: Input for execution : Ri = OFOH Output of execution : R0 = 04 R1 = 04
  • 18. Program to toggle a particular bit in the internal RAM with the delay of N ms given the clock frequency f MHz with the use of delay subroutine. 8051 ALP code ORG 00H AGAIN: SETB P1.2 ACALL DELAY CLR P1.2 ACALL DELAY SJMP AGAIN DELAY:MOV TMOD,#10H MOV TL1,#0B0H MOV TH1,3CH SETB TR1 BACK: JNB TF1,BACK CLR TR1 CLR TF1 RET END Result : Run the program and observe the toggling of P1.2 bit.