SlideShare a Scribd company logo
1 of 25
Download to read offline
Practical
Manual
Microcontroller
Prof. Suraj R. Gaikwad
Prof. Suraj R. Gaikwad MIC
Exp: 1) To write an assembly language program for arithmetic operations.
Program:
1) MOV A,#20H
MOV F0,#20H
ADD A,F0
RET
2) MOV A,#20H
MOV F0,#10H
SUB A,F0
RET
3) MOV A,#04H
MOV F0,#02H
MUL A,F0
RET
4) MOV A,#10H
MOV F0,#02H
ADD A,F0
RET
Results:
Addition: A = 40H
Subtraction: A = 0AH
Multiplication: A = 08H
Division: A = 05H
Prof. Suraj R. Gaikwad MIC
Exp:2) To develop an assembly language program to transfer block of 10
bytes stored in internal data memory from location 40H to 60H.
Program:
ORG 0000H
MOV R0,#40H
MOV R1,#60H
MOV R2,#0AH
LOOP:MOV A,@R0
MOV @R1,A
INC R0
INC R1
DJNZ R2, LOOP
END
Prof. Suraj R. Gaikwad MIC
Exp:3) To develop an assembly language program to get square of numbers.
Program:
ORG 0000H
MOV R0,#40H
MOV R1,#60H
MOV R2,#0AH
LOOP1:MOV A,@R0
MOV B,@R0
MUL AB
MOV @R1,A
INC R0
INC R1
DJNZ R2,LOOP1
END
Result:
Input:
Output:
00H = 0D
01H = 1D
04H = 4D
09H = 9D
10H = 16D
19H = 25D
24H = 36D
31H = 49D
40H = 64D
51H = 81D
Prof. Suraj R. Gaikwad MIC
Exp:4) To develop program for arranging 10 numbers in descending order.
Program:
ORG 00H
ARR EQU 70H
L0:MOV R1,#ARR
MOV R0,#ARR
MOV R2,#0AH
MOV R3,#00H
DEC R2
L1:MOV A,@R0
MOV B,A
INC R1
SUBB A,@R1
JNC L2
MOV A,B
XCH A,@R1
MOV @R0,A
MOV R3,#01H
L2:INC R0
DJNZ R2,L1
CJNE R3,#00,L0
SJMP $
END
Result:
Input:
Output:
Prof. Suraj R. Gaikwad MIC
Exp:5) To develop a program to generate Square wave over port pins.
Program:
ORG 0000H :initialization
MOV TMOD,#10H :move 10H into timer/counter mode control resister
UP:
MOV TL1,#0D2H :move 0D2H into timer 1 low byte
MOV TH1,#0FFH :move offH into timer 1 high byte
SETB TR1 :addressed TR1 is set, TR1=timer 1 run control bit
WAIT:
JNB TF1,WAIT :jump if addressed TR1 is 0, otherwise
proceed with next instruction
CLR TR1 :adressed TR1 is cleared
CPL P1.5 : complement the addressed P1.5
CLR TF1 : adressed TF1 is cleared, TF1=timer 1 overflow flag
SJMP UP :program branches unconditionally to address indicated
END :end
Result:
Prof. Suraj R. Gaikwad MIC
Exp:6) To generate Square wave using DAC.
Circuit Diagram:
C Program:
#include <REG51xD2.H>
#include <stdio.h>
sbit Amp = P3^3; /* Port line to change amplitude */
sbit Fre = P3^2; /* Port line to change frequency */
void delay(unsigned int x) /* delay routine */
{
for(;x>0;x--);
}
main()
{
unsigned char on = 0x7f,off=0x00;
unsigned int fre = 100;
while(1)
Prof. Suraj R. Gaikwad MIC
{
if(!Amp) /* if user choice is to change amplitude */
{
while(!Amp); /* wait for key release */
on+=0x08; /* Increase the amplitude */
}
if(!Fre) /* if user choice is to change frequency */
{
if(fre > 1000) /* if frequency exceeds 1000 reset to default */
fre = 100;
while(!Fre); /* wait for key release */
fre += 50; /* Increase the frequency */
}
P0=on; /* write amplitude to port */
P1=on;
delay(fre);
P0 = off; /* clear port */
P1 = off;
delay(fre);
}
}
Output Waveform:
Prof. Suraj R. Gaikwad MIC
Assembly Program:
ORG 0000H
MOV DPTR, #8000H
UP:MOV DPL,#40H
MOV DPH,#40H
CLR A
MOVC A,@A+DPTR
SETB P1.5
WAIT:JNB P1.5,WAIT
CLR P1.5
SJMP UP
END
Output Waveform:
Prof. Suraj R. Gaikwad MIC
Exp:7) To write a program to drive Stepper Motor.
Theory:
Driving Unipolar Stepper Motor with 8051:
Unipolar stepper motors can be used in three modes namely the Wave Drive, Full
Drive and Half Drive mode.
Half Drive Stepping Sequence
Prof. Suraj R. Gaikwad MIC
Interfacing Using L293D:
Interfacing Using ULN2003:
Prof. Suraj R. Gaikwad MIC
Programs:
Keil C Code for Wave Drive:
Prof. Suraj R. Gaikwad MIC
Keil C Code for Full Drive:
Prof. Suraj R. Gaikwad MIC
Keil C Code for Half Drive:
Prof. Suraj R. Gaikwad MIC
Result:
1) Wave drive stepper sequence:
Prof. Suraj R. Gaikwad MIC
2) Full drive stepping sequence:
Prof. Suraj R. Gaikwad MIC
3) Half wave stepping sequence:
Prof. Suraj R. Gaikwad MIC
Prof. Suraj R. Gaikwad MIC
Prof. Suraj R. Gaikwad MIC
Exp:8) To write a program to drive Stepper Motor in clockwise direction and
anti-clockwise direction.
Program:
ORG 0000H
MOV R2,#12H
MOV A,#88H
LOOP1: MOV P2,A
RR A
DJNZ R2, LOOP1
MOV R2,#12H
MOV A,#11H
LOOP2: MOV P2,A
RL A
DJNZ R2, LOOP2
END
Result:
Prof. Suraj R. Gaikwad MIC
Prof. Suraj R. Gaikwad MIC
Prof. Suraj R. Gaikwad MIC
Exp:9) To write a program to read keyboard and display code.
Diagram:
Program:
• Program to interface matrix keyboard 4x4
• Rows are connected to the Port pins P1.0-P1.3 & Columns are connected to
Port pins P2.0-P2.3
• Rows are grounded one by one and read columns Seven segment display is
connected at port P0
ORG 00H
AJMP START
ORG 13H
RETI
START:MOV P0,#00H
MOV P2,#0FH ; Port Pins P2.0 to P2.3 i/p pins and P2.4 to P2.7 o/p pins
MOV P1,#00H ; Port P0 output port
REL: MOV P1,#00H ; make all rows ground to check all keys
MOV A,P2 ; read port p2 to ensure that all keys released
Prof. Suraj R. Gaikwad MIC
ANL A,#0FH ; maks upper bits because they are not used
CJNE A,#0FH,REL ; check till all keys released
AGAIN: ACALL DELAY
MOV A,P2 ; see if any key pressed or not?
ANL A,#0FH ; mask upper bits
CJNE A,#0FH,KPRESS ; if a is not equal to 0fh then key is pressed
SJMP AGAIN ; check again if key is not pressed
KPRESS: ACALL DELAY
MOV A,P2 ;
ANL A,#0FH ; mask unused upper bits
CJNE A,#0FH,KPRESS1 ; if a is not equal to 0fh then key is pressed
SJMP AGAIN ; check again if key is not pressed
KPRESS1:
MOV P1,#0FEH ; ground row 0
MOV A,P2 ; read all columns
ANL A,#0FH ; mask unused upper bits
CJNE A,0FH,R_0 ; key is pressed in first row (row 0),check columns
MOV P1,#0FDH ; Ground ROW 1
MOV A,P2 ; read all columns
ANL A,#0FH ; mask unused upper bits
CJNE A,0FH,R_1 ;key is pressed in second row (row 1),check columns
MOV P1,#0FBH ; ground row 2
MOV A,P2 ; read all columns
ANL A,#0FH ; mask unused upper bits
CJNE A,0FH,R_2 ;key is pressed in third row (row 2),check columns
MOV P1,#0F7H ; ground row 0
MOV A,P2 ; read all columns
ANL A,#0FH ; mask unused upper bits
CJNE A,0FH,R_3 ;key is pressed in fourth row (row 3),check columns
LJMP AGAIN
R_0: MOV DPTR,#KCODE0 ;set dptr=start of row 0
SJMP CHECK_C
R_1: MOV DPTR,#KCODE1 ;set dptr=start of row 1
SJMP CHECK_C
R_2: MOV DPTR,#KCODE2 ;set dptr=start of row 2
SJMP CHECK_C
R_3: MOV DPTR,#KCODE3 ;set dptr=start of row 3
CHECK_C:
RRC A ;check whether carry occurs or not
JNC GET_CODE
Prof. Suraj R. Gaikwad MIC
INC DPTR
SJMP CHECK_C
GET_CODE: CLR A
MOVC A,@A+dptr
MOV P0,A
LJMP REL
DELAY: MOV R7,#0FFh
DLOOP: MOV R6,#0FFh
D_LOOP: DJNZ R6,D_LOOP
DJNZ R7,DLOOP
RET
Result:
KCODE0: DB '0','1','2','3' ; These codes are for LCDs
KCODE1: DB '4','5','6','7' ; Replace this code by seven
KCODE2: DB '8','9','A','B' ; segment code as per your
KCODE3: DB 'C','D','E','F' ; Circuit.

More Related Content

What's hot

Scheme logic implement pwr plant cntrl
Scheme logic implement pwr plant cntrlScheme logic implement pwr plant cntrl
Scheme logic implement pwr plant cntrl
michaeljmack
 
Interrupt programming
Interrupt programming Interrupt programming
Interrupt programming
vijaydeepakg
 
Chp2 introduction to the 68000 microprocessor copy
Chp2 introduction to the 68000 microprocessor   copyChp2 introduction to the 68000 microprocessor   copy
Chp2 introduction to the 68000 microprocessor copy
mkazree
 

What's hot (20)

Ports 0f 8051
Ports 0f 8051Ports 0f 8051
Ports 0f 8051
 
Steppert Motor Interfacing With Specific Angle Entered Through Keypad
Steppert Motor Interfacing With Specific Angle Entered Through KeypadSteppert Motor Interfacing With Specific Angle Entered Through Keypad
Steppert Motor Interfacing With Specific Angle Entered Through Keypad
 
Interrupt programming with 8051 microcontroller
Interrupt programming with 8051  microcontrollerInterrupt programming with 8051  microcontroller
Interrupt programming with 8051 microcontroller
 
Scheme logic implement pwr plant cntrl
Scheme logic implement pwr plant cntrlScheme logic implement pwr plant cntrl
Scheme logic implement pwr plant cntrl
 
