Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

16bit PWM AVR

Status
Not open for further replies.
Hi, I'd like to know how precise voltage can the pwm module present , i want the change to be in millivolt , i mean the change in the duty cycle , i wanna use it as 16 bit DAC can this happens ??
 
Hi, I'd like to know how precise voltage can the pwm module present , i want the change to be in millivolt , i mean the change in the duty cycle , i wanna use it as 16 bit DAC can this happens ??
Using a processor you can create a PWM signal with any resolution (up to where your processor is not fast enough).
We often think of PWM duty cycles as percents but it is possible to use 1000 or even 10,000 steps between full off and full on.

3v0
 
Last edited:
Yes, if it's all designed correctly - to convert a PWM to a DAC you need a low-pass filter - this has to carefully designed to remove all PWM products, but leave the modulating frequency you want.
 
Yea , but i mean if i wrote OCR1A=6000 , would i sense this change in millivolts ?

PWM can always be done in software to get the needed resolution.

Nigel know more about the filter needed to smooth the PWM out into an analog voltage.

Maybe there is an easier way to do what you are attempting. What is the application? Why not use a DAC?
 
PWM can always be done in software to get the needed resolution.

Nigel know more about the filter needed to smooth the PWM out into an analog voltage.

There are a couple of application notes about it on the MicroChip website, they would apply to an AVR just as well.

Maybe there is an easier way to do what you are attempting. What is the application? Why not use a DAC?

16 bit DAC's are expensive, 16 bit PWM is far cheaper.

This always depends if 16 bits is required, it usually isn't.
 
I need really 16 bit resolution , i use timer 1 on atmega32 which is 16 bit timer , so i think it can do 16 bit PWM , what i figured out that at every 80 counts it can produce 1mV difference , for e.g OCR1A= 6000 outputs 4.55V , 6080 , produces 4.56 V , its not that enough , i need at least for one count , it produces 1mV , is this possible ?
 
A 16 bit timer has 65536 discrete states. If you're using a 0-5V supply a single tick should only change the voltage by about 76u. By my math 80 counts will produce a 6mV change. 13 ticks should produce a 1mv change, which means you should have more than enough precision. Also resolution isn't going to mean anything if the noise is too high, what are you trying to control with this output signal? As you won't be able to load a PWM output very much and keep a stable output voltage. Describe what you're atempting to control with this output. Also what is your PWM frequency, and what are you using for a lowpass?
 
Well , its a very stupid problem , the plc team needs to have a -10V to 10V analog signal that repersents a scale , we have our own digital scale , the plc doesnt have serial portocal , then i outputed the scale as a 16bits output then i want to DAC it , the manager want a 1/2kg sensitivity , the full scale is 65ton , im really stucked into this problem and i used a DAC called AD669 from analog devices and it doesnt work , when i put the 16bits on the DAC's Parallel inputs , the voltage drops :( , maybe it needs a buffer , but i dunno .
 
An Atmega can output 16bit PWM just fine, it sure can't produce a -10 to +10 signal though. You'll have to buffer and stretch it from 0-5 to -10/+10 you should still be able to get 1mv out of that though. Even amping 0-5 to 0-20 and biasing it -10 on a pair of opamps you should still get 1mv of resolution per 3 'ticks' of the PWM.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top