#include reg51.h>
sbit Port3_Pin1 = P3^1;
void main(void) {
//Sine Look-up table
unsigned char code i[ ]={124, 145, 166, 186, 203, 218, 231, 240, 246, 248,246, 240,
231, 218, 203, 186, 166, 145, 124, 102, 81, 62, 44, 29, 16, 7, 1, 0,
1, 7, 16, 29, 44, 62, 81, 102};
unsigned char n;
//Port configuration
P2= 0;
//Sine wave generation on Port-2
while(1) {
for (n=0;n < 36;n++) {
P2 = i[n];
//Sample rate control
TH0 = 0xF0;
TL0 = 0x28;
TF0 = 0;
TR0 = 1;
while (TF0 == 0);
TR0 = 0;
}
}
}