Interrupt
InterruptInterrupt
Interrupt
 
Microprocessor Laboratory 2: Logical instructions
Microprocessor Laboratory 2: Logical instructionsMicroprocessor Laboratory 2: Logical instructions
Microprocessor Laboratory 2: Logical instructions
 
8051 ports
8051 ports8051 ports
8051 ports
 
microprocessors
microprocessorsmicroprocessors
microprocessors
 
Interrupt programming
Interrupt programming Interrupt programming
Interrupt programming
 
Lec12
Lec12Lec12
Lec12
 
Chp2 introduction to the 68000 microprocessor copy
Chp2 introduction to the 68000 microprocessor   copyChp2 introduction to the 68000 microprocessor   copy
Chp2 introduction to the 68000 microprocessor copy
 
Intelligent Transportation System
Intelligent Transportation SystemIntelligent Transportation System
Intelligent Transportation System
 
Switched reluctance motor speed control using microcontroller
Switched reluctance motor speed control using microcontrollerSwitched reluctance motor speed control using microcontroller
Switched reluctance motor speed control using microcontroller
 
8051 interrupts
8051 interrupts8051 interrupts
8051 interrupts
 
Ring counter
Ring counterRing counter
Ring counter
 
14827 shift registers
14827 shift registers14827 shift registers
14827 shift registers
 
