Read AN 655, It will explain it to you. Best is to use a R-2R ladder with
4 to 8 pins, depending on your aplication. Basically what you do is to
create a lookup table with your sine steps (0 to 255 or 0 to 16) in it.
Then your programs puts these values in sequence on your output pins. I
recently wrote a small test program that does a 4 bit sine for tone
generation and it worked great. Pity I lost it in a hard drive crash
otherwise I would have posted it to you.
Quentin
Darren Logan wrote:
{Quote hidden}> Hi Pic'ers,
>
> Anyone know how to generate a sinewave using PWM on say a PIC 12Cxx ?
>
> I want to generate 100Hz (plus or minus 0.1Hz).
>
> Any code will do, i.e. BASIC, C or assembly.
>
> Thanks in advance.
>
> Darren