SlideShare a Scribd company logo
1 of 31
8051
Embedded C
8051 C Program to send hex values for ASCII characters
of 0,1,2,3,4,5,A,B,C,D to port P0.
● #include<reg51.h>
void main ()
{
unsigned char num [ ] ="012345ABCD";
unsigned char z;
for (z=0; z<=10; z++)
P0=num[z];
}
8051 C program for of square wave generation
● #include<reg51.h>
unsigned int i, j;
main ()
{
while (1)
{
P0=0xff;
for (i=0; i<10000; i++)
for (j=0; j<1000; j++);
P0=0x00;
for (i=0; i<10000; i++)
for (j=0; j<1000; j++);
}
}
8051 C program to generate step waveform
● #include<reg51.h>
unsigned int i, j;
void main ()
{
while (1)
{
P0=0x10;
for (i=0; i<10000; i++)
for (j=0;j<100;j++);
P0=0x20;
for (i=0; i<10000; i++)
for (j=0; j<200; j++);
P0=0x30;
for (i=0; i<10000; i++)
for (j=0; j<300; j++);
P0=0x40;
for (i=0; i<10000; i++)
for (j=0; j<400; j++);P0=0x30;
for (i=0; i<10000; i++)
for (j=0; j<300; j++);
P0=0x20;
for (i=0; i<10000; i++)
for (j=0; j<200; j++);
P0=0x10;
for (i=0; i<10000; i++)
for (j=0; j<100; j++);
}
}
8051 C program to generate 100ms time delay using timer
0, mode 0
● #include<reg51.h>
void delay ();
void main ()
{
while (1)
{
P0=0xff;
delay ();
P0=0x00;
delay ();
}
}
void delay ()
{
unsigned int i;
TMOD=0x00;
for (i=0; i<20; i++)
{
TL0=0X03;
TH0=0X0E;
TR0=1;
while (TF0==0);TF0=0;
}
TR0=0;
}
8051 C program in timer 0 and mode 1 to make led on and
off continuously connected to P0.1
● #include<reg51.h>
#include<stdio.h>
sbit led =P0^1;
void delay ()
void main ()
{
While (1)
{
led=1;
delay ();
}
else
{
led=0;
delay ();
}
}
{
void delay ()
{
TMOD=0x01;For (i=0; i<20; i++)
TL0=0xFC;
TH0=0x0E;
TR0=1;
while (TF0==0);
TF0=0;
}
TR0=0;
}
8051 C Program Design and implement down counter using 7
segment display when counter reaches to lowest counter value
then rotate dcmotor in anticlockwise direction
● #include<at89c51xd2.h>
#include<stdio.h>
void delay ();
void dc ();
void main ()
{
while (1)
{
P3=0x00;
P0=0x71;
delay ();
P0=0x79;
delay ();
P0=0x3f;
delay ();
P0=0x39;
delay ();
P0=0x7f;
delay ();
P0=0x77;
delay ();
P0=0x6f;
delay ();
P0=0x7f;
delay ();
P0=0x07;
delay ();
P0=0x7d;
delay ();
P0=0x6d;
● delay ();
P0=0x66;
delay ();
P0=0x4f;
delay ();
P0=0x5b;
delay ();
P0=0x06;
delay ();
P0=0x3f;
delay ();
dc ();
}
}
void delay ()
{
unsigned int i;
TMOD=0x00;
for (i=0; i<15; i++)
{
TL0=0xfc;
TH0=0x0e;
TR0=1;
while (TF0==0);
TF0=0;
}
TR0=0;
}
void dc ()
{
P1=0x01;
delay ();
P1=0xff;
delay ();
}
8051 C Program Design and implement stepper motor for 1
complete cycle either clockwise or anticlockwise when 1 cycle
completed turn on LED
● #include<at89c51xd2.h>
#include<stdio.h>
void delay ();
sbit led=P0^0;
void main ()
{
while (1)
{
P1=0x0c;
delay ();
P1=0x06;
delay ();
P1=0x03;
delay ();
P1=0x09;
delay ();
if (P1==0x09)
{
led=1;
}
else{
led=0;
}
}
}
void delay ()
{
unsigned int i;
TMOD=0x00;
for (i=0; i<15; i++)
{
TL0=0xfc;
TH0=0x0e;
TR0=1;
while (TF0==0);
TF0=0;
}
TR0=0;
}
8051 C program to design a 8bit up down counter
● #include <reg51.h>
● void main ()
● {
● unsigned int i, j, k, l;
● for (i=255; i>0; i--)
● {
● P0=i;
● for (j=0; j<50000; j++);
● }
● for (k=255; k>=0; k--)
● {
● P0=i;
● for (l=0; l<50000; l++);
● }
● }
8051 C program to send temperature of -4 to +4 to
port P1
● #include<reg51.h>
main ()
{
char num [ ]={-4,-3,-2,-1,0,1,2,3,4};
unsigned char i;
for (i=0; i<9; i++)
P1=num[i];
}
8051 C Program to generate triangular wave
● #include<reg51.h>
unsigned int i,j;
void main ()
{
while(1)
{
for(i=0;i<255;i++)
{
P0=i;
for (j=0;j<10000;j++);
}
for(i=255;i>0;i--);
}
}
8051 C Program to Design 7 segment display to
count from 0 to F
● #include<at89c51xd2.h>
void delay();
void main()
{
Char
num[ ]={0x03f,0x06,0x5b,0x4f,0x66,0x6d,0x07,0x7f,0x6f,0x77,0x7c,0x3a,0x5e,0x79,0x71,0x7
9};
unsigned char z;
for(z=0;z<=16;z++)
{
P0=0x00;
P1=num[z];
delay();
}
}
void delay()
{
unsigned int i;
TMOD-0x01;
for(i=0;i<14;i++)
{TH0=0;
TL0=0;
TF0=0;
TR0=1;
while(TF0==0);
TF0=0;
}
TR0=0;
}
8051 C program Design stepper motor to rotate
clock wise
● #include<at89c51xd2.h>
void delay();
void main()
{
while(1)
{
P2=0x08;
delay();
P2=0x04;
delay();
P2=0x02;
delay();
P2=0x01;
delay();
}
}
void delay()
{
unsigned int i;
TMOD=0x01;
for(i=0;i<14;i++){
TH0=0;
TL0=0;
TF0=0;
TR0=1;
while(TF0==0);
TF0=0;
}
TR0=0;
}
8051 C program to display "HELLO" on LCD
● #include<at89c51xd2.h>
void lcd_comm(void);
void delay (int);
void lcd_data(void);
void lcd_init(void);
unsigned char temp1;
unsigned char temp2;
unsigned char var,j;
sbit rs=P2^7;
sbit en=P2^6;
int main()
{
unsigned char data1[]={"HELLO"};
lcd_init();
while(1)
{
temp1=0x80;
lcd_comm();
delay(50000);
for(j=0;j<5;j++)
{
temp2=data1[j];
lcd_data();
delay(50000);
}
temp1=0x01;
lcd_comm();
delay(20000);
}
}
void lcd_init(void)
{
unsigned int cmd[]={0x20,0x28,0x0e,0x06,0x80,0x01};
unsigned int j;
for(j=0;j<7;j++)
{
temp1=cmd[j];
lcd_comm();
delay(500);
}
}
void lcd_comm(void)
{
var=temp1;
temp1=temp1 & 0xf0;
temp1=temp1 >>4;
P2=temp1;
rs=0;
en=1;
en=0;
temp1=var & 0x0f;
P2=temp1;
rs=0;
en=1;
en=0;
delay(60);
}
void lcd_data(void)
{
var=temp2;
temp2=temp2 & 0xf0;
temp2=temp2 >> 4;
P2=temp2;
rs=1;
en=1;
en=0;
temp2=var & 0x0f;
rs=1;
en=1;
en=0;
delay(6000);
}
void delay(int count)
{
Int i;
for (i=0;i<count++);
}
THANK YOU

