Author Topic: PWM (10 bit) vs DAC (5 bit)  (Read 1529 times)

0 Members and 1 Guest are viewing this topic.

Offline MoriambarTopic starter

  • Supporter
  • ****
  • Posts: 502
  • Country: it
PWM (10 bit) vs DAC (5 bit)
« on: August 25, 2018, 08:43:11 am »
Hi,
I am a newbie here and in the EE world (kinda). Looking at our beloved Dave videos, I came about to appreciate PWM as a DAC alternative. Anyway picking up a PIC16F15325, I found out that it has a 5bit DAC function, as well as several 10 bit PWMs.

So my thought is: if I can be able to be way more precise with a simulated DAC via pwm, why include a DAC functionality from the start? So I thought that perhaps I misunderstand something and 10bit PWM is not better than 5bit DAC.

Well I tried searching the info online but I'm lost  :-//. Can anyone point me in the right direction, please?
 

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 15149
  • Country: de
Re: PWM (10 bit) vs DAC (5 bit)
« Reply #1 on: August 25, 2018, 08:53:40 am »
Using PWM as a DAC is usually slow and often needs an extra filter (e.g. 3rd order active filter with 1 OP). The real DAC inside the µC is likely much faster and lower power. There are still quite some application that can get away with using PWM and thus a DAC is not such a common part in µCs.
 
The following users thanked this post: Moriambar

Offline MoriambarTopic starter

  • Supporter
  • ****
  • Posts: 502
  • Country: it
Re: PWM (10 bit) vs DAC (5 bit)
« Reply #2 on: August 25, 2018, 08:58:15 am »
Thanks! So basically either you go for "built-in, quick, low power, but with less steps" or you can go for "slow, precise, not so low powe, but needing extra filtering steps", right?

Cheers
« Last Edit: August 25, 2018, 09:01:42 am by Moriambar »
 

Online mikerj

  • Super Contributor
  • ***
  • Posts: 3382
  • Country: gb
Re: PWM (10 bit) vs DAC (5 bit)
« Reply #3 on: August 25, 2018, 12:14:21 pm »
Thanks! So basically either you go for "built-in, quick, low power, but with less steps" or you can go for "slow, precise, not so low powe, but needing extra filtering steps", right?

Cheers

In this case yes.  Other micros have higher resolution DACs built in, 12 bits is now reasonably common.
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4705
  • Country: au
  • Question Everything... Except This Statement
Re: PWM (10 bit) vs DAC (5 bit)
« Reply #4 on: August 25, 2018, 12:21:27 pm »
Another thing with the DAC is that you can change the reference voltage or use an external one at an arbitary voltage, So in the end you end up with more than 5 bits worth of steps with some clever programming
 
The following users thanked this post: Moriambar

Offline MasterT

  • Frequent Contributor
  • **
  • !
  • Posts: 851
  • Country: ca
Re: PWM (10 bit) vs DAC (5 bit)
« Reply #5 on: August 25, 2018, 12:28:11 pm »
Keep in mind that to clock out 10-bits over PWM takes 1024 periods, even with 16 MHz PWM, max update rate less that 16 kHz.
 
The following users thanked this post: tooki, Moriambar

Offline MoriambarTopic starter

  • Supporter
  • ****
  • Posts: 502
  • Country: it
Re: PWM (10 bit) vs DAC (5 bit)
« Reply #6 on: August 25, 2018, 06:42:30 pm »
Quote from: Rerouter
Another thing with the DAC is that you can change the reference voltage or use an external one at an arbitary voltage, So in the end you end up with more than 5 bits worth of steps with some clever programming
I did not think about that, you're right! Thanks!

Keep in mind that to clock out 10-bits over PWM takes 1024 periods, even with 16 MHz PWM, max update rate less that 16 kHz.

Right, of course!
 

Offline fonograph

  • Frequent Contributor
  • **
  • Posts: 369
  • Country: at
Re: PWM (10 bit) vs DAC (5 bit)
« Reply #7 on: August 26, 2018, 03:55:55 am »
Keep in mind that to clock out 10-bits over PWM takes 1024 periods, even with 16 MHz PWM, max update rate less that 16 kHz.

Thats true only if no noise shaping is used.Snake oil music format DSD uses 1 bit PDM 64 periods to get 20 bit resolution with 7th order noise shaping and dither.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf