3-ph sinewave generation using pwm in 89c51rd2

Hi all,
Well i want to generate sinewave using pwm module in 89c51rd2.Could anyone help please.I know how to generate pwm but i am not able to generate a sine wave. I used fosc/4 for clk. and used to reload the new counter value and but i am not able to get required stepped sinewave on CRO. Plz help its urgent.

First write a routine that genetaes PWM. calculate sin(t) and pass it to the PWM routine. add some delay and pass the next sin(t) value. At the o/p pin connect a resistor and a capacitor in parallel with their other ends grounded, this would smoothen the waveform. Choose a small value for the capacitor.

Alternatively, write a function which would generate a integer value between 0 and 255 corresponding to sine values -1 and 1. you may do this by adding an offset value of 1 to the result of sin(t) and then multiplying it by 127.
write this value on the port.
On the port make a R-2R Ladder network.

Hi,
Alternatively what you can do is make a table of 64 values of PWM. You will be consuming 64 bits in it, and then use this table to make the sinusoidal PWMs. ACtually the 8051 is not godd at processing math routines, so better make a look up table. This way you will reduce the computation time and thus reduce the error in PWM.

You can also apply the same approach if you are connecting an digital to analog converter. Please elaborate more on the application may be we can help you in a better way.

Thanks Ihx and mittal
I will try out the things that u have said. Uptill now i had written the routine to generate pwm, than at every pca register CL overflow i used to reload a new value to CCAP0H regs.corresponding to new duty cycle. Thus for a 50hz waveform i was able to get a 59samples for a quater of a cycle as clk increments were fosc/4 and the crystal is of 12Mhz.

I have to run a 1hp induction for my project using pwm.I have already completed the driver circuit, but the pwm generation is not proper and i would like to know how would be waveform on the CRO.