More Related Content

What's hot

Day2 Verilog HDL Basic
Day2 Verilog HDL BasicDay2 Verilog HDL Basic
Day2 Verilog HDL BasicRon Liu
 
Digital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECEDigital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECERamesh Naik Bhukya
 
Embedded system design psoc lab report
Embedded system design psoc lab reportEmbedded system design psoc lab report
Embedded system design psoc lab reportRamesh Naik Bhukya
 
verilog code for logic gates
verilog code for logic gatesverilog code for logic gates
verilog code for logic gatesRakesh kumar jha
 
Verilog overview
Verilog overviewVerilog overview
Verilog overviewposdege
 
EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5PRADEEP
 
Digital Circuit Verification Hardware Descriptive Language Verilog
Digital Circuit Verification Hardware Descriptive Language VerilogDigital Circuit Verification Hardware Descriptive Language Verilog
Digital Circuit Verification Hardware Descriptive Language VerilogAbhiraj Bohra
 
Verilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with ExamplesVerilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with ExamplesE2MATRIX
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorialraju reddy
 
VHDL- gate level modelling
VHDL- gate level modellingVHDL- gate level modelling
VHDL- gate level modellingVandanaPagar1
 
Verilog Lecture2 thhts
Verilog Lecture2 thhtsVerilog Lecture2 thhts
Verilog Lecture2 thhtsBéo Tú
 
