Using PWM as a DAC?

Feb 08, 2006 3 Replies

Hi,



I want to learn if I can use PWM as a DAC on AT89C51AC3. I'm going to take voice from built-in ADC (has 8-bit resolution), and send it to speaker. But AT89C51AC3 doesn't have a built-in DAC.



I have found a project from Internet that uses PWM to create analog voice. But the project is designed with ATmega8535.



Thanks



I don't know this part - but what is the max speed of the PWM, and how many bits is it?

I am using ATmega128 to generate PWM audio.

Thanks for your reply

PWM is 8-bit. But I don't know the max speed of it. In datasheet it says : "All the PCA modules can be used as PWM outputs. The output frequency depends on the source for the PCA timer."

Thanks

This basically possible but it is not particularly easy. In principle you just place a low pass filter on the PWM output. That's the easy bit. You then need to alter the PWM to vary the analog out. The problem is one of synchronization. You basically need to do an AtoD, process the D then set the PWM for the resultant DtoA function. How you achieve this is highly processor dependent.

Ian

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required