9 timer programming
9 timer programming9 timer programming
9 timer programming
 
1 D 1 Tri
1 D 1 Tri1 D 1 Tri
1 D 1 Tri
 
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2
SE PAI Unit 5_Timer Programming in 8051 microcontroller_Part 2
 
Class9
Class9Class9
Class9
 

Viewers also liked

Viewers also liked (20)

Research Process
Research ProcessResearch Process
Research Process
 
the amazing quran
the amazing quranthe amazing quran
the amazing quran
 
EngAhmed
EngAhmedEngAhmed
EngAhmed
 
Bonner Directors 2016 -Book of Bonner
Bonner Directors 2016 -Book of Bonner Bonner Directors 2016 -Book of Bonner
Bonner Directors 2016 -Book of Bonner
 
etailment WIEN 2016 - A. Schiechl, S. Danninger, F. Wolf – Netconomy & SAP Ös...
etailment WIEN 2016 - A. Schiechl, S. Danninger, F. Wolf – Netconomy & SAP Ös...etailment WIEN 2016 - A. Schiechl, S. Danninger, F. Wolf – Netconomy & SAP Ös...
etailment WIEN 2016 - A. Schiechl, S. Danninger, F. Wolf – Netconomy & SAP Ös...
 
Participación Político Social. Peruanos Haciendo Perú. por Sara Sara
Participación Político Social. Peruanos Haciendo Perú. por Sara SaraParticipación Político Social. Peruanos Haciendo Perú. por Sara Sara
Participación Político Social. Peruanos Haciendo Perú. por Sara Sara
 
Butterfly blizzard: millions of butterflies
Butterfly blizzard: millions of butterfliesButterfly blizzard: millions of butterflies
Butterfly blizzard: millions of butterflies
 
20151020 Metis
20151020 Metis20151020 Metis
20151020 Metis
 
Unit 4 Outcome 1B - Questions v1a
Unit 4 Outcome 1B - Questions v1aUnit 4 Outcome 1B - Questions v1a
Unit 4 Outcome 1B - Questions v1a
 
22.6 Profitability Ratios
22.6 Profitability Ratios22.6 Profitability Ratios
22.6 Profitability Ratios
 
Task-based syllabus design and task sequencing
Task-based syllabus design and task sequencingTask-based syllabus design and task sequencing
Task-based syllabus design and task sequencing
 
uanraju inst cv 9 sep 2015
uanraju inst cv 9 sep 2015uanraju inst cv 9 sep 2015
uanraju inst cv 9 sep 2015
 
Mga sawikain o idyuma
Mga sawikain o idyumaMga sawikain o idyuma
Mga sawikain o idyuma
 
Portaria 260-2014-ingles
Portaria 260-2014-inglesPortaria 260-2014-ingles
Portaria 260-2014-ingles
 
Multiple perspectives on bibliometric data
Multiple perspectives on bibliometric dataMultiple perspectives on bibliometric data
Multiple perspectives on bibliometric data
 
Tutorial 6
Tutorial 6Tutorial 6
Tutorial 6
 
Slide show 208
Slide show 208Slide show 208
Slide show 208
 
Perfil dos alunos à saída da  Escolaridade Obrigatória 
Perfil dos alunos à saída da  Escolaridade Obrigatória Perfil dos alunos à saída da  Escolaridade Obrigatória 
Perfil dos alunos à saída da  Escolaridade Obrigatória 
 
Amc Square learning Job Tips
Amc Square learning Job TipsAmc Square learning Job Tips
Amc Square learning Job Tips
 
Viewse um006 -en-e (1)
Viewse um006 -en-e (1)Viewse um006 -en-e (1)
Viewse um006 -en-e (1)
 

Similar to Mic practicals

Basic programming of 8085
Basic programming of 8085 Basic programming of 8085
Basic programming of 8085
vijaydeepakg
 
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
 