Modules and ports in Verilog HDL
Modules and ports in Verilog HDLModules and ports in Verilog HDL
Modules and ports in Verilog HDLanand hd
 
System Verilog Tutorial - VHDL
System Verilog Tutorial - VHDLSystem Verilog Tutorial - VHDL
System Verilog Tutorial - VHDLE2MATRIX
 
Vlsi lab manual exp:1
Vlsi lab manual exp:1Vlsi lab manual exp:1
Vlsi lab manual exp:1komala vani
 

What's hot (20)

ECAD lab manual
ECAD lab manualECAD lab manual
ECAD lab manual
 
Day2 Verilog HDL Basic
Day2 Verilog HDL BasicDay2 Verilog HDL Basic
Day2 Verilog HDL Basic
 
VLSI & E-CAD Lab Manual
VLSI & E-CAD Lab ManualVLSI & E-CAD Lab Manual
VLSI & E-CAD Lab Manual
 
Digital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECEDigital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECE
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
Embedded system design psoc lab report
Embedded system design psoc lab reportEmbedded system design psoc lab report
Embedded system design psoc lab report
 
verilog code for logic gates
verilog code for logic gatesverilog code for logic gates
verilog code for logic gates
 
Verilog overview
Verilog overviewVerilog overview
Verilog overview
 
EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5
 
Digital Circuit Verification Hardware Descriptive Language Verilog
Digital Circuit Verification Hardware Descriptive Language VerilogDigital Circuit Verification Hardware Descriptive Language Verilog
Digital Circuit Verification Hardware Descriptive Language Verilog
 
Verilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with ExamplesVerilog Tutorial - Verilog HDL Tutorial with Examples
Verilog Tutorial - Verilog HDL Tutorial with Examples
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
VHDL- gate level modelling
VHDL- gate level modellingVHDL- gate level modelling
VHDL- gate level modelling
 
Verilog Lecture2 thhts
Verilog Lecture2 thhtsVerilog Lecture2 thhts
Verilog Lecture2 thhts
 
Crash course in verilog
Crash course in verilogCrash course in verilog
Crash course in verilog
 
Modules and ports in Verilog HDL
Modules and ports in Verilog HDLModules and ports in Verilog HDL
Modules and ports in Verilog HDL
 
verilog
verilogverilog
verilog
 
Fpga 05-verilog-programming
Fpga 05-verilog-programmingFpga 05-verilog-programming
Fpga 05-verilog-programming
 
System Verilog Tutorial - VHDL
System Verilog Tutorial - VHDLSystem Verilog Tutorial - VHDL
System Verilog Tutorial - VHDL
 
Vlsi lab manual exp:1
Vlsi lab manual exp:1Vlsi lab manual exp:1
Vlsi lab manual exp:1
 

Similar to 8051 -5

Arithmetic and logic operations in c
Arithmetic and logic operations in cArithmetic and logic operations in c
Arithmetic and logic operations in cVikas Dongre
 
Vechicle accident prevention using eye bilnk sensor ppt
Vechicle accident prevention using eye bilnk sensor pptVechicle accident prevention using eye bilnk sensor ppt
Vechicle accident prevention using eye bilnk sensor pptsatish 486
 
8051 C Assignments with all examples covered
8051 C Assignments with all examples covered8051 C Assignments with all examples covered
8051 C Assignments with all examples coveredAbdulMunaf52
 
Pic programms FOR 8TH SEM STUDENTS BY LOHITH KUMAR | 11GUEE6018
Pic programms FOR 8TH SEM STUDENTS BY LOHITH KUMAR | 11GUEE6018Pic programms FOR 8TH SEM STUDENTS BY LOHITH KUMAR | 11GUEE6018
Pic programms FOR 8TH SEM STUDENTS BY LOHITH KUMAR | 11GUEE6018UVCE
 
