Using PWM as a DAC?

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

Reply to
xelon
Loading thread data ...

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.

Reply to
larwe

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

Reply to
xelon

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

Reply to
Ian Bell

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.