Solutionmanual8051microcontrollerbymazidi
Solutionmanual8051microcontrollerbymazidi Solutionmanual8051microcontrollerbymazidi
Solutionmanual8051microcontrollerbymazidi
Ahsan Mehmood
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copy
mkazree
 
Solution manual 8051 microcontroller by mazidi
Solution manual 8051 microcontroller by mazidiSolution manual 8051 microcontroller by mazidi
Solution manual 8051 microcontroller by mazidi
Muhammad Abdullah
 
Unit1 jwfiles
Unit1 jwfilesUnit1 jwfiles
Unit1 jwfiles
mrecedu
 

Similar to Mic practicals (20)

8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
 
Basic programming of 8085
Basic programming of 8085 Basic programming of 8085
Basic programming of 8085
 
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
 
Stack and subroutine
Stack and subroutineStack and subroutine
Stack and subroutine
 
Microprocessor Week 8: Subroutine
Microprocessor Week 8: Subroutine Microprocessor Week 8: Subroutine
Microprocessor Week 8: Subroutine
 
Microcontroller 8051- soft.ppt
Microcontroller 8051- soft.pptMicrocontroller 8051- soft.ppt
Microcontroller 8051- soft.ppt
 
Micro task1
Micro task1Micro task1
Micro task1
 
Solutionmanual8051microcontrollerbymazidi
Solutionmanual8051microcontrollerbymazidi Solutionmanual8051microcontrollerbymazidi
Solutionmanual8051microcontrollerbymazidi
 
Solutionmanual8051microcontrollerbymazidi 131215070701-phpapp02
Solutionmanual8051microcontrollerbymazidi 131215070701-phpapp02Solutionmanual8051microcontrollerbymazidi 131215070701-phpapp02
Solutionmanual8051microcontrollerbymazidi 131215070701-phpapp02
 
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
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copy
 
Embedded System Practical manual (1)
Embedded System Practical manual (1)Embedded System Practical manual (1)
Embedded System Practical manual (1)
 
6.pptx
6.pptx6.pptx
6.pptx
 
Real Time Embedded System
Real Time Embedded SystemReal Time Embedded System
Real Time Embedded System
 
Solution manual 8051 microcontroller by mazidi
Solution manual 8051 microcontroller by mazidiSolution manual 8051 microcontroller by mazidi
Solution manual 8051 microcontroller by mazidi
 
8085labmanual.pdf
8085labmanual.pdf8085labmanual.pdf
8085labmanual.pdf
 
final ppt2.pptx
final ppt2.pptxfinal ppt2.pptx
final ppt2.pptx
 
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
 
Unit1 jwfiles
Unit1 jwfilesUnit1 jwfiles
Unit1 jwfiles
 

Recently uploaded

Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Dr.Costas Sachpazis
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Christo Ananth
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
rknatarajan
 

Recently uploaded (20)

ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 