Tai lieu ky thuat lap trinh
Tai lieu ky thuat lap trinhTai lieu ky thuat lap trinh
Tai lieu ky thuat lap trinhHồ Trường
 
Pythonによるカスタム可能な高位設計技術 (Design Solution Forum 2016@新横浜)
Pythonによるカスタム可能な高位設計技術 (Design Solution Forum 2016@新横浜)Pythonによるカスタム可能な高位設計技術 (Design Solution Forum 2016@新横浜)
Pythonによるカスタム可能な高位設計技術 (Design Solution Forum 2016@新横浜)Shinya Takamaeda-Y
 
Lab programs FOR 8TH SEM EC SUBJECT BY LOHITH KUMAR |11GUEE6018
Lab programs FOR 8TH SEM EC SUBJECT BY LOHITH KUMAR |11GUEE6018Lab programs FOR 8TH SEM EC SUBJECT BY LOHITH KUMAR |11GUEE6018
Lab programs FOR 8TH SEM EC SUBJECT BY LOHITH KUMAR |11GUEE6018UVCE
 
Two digit-countdown-timer
Two digit-countdown-timerTwo digit-countdown-timer
Two digit-countdown-timerHEATLBJ
 
Arithmetic and Logic instructions in Embedded C
Arithmetic and Logic instructions in Embedded CArithmetic and Logic instructions in Embedded C
Arithmetic and Logic instructions in Embedded CVikas Dongre
 
The IoT Academy IoT Training Arduino Part 3 programming
The IoT Academy IoT Training Arduino Part 3 programmingThe IoT Academy IoT Training Arduino Part 3 programming
The IoT Academy IoT Training Arduino Part 3 programmingThe IOT Academy
 
8051 programming skills using EMBEDDED C
8051 programming skills using EMBEDDED C8051 programming skills using EMBEDDED C
8051 programming skills using EMBEDDED CAman Sharma
 
codings related to avr micro controller
codings related to avr micro controllercodings related to avr micro controller
codings related to avr micro controllerSyed Ghufran Hassan
 
Program flowchart
Program flowchartProgram flowchart
Program flowchartSowri Rajan
 
ARM 7 LPC 2148 lecture
ARM 7 LPC 2148 lectureARM 7 LPC 2148 lecture
ARM 7 LPC 2148 lectureanishgoel
 
Network lap pgms 7th semester
Network lap pgms 7th semesterNetwork lap pgms 7th semester
Network lap pgms 7th semesterDOSONKA Group
 

Similar to 8051 -5 (20)

REPORT
REPORTREPORT
REPORT
 
Arithmetic and logic operations in c
Arithmetic and logic operations in cArithmetic and logic operations in c
Arithmetic and logic operations in c
 
Program interfacing lab
Program interfacing labProgram interfacing lab
Program interfacing lab
 
Vechicle accident prevention using eye bilnk sensor ppt
Vechicle accident prevention using eye bilnk sensor pptVechicle accident prevention using eye bilnk sensor ppt
Vechicle accident prevention using eye bilnk sensor ppt
 
8051 C Assignments with all examples covered
8051 C Assignments with all examples covered8051 C Assignments with all examples covered
8051 C Assignments with all examples covered
 
Pic programms FOR 8TH SEM STUDENTS BY LOHITH KUMAR | 11GUEE6018
Pic programms FOR 8TH SEM STUDENTS BY LOHITH KUMAR | 11GUEE6018Pic programms FOR 8TH SEM STUDENTS BY LOHITH KUMAR | 11GUEE6018
Pic programms FOR 8TH SEM STUDENTS BY LOHITH KUMAR | 11GUEE6018
 
Tai lieu ky thuat lap trinh
Tai lieu ky thuat lap trinhTai lieu ky thuat lap trinh
Tai lieu ky thuat lap trinh
 
Direct analog
Direct analogDirect analog
Direct analog
 
Pythonによるカスタム可能な高位設計技術 (Design Solution Forum 2016@新横浜)
Pythonによるカスタム可能な高位設計技術 (Design Solution Forum 2016@新横浜)Pythonによるカスタム可能な高位設計技術 (Design Solution Forum 2016@新横浜)
Pythonによるカスタム可能な高位設計技術 (Design Solution Forum 2016@新横浜)
 
