EmbeddedRelated.com
Forums

Using PWM as a DAC?

Started by xelon February 7, 2006
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

xelon wrote:

> I want to learn if I can use PWM as a DAC on AT89C51AC3. I'm going to
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

xelon wrote:

> 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
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