Generation of 50 Hz Sine Waveform

There is a website which gives and generates Sine wave look-up table as per requirement.

link to website: Sine Look-up table Generator

Generation of 50 Hz sinusoidal waveform

C program:

#include <reg51.h>

int mynum[]={128,143,159,174,188,201,213,224,234,242,248,252,254,255,253,250,245,238,229,219,207,195,181,166,151,135,120,104,89,74,60,48,36,26,17,10,5,2,0,1,3,7,13,21,31,42,54,67,81,96,112};

void delay(unsigned char xTime);

void main()
{
 while (1)
 {
 int z;
 for (z=0;z<=50;z++)
 {
 P1=mynum[z];
 delay(20);
 }
 }
}

void delay(unsigned char xTime)
{
 int i;
 for(i=0;i<xTime;i++)
 {
 }
}
Advertisements
%d bloggers like this: