Triangular wave
#include<reg52.h>
void main(void)
{
unsigned int i;
while(1)
{
for(i=0;i<0xFF;i++)
P1=i;
for(i=0xFF;i>0;i--)
P1=i;
}
}
Square wave
#include<reg52.h>
void delay(void);
void main(void)
{
while(1)
{
delay();
P1=0xFF;
delay();
P1=0x00;
}
}
void delay(void)
{
unsigned int i,j,k,l;
for(k=0;k<50;k++);
for(j=0;j<1257;j++);
for(l=0;l<50;l++);
for(i=0;i<1257;i++);
}
saw tooth
#include<reg52.h>
void main(void)
{
unsigned int i;
while(1)
{
for (i=0;i<0xFF;i++)
P1=i;
}
}
Thursday, July 25, 2013
8051 Code for triangular wave,sqaure wave,saw tooth
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment