Simulate a sinusoidal wave with PWM (doubts)

Hello I'm trying to make a control over a PWM for simulate a sinusoidal wave.
I only want to ask about for the methods to do it, and if the mine is correct.

I propose dividing the wave in 20 parts of time and for each part update the PWM value with a frecuency that match with a medium votage equals to the medium voltage of each part of the sinusoidal wave

greetings.

http://interface.khm.de/index.php/lab/experiments/arduino-dds-sinewave-generator/

Thank you AWOL, Well, really my program needs to do more things at teh same time, like read a digital input port and send it to the usb, for that i was asking about if the interrupt method will work. Well i will take a deep look to your example. Thank you again.

reading analog pins, updating digital pins and generating four different waveforms all at the same time - also references the link posted by awol -

Duane B

rcarduino.blogspot.com