Jp
Jp Jp
Jp
 
Lab programs FOR 8TH SEM EC SUBJECT BY LOHITH KUMAR |11GUEE6018
Lab programs FOR 8TH SEM EC SUBJECT BY LOHITH KUMAR |11GUEE6018Lab programs FOR 8TH SEM EC SUBJECT BY LOHITH KUMAR |11GUEE6018
Lab programs FOR 8TH SEM EC SUBJECT BY LOHITH KUMAR |11GUEE6018
 
Two digit-countdown-timer
Two digit-countdown-timerTwo digit-countdown-timer
Two digit-countdown-timer
 
Arithmetic and Logic instructions in Embedded C
Arithmetic and Logic instructions in Embedded CArithmetic and Logic instructions in Embedded C
Arithmetic and Logic instructions in Embedded C
 
The IoT Academy IoT Training Arduino Part 3 programming
The IoT Academy IoT Training Arduino Part 3 programmingThe IoT Academy IoT Training Arduino Part 3 programming
The IoT Academy IoT Training Arduino Part 3 programming
 
8051 programming skills using EMBEDDED C
8051 programming skills using EMBEDDED C8051 programming skills using EMBEDDED C
8051 programming skills using EMBEDDED C
 
codings related to avr micro controller
codings related to avr micro controllercodings related to avr micro controller
codings related to avr micro controller
 
Lập trình C
Lập trình CLập trình C
Lập trình C
 
Program flowchart
Program flowchartProgram flowchart
Program flowchart
 
ARM 7 LPC 2148 lecture
ARM 7 LPC 2148 lectureARM 7 LPC 2148 lecture
ARM 7 LPC 2148 lecture
 
Network lap pgms 7th semester
Network lap pgms 7th semesterNetwork lap pgms 7th semester
Network lap pgms 7th semester
 

Recently uploaded

What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 

Recently uploaded (20)

Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 

