ATmega128A-AU - PWM questions - No. of channels, PWM

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

Hello,

 

Im trying to figure out, how many independed PWM signals (hardware fast PWM) can ATmega128A-AU generate in total, as each output pin will have its own duty cycle.

 

Im greatly confused how many it is. Ive been looking for information in many places, from product descriptions to finally and most importantly the Atmel Datashet but even there i find information that is contradicting itself.

 

This is what i found so far:

 

At the beginning.

Atmel AVR product finder says ATmega128A has 8 PWM channels

 

1st.

Page 2 of datasheet says Two 8 bit PWM channels, 6 PWM Channels with Programmable Resolution -> 8 PWM channels total?

 

2nd.

Page 12 of datasheet with block diagram. I can see there TC0, TC1, TC2, TC3 with outputs OC0, OC1A, OC1B, OC1C, OC2, OC3A, OC3B -> so 7 pins going out of timers means 7 PWM channels total?

 

3rd

Page 14 of datasheet with pinouts. I can locate OC0 (PB4), OC1A (PB5), OC1B (PB6), OC1C/OC2 (PB7), OC3A (PE3), OC3B (PE4), OC3C (PE5) pins -> 8 different OCx0 or OCx names but OC2 and OC1C is sharing same pin so: 7 physical pin outputs means 7 PWM channels?

 

4rd

Page 139 of datasheet contains description of Timer Counter 1 and Timer Counter 3. In block diagram there are registers OCRnA, OCRnB and OCRnC. Since the datasheet section says its Timer/Counter1 AND Timer/Counter3 so i assume there are 6 registers OCR1A, OCR1B, OCR1C and OCR3A, OCR3B, OCR3C

 

Page 194 of datasheet contains description of Timer Counter 0 with OCRn register so since its Timer/Counter0 then it means 1 single OCR0 register

 

Page 217 of datasheet contains description of Timer Counter 2 with OCRn register so since its Timer/Counter2 then it means 1 single OCR2 register

 

TOTAL OCRnX registers: OCR1A, OCR1B, OCR1C, OCR3A, OCR3B, OCR3C, OCR0, OCR2 -> 8 PWM channels?

 

This is all of it.

 

Im generally confused whether it has 7 independed PWM channels or 8, because im 100% positive it does not have less than 6 of them.

 

 

Also one more questions

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

Timer0 and 2 are 8 bit, timer 1 and 3 are 16 bit. DS pg 93 and 148 shows one out for ea 8 bit timer. The 16 bit timer have 3 channels A,B and C running from the same timer. SO..... I think I could get 8 8bit fast pwm channels... timer0, timer2, timer1 ch A,B,C, timer 3 ch A,B,C, all the same speed, individual duty.

 

Imagecraft compiler user

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

KonradIC13 wrote:

...

2nd.

Page 12 of datasheet with block diagram. I can see there TC0, TC1, TC2, TC3 with outputs OC0, OC1A, OC1B, OC1C, OC2, OC3A, OC3B -> so 7 pins going out of timers means 7 PWM channels total?

 

3rd

Page 14 of datasheet with pinouts. I can locate OC0 (PB4), OC1A (PB5), OC1B (PB6), OC1C/OC2 (PB7), OC3A (PE3), OC3B (PE4), OC3C (PE5) pins -> 8 different OCx0 or OCx names but OC2 and OC1C is sharing same pin so: 7 physical pin outputs means 7 PWM channels?

...

Rev. J of Mega128A datasheet?

 

The block diagram issue seems like a datasheet omission.

 

You can gain one more 8-bit channel with a Mega1281, I think.

 

Or, if this feature is of most importance, use a Mega640 and get 12 16-bit channels, and a few 8-bit.

 

 

I guess you need to tell me what version of the datasheet you are referring to when you quote page numbers.  My rev. X doesnt have pinouts on page 14, nor block diagram on page 12.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Yeah, im using revision J

 

Atmel-8151J-8-bit AVR Microcontroller_Datasheet_Complete-09/2015
 

ATmega128A Complete
(file size: 5.6MB, 475 pages, revision J, updated: 09/2015)

 

http://www.atmel.com/devices/ATMEGA128A.aspx

 

http://www.atmel.com/Images/Atmel-8151-8-bit-AVR-ATmega128A_Datasheet.pdf