Mic practicals

  • 2. Prof. Suraj R. Gaikwad MIC Exp: 1) To write an assembly language program for arithmetic operations. Program: 1) MOV A,#20H MOV F0,#20H ADD A,F0 RET 2) MOV A,#20H MOV F0,#10H SUB A,F0 RET 3) MOV A,#04H MOV F0,#02H MUL A,F0 RET 4) MOV A,#10H MOV F0,#02H ADD A,F0 RET Results: Addition: A = 40H Subtraction: A = 0AH Multiplication: A = 08H Division: A = 05H
  • 3. Prof. Suraj R. Gaikwad MIC Exp:2) To develop an assembly language program to transfer block of 10 bytes stored in internal data memory from location 40H to 60H. Program: ORG 0000H MOV R0,#40H MOV R1,#60H MOV R2,#0AH LOOP:MOV A,@R0 MOV @R1,A INC R0 INC R1 DJNZ R2, LOOP END
  • 4. Prof. Suraj R. Gaikwad MIC Exp:3) To develop an assembly language program to get square of numbers. Program: ORG 0000H MOV R0,#40H MOV R1,#60H MOV R2,#0AH LOOP1:MOV A,@R0 MOV B,@R0 MUL AB MOV @R1,A INC R0 INC R1 DJNZ R2,LOOP1 END Result: Input: Output: 00H = 0D 01H = 1D 04H = 4D 09H = 9D 10H = 16D 19H = 25D 24H = 36D 31H = 49D 40H = 64D 51H = 81D
  • 5. Prof. Suraj R. Gaikwad MIC Exp:4) To develop program for arranging 10 numbers in descending order. Program: ORG 00H ARR EQU 70H L0:MOV R1,#ARR MOV R0,#ARR MOV R2,#0AH MOV R3,#00H DEC R2 L1:MOV A,@R0 MOV B,A INC R1 SUBB A,@R1 JNC L2 MOV A,B XCH A,@R1 MOV @R0,A MOV R3,#01H L2:INC R0 DJNZ R2,L1 CJNE R3,#00,L0 SJMP $ END Result: Input: Output:
  • 6. Prof. Suraj R. Gaikwad MIC Exp:5) To develop a program to generate Square wave over port pins. Program: ORG 0000H :initialization MOV TMOD,#10H :move 10H into timer/counter mode control resister UP: MOV TL1,#0D2H :move 0D2H into timer 1 low byte MOV TH1,#0FFH :move offH into timer 1 high byte SETB TR1 :addressed TR1 is set, TR1=timer 1 run control bit WAIT: JNB TF1,WAIT :jump if addressed TR1 is 0, otherwise proceed with next instruction CLR TR1 :adressed TR1 is cleared CPL P1.5 : complement the addressed P1.5 CLR TF1 : adressed TF1 is cleared, TF1=timer 1 overflow flag SJMP UP :program branches unconditionally to address indicated END :end Result:
  • 7. Prof. Suraj R. Gaikwad MIC Exp:6) To generate Square wave using DAC. Circuit Diagram: C Program: #include <REG51xD2.H> #include <stdio.h> sbit Amp = P3^3; /* Port line to change amplitude */ sbit Fre = P3^2; /* Port line to change frequency */ void delay(unsigned int x) /* delay routine */ { for(;x>0;x--); } main() { unsigned char on = 0x7f,off=0x00; unsigned int fre = 100; while(1)
  • 8. Prof. Suraj R. Gaikwad MIC { if(!Amp) /* if user choice is to change amplitude */ { while(!Amp); /* wait for key release */ on+=0x08; /* Increase the amplitude */ } if(!Fre) /* if user choice is to change frequency */ { if(fre > 1000) /* if frequency exceeds 1000 reset to default */ fre = 100; while(!Fre); /* wait for key release */ fre += 50; /* Increase the frequency */ } P0=on; /* write amplitude to port */ P1=on; delay(fre); P0 = off; /* clear port */ P1 = off; delay(fre); } } Output Waveform:
  • 9. Prof. Suraj R. Gaikwad MIC Assembly Program: ORG 0000H MOV DPTR, #8000H UP:MOV DPL,#40H MOV DPH,#40H CLR A MOVC A,@A+DPTR SETB P1.5 WAIT:JNB P1.5,WAIT CLR P1.5 SJMP UP END Output Waveform:
  • 10. Prof. Suraj R. Gaikwad MIC Exp:7) To write a program to drive Stepper Motor. Theory: Driving Unipolar Stepper Motor with 8051: Unipolar stepper motors can be used in three modes namely the Wave Drive, Full Drive and Half Drive mode. Half Drive Stepping Sequence
  • 11. Prof. Suraj R. Gaikwad MIC Interfacing Using L293D: Interfacing Using ULN2003:
  • 12. Prof. Suraj R. Gaikwad MIC Programs: Keil C Code for Wave Drive:
  • 13. Prof. Suraj R. Gaikwad MIC Keil C Code for Full Drive:
  • 14. Prof. Suraj R. Gaikwad MIC Keil C Code for Half Drive:
  • 15. Prof. Suraj R. Gaikwad MIC Result: 1) Wave drive stepper sequence:
  • 16. Prof. Suraj R. Gaikwad MIC 2) Full drive stepping sequence:
  • 17. Prof. Suraj R. Gaikwad MIC 3) Half wave stepping sequence:
  • 18. Prof. Suraj R. Gaikwad MIC
  • 19. Prof. Suraj R. Gaikwad MIC
  • 20. Prof. Suraj R. Gaikwad MIC Exp:8) To write a program to drive Stepper Motor in clockwise direction and anti-clockwise direction. Program: ORG 0000H MOV R2,#12H MOV A,#88H LOOP1: MOV P2,A RR A DJNZ R2, LOOP1 MOV R2,#12H MOV A,#11H LOOP2: MOV P2,A RL A DJNZ R2, LOOP2 END Result:
  • 21. Prof. Suraj R. Gaikwad MIC
  • 22. Prof. Suraj R. Gaikwad MIC
  • 23. Prof. Suraj R. Gaikwad MIC Exp:9) To write a program to read keyboard and display code. Diagram: Program: • Program to interface matrix keyboard 4x4 • Rows are connected to the Port pins P1.0-P1.3 & Columns are connected to Port pins P2.0-P2.3 • Rows are grounded one by one and read columns Seven segment display is connected at port P0 ORG 00H AJMP START ORG 13H RETI START:MOV P0,#00H MOV P2,#0FH ; Port Pins P2.0 to P2.3 i/p pins and P2.4 to P2.7 o/p pins MOV P1,#00H ; Port P0 output port REL: MOV P1,#00H ; make all rows ground to check all keys MOV A,P2 ; read port p2 to ensure that all keys released
  • 24. Prof. Suraj R. Gaikwad MIC ANL A,#0FH ; maks upper bits because they are not used CJNE A,#0FH,REL ; check till all keys released AGAIN: ACALL DELAY MOV A,P2 ; see if any key pressed or not? ANL A,#0FH ; mask upper bits CJNE A,#0FH,KPRESS ; if a is not equal to 0fh then key is pressed SJMP AGAIN ; check again if key is not pressed KPRESS: ACALL DELAY MOV A,P2 ; ANL A,#0FH ; mask unused upper bits CJNE A,#0FH,KPRESS1 ; if a is not equal to 0fh then key is pressed SJMP AGAIN ; check again if key is not pressed KPRESS1: MOV P1,#0FEH ; ground row 0 MOV A,P2 ; read all columns ANL A,#0FH ; mask unused upper bits CJNE A,0FH,R_0 ; key is pressed in first row (row 0),check columns MOV P1,#0FDH ; Ground ROW 1 MOV A,P2 ; read all columns ANL A,#0FH ; mask unused upper bits CJNE A,0FH,R_1 ;key is pressed in second row (row 1),check columns MOV P1,#0FBH ; ground row 2 MOV A,P2 ; read all columns ANL A,#0FH ; mask unused upper bits CJNE A,0FH,R_2 ;key is pressed in third row (row 2),check columns MOV P1,#0F7H ; ground row 0 MOV A,P2 ; read all columns ANL A,#0FH ; mask unused upper bits CJNE A,0FH,R_3 ;key is pressed in fourth row (row 3),check columns LJMP AGAIN R_0: MOV DPTR,#KCODE0 ;set dptr=start of row 0 SJMP CHECK_C R_1: MOV DPTR,#KCODE1 ;set dptr=start of row 1 SJMP CHECK_C R_2: MOV DPTR,#KCODE2 ;set dptr=start of row 2 SJMP CHECK_C R_3: MOV DPTR,#KCODE3 ;set dptr=start of row 3 CHECK_C: RRC A ;check whether carry occurs or not JNC GET_CODE
  • 25. Prof. Suraj R. Gaikwad MIC INC DPTR SJMP CHECK_C GET_CODE: CLR A MOVC A,@A+dptr MOV P0,A LJMP REL DELAY: MOV R7,#0FFh DLOOP: MOV R6,#0FFh D_LOOP: DJNZ R6,D_LOOP DJNZ R7,DLOOP RET Result: KCODE0: DB '0','1','2','3' ; These codes are for LCDs KCODE1: DB '4','5','6','7' ; Replace this code by seven KCODE2: DB '8','9','A','B' ; segment code as per your KCODE3: DB 'C','D','E','F' ; Circuit.