8051 -5

  • 2. 8051 C Program to send hex values for ASCII characters of 0,1,2,3,4,5,A,B,C,D to port P0. ● #include<reg51.h> void main () { unsigned char num [ ] ="012345ABCD"; unsigned char z; for (z=0; z<=10; z++) P0=num[z]; }
  • 3. 8051 C program for of square wave generation ● #include<reg51.h> unsigned int i, j; main () { while (1) { P0=0xff; for (i=0; i<10000; i++) for (j=0; j<1000; j++); P0=0x00; for (i=0; i<10000; i++) for (j=0; j<1000; j++); } }
  • 4. 8051 C program to generate step waveform ● #include<reg51.h> unsigned int i, j; void main () { while (1) { P0=0x10; for (i=0; i<10000; i++) for (j=0;j<100;j++); P0=0x20; for (i=0; i<10000; i++) for (j=0; j<200; j++); P0=0x30; for (i=0; i<10000; i++)
  • 5. for (j=0; j<300; j++); P0=0x40; for (i=0; i<10000; i++) for (j=0; j<400; j++);P0=0x30; for (i=0; i<10000; i++) for (j=0; j<300; j++); P0=0x20; for (i=0; i<10000; i++) for (j=0; j<200; j++); P0=0x10; for (i=0; i<10000; i++) for (j=0; j<100; j++); } }
  • 6. 8051 C program to generate 100ms time delay using timer 0, mode 0 ● #include<reg51.h> void delay (); void main () { while (1) { P0=0xff; delay (); P0=0x00; delay (); } } void delay () {
  • 7. unsigned int i; TMOD=0x00; for (i=0; i<20; i++) { TL0=0X03; TH0=0X0E; TR0=1; while (TF0==0);TF0=0; } TR0=0; }
  • 8. 8051 C program in timer 0 and mode 1 to make led on and off continuously connected to P0.1 ● #include<reg51.h> #include<stdio.h> sbit led =P0^1; void delay () void main () { While (1) { led=1; delay (); } else { led=0; delay (); }
  • 9. } { void delay () { TMOD=0x01;For (i=0; i<20; i++) TL0=0xFC; TH0=0x0E; TR0=1; while (TF0==0); TF0=0; } TR0=0; }
  • 10. 8051 C Program Design and implement down counter using 7 segment display when counter reaches to lowest counter value then rotate dcmotor in anticlockwise direction ● #include<at89c51xd2.h> #include<stdio.h> void delay (); void dc (); void main () { while (1) { P3=0x00; P0=0x71; delay (); P0=0x79; delay (); P0=0x3f;
  • 11. delay (); P0=0x39; delay (); P0=0x7f; delay (); P0=0x77; delay (); P0=0x6f; delay (); P0=0x7f; delay (); P0=0x07; delay (); P0=0x7d; delay (); P0=0x6d;
  • 12. ● delay (); P0=0x66; delay (); P0=0x4f; delay (); P0=0x5b; delay (); P0=0x06; delay (); P0=0x3f; delay (); dc (); } } void delay () {
  • 13. unsigned int i; TMOD=0x00; for (i=0; i<15; i++) { TL0=0xfc; TH0=0x0e; TR0=1; while (TF0==0); TF0=0; } TR0=0; } void dc () { P1=0x01; delay (); P1=0xff; delay (); }
  • 14. 8051 C Program Design and implement stepper motor for 1 complete cycle either clockwise or anticlockwise when 1 cycle completed turn on LED ● #include<at89c51xd2.h> #include<stdio.h> void delay (); sbit led=P0^0; void main () { while (1) { P1=0x0c; delay (); P1=0x06; delay (); P1=0x03; delay (); P1=0x09;
  • 16. unsigned int i; TMOD=0x00; for (i=0; i<15; i++) { TL0=0xfc; TH0=0x0e; TR0=1; while (TF0==0); TF0=0; } TR0=0; }
  • 17. 8051 C program to design a 8bit up down counter ● #include <reg51.h> ● void main () ● { ● unsigned int i, j, k, l; ● for (i=255; i>0; i--) ● { ● P0=i; ● for (j=0; j<50000; j++); ● } ● for (k=255; k>=0; k--) ● { ● P0=i; ● for (l=0; l<50000; l++); ● } ● }
  • 18. 8051 C program to send temperature of -4 to +4 to port P1 ● #include<reg51.h> main () { char num [ ]={-4,-3,-2,-1,0,1,2,3,4}; unsigned char i; for (i=0; i<9; i++) P1=num[i]; }
  • 19. 8051 C Program to generate triangular wave ● #include<reg51.h> unsigned int i,j; void main () { while(1) { for(i=0;i<255;i++) { P0=i; for (j=0;j<10000;j++); } for(i=255;i>0;i--); } }
  • 20. 8051 C Program to Design 7 segment display to count from 0 to F ● #include<at89c51xd2.h> void delay(); void main() { Char num[ ]={0x03f,0x06,0x5b,0x4f,0x66,0x6d,0x07,0x7f,0x6f,0x77,0x7c,0x3a,0x5e,0x79,0x71,0x7 9}; unsigned char z; for(z=0;z<=16;z++) { P0=0x00; P1=num[z]; delay(); }
  • 21. } void delay() { unsigned int i; TMOD-0x01; for(i=0;i<14;i++) {TH0=0; TL0=0; TF0=0; TR0=1; while(TF0==0); TF0=0; } TR0=0; }
  • 22. 8051 C program Design stepper motor to rotate clock wise ● #include<at89c51xd2.h> void delay(); void main() { while(1) { P2=0x08; delay(); P2=0x04; delay(); P2=0x02; delay(); P2=0x01; delay(); } }
  • 23. void delay() { unsigned int i; TMOD=0x01; for(i=0;i<14;i++){ TH0=0; TL0=0; TF0=0; TR0=1; while(TF0==0); TF0=0; } TR0=0; }
  • 24. 8051 C program to display "HELLO" on LCD ● #include<at89c51xd2.h> void lcd_comm(void); void delay (int); void lcd_data(void); void lcd_init(void); unsigned char temp1; unsigned char temp2; unsigned char var,j; sbit rs=P2^7; sbit en=P2^6; int main() {
  • 26. delay(50000); } temp1=0x01; lcd_comm(); delay(20000); } } void lcd_init(void) { unsigned int cmd[]={0x20,0x28,0x0e,0x06,0x80,0x01}; unsigned int j; for(j=0;j<7;j++) {
  • 29. var=temp2; temp2=temp2 & 0xf0; temp2=temp2 >> 4; P2=temp2; rs=1; en=1; en=0; temp2=var & 0x0f; rs=1; en=1; en=0; delay(6000);
  • 30. } void delay(int count) { Int i; for (i=0;i<count++); }