Professional Documents
Culture Documents
IES Practical 3
IES Practical 3
Practical #3
Mohammad
Name Hasan Javed Division C
Shaikh
Class S.Y.B.Sc.IT Roll Number 21302C0035
Practical 3 Waveform Generation
Date: 16-12-22
Write a code to generate a square wave on port of microcontroller.
CODE:
#include<reg52.h>
void delay (unsigned int y)
{
unsigned int i;
for(i=0;i<y;i++)
{}
}
void main()
{
while(1)
{
P1=0x00;
delay (1000);
P1=0xFF;
delay (1000);
}
}
CODE:
#include<reg51.h>
void main()
{
int j;
while(1)
{
for(j=0;j<256;j++)
{
P0=j;
}
for(j=255;j>0;j=j-2)
{
P0=j;
}
}
}
CODE:
#include<reg51.h>
int main()
{
int j;
int
c[37]={128,150,172,192,210,226,239,248,254,255,254,248,239,226,210,192,172,150,128,106,84,6
4,46,30,17,8,2,0,2,8,17,30,46,64,84,106,128};