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

Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
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...ranjana rawat
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
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 Conduitsrknatarajan
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
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
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 

Recently uploaded (20)

Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
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...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
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
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
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
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
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, ...
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 

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++); }