16bit 3 pwm channel....

Go To Last Post
23 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using Atmega16 controller for my project which is having 2 16bit pwm channel OC1A and OC1B...but I need 3 16 bit pwm channel...is it possible to have it in atmega16?
Or can anyone suggest similar most controller to atmega16 having 3 pwm channel..

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sure why not use PWM on timer0 or timer 2? They output on pin4 and pin21 respectively.

If that's not enough do "soft PWM":

https://www.avrfreaks.net/index.p...

If you want more h/w PWM then if the four channels in the mega16 is not enough look at the 164PA - it has six

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

but for 16 bit pwm you have to take a step up. Mega128 will do the job, Maybe mega1284, rumours say they have two 16 bit timers, but it isn't easy to find them.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can easily stack two (or any number) of timers. This will give you a third 16-bit channel.

And if you need more, use for example ATMega162 which has 2x16 double channel + 2x8 single channel timers.

No RSTDISBL, no fun!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
If you want more h/w PWM then if the four channels in the mega16 is not enough look at the 164PA - it has six

No, it has not. ATMega164PA has exactly the same timers as ATMega16:

http://www.atmel.com/dyn/product...

But ATMega128 has two triple 16-bit timers (and two single 8-bit)

No RSTDISBL, no fun!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The number of timers is the same. The number of PWM channels is not the same.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, you are right, it has more advanced double 8-bit timers, but still there is the same number of 16-bit PWM channels in ATMega16 and ATMega164PA.

No RSTDISBL, no fun!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So, for getting 3 independent 16 bit pwm(no software) channels ..what is best option???
To go for atmega128...
or any dip package avr controller which has 3 pwm 16 bit channels?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are a couple of options. Start with the Parametric Product Table. In DIP there is (at least) mega162 and mega1284, byt the funny thing about the later is that it says two 16 bit timers everywhere, except in the data sheet, it only mentions one.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

No, it has not. ATMega164PA has exactly the same timers as ATMega16:

PWM channels - not timers. Try to pay attention. The mega 16 has 3 timers with 1+2+1 PWM channels while the 164PA has 3 timers with 2+2+2 PWM channels.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

snigelen,
thanks for the info...mega164 doesn't have adc so its out...but mega1284p has both..

In the datasheet it has written 2 16 bit timers...
Can you just reconfirm by seeing the datasheet if I am not mistaken...there are OC1A,OC1B,OC2A and OC2B...4 16 bit pwm channel if I am not wrong..
http://www.atmel.com/dyn/resourc...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

According to that it has two 16 bit timers, timer 1 and 3. So 16 bit PWM is on OC1A, OC1B, OC3A, OC3B. 0 and 2 is 8 bits.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First of all I have two pdf's for ATMega1284P. One is doc8272 rev.A and it includes ATMega164A,164PA,324A,324PA,644A,644PA,1284,1284P.
The document states all of them have one 16-bit double(OCR1A+OCR1B) timer).

Then there is the doc8059 rev.D summary
http://www.atmel.com/dyn/resourc...
which states:
"Two 16-bit Timer/Counter" (not Timer/Counters), and i think it is a simple error in a doc.

No RSTDISBL, no fun!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

so finally , atmega1284p can provide 3 (infact 4) independent 16 bit pwm channel....please correct if its wrong

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The number of timers on atmega1284p have been discussed here a couple of times, even today in another thread. The final conclussion seems to be that it has two 16 bit timers and it is an error in the datasheet that only mention one. So Yes. Four 16 bit PWM channels, but not completly independed since there's only two timers. At least two of the PWMs must share the same frequency (but not necessarily the same duty cycle).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

snigelen wrote:
So Yes. Four 16 bit PWM channels, but not completly independed since there's only two timers. At least two of the PWMs must share the same frequency (but not necessarily the same duty cycle).

It will work for me...as I share single frequency.... :wink:

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
so finally , atmega1284p can provide 3 (infact 4) independent 16 bit pwm channel....please correct if its wrong

No, it can provide exactly the same number of 16-bit PWM channels as ATMega16, to be precise. There is only one 16-bit double channel timer inside. At least this is what doc8272 rev.A states.

On the other hand Summary states something different, but I suppose Summary has an error, since it is only a brief information, and not a complete document.

Here I want to add that ATMega1284P (and other of xx4 family) has two 8-bit double PWM channels, but I suppose you are not interested in 8-bit 3 PWM channels, but 16bit 3 PWM channels, am I right?

No RSTDISBL, no fun!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You are wrong Brutte. Are you some kind of Troll? If danni say the mega1284P he have in his hand has two 16 bit timers, I choose to believe that. He even gave a link to the correct datasheet.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
The number of timers on atmega1284p have been discussed here a couple of times, even today in another thread.

Then there are two contradictory Atmel documents.

http://www.atmel.com/dyn/resourc...

No RSTDISBL, no fun!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear snigelen,

Cited document 8059S.pdf is from November 2009 while I gave you the link to doc8272.pdf which is from January 2010. Why do you think that is good and this one is wrong? Is there something in errata about that?

No RSTDISBL, no fun!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Timer3 emission from the latest data sheet is an oversight on our part.

Thank you, snigelen, these links explain everything.
I wonder why Atmel did not remove the buggy doc8272.pdf from their website.

No RSTDISBL, no fun!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I need more fights here guys come on?

Hahaha.... what was all this fight all about?
Does it really matter much whether it has 2x or 3x 16 bits timers? I am pretty sure that msd was probably not even going to need all of them at time.