another strange error in Mega128's datasheet

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

I use Timer1 in Fast PWM mode 15, and COM1C1:0 = 2 and I found that the actually output waveform was the opposite, so Figure 52 is fucking wrong then!!!!

How could ATMEL got such a big mistake on their datasheet????

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

The datasheet looks ok to me. Here is a small test for mode 15 which does produce the expected 1/3 duty cycle on OC1C. As I understand your problem report it would output a 2/3 duty cycle. Can you show the code that is not working as expected?

#include 

int main(void)
{
    DDRB = (1<<7); // OC1C output

    // Mode 15
    TCCR1A = (1<<WGM11)|(1<<WGM10);
    TCCR1B = (1<<WGM13)|(1<<WGM12);

    // Set TOP for ~100Hz
    OCR1A = (F_CPU/256/100); 
    
    // OC1C clear on compare, set at TOP
    TCCR1A |= (1<<COM1C1);  
    // OC1C 1/3 duty cycle 
    OCR1C = OCR1A/3;         

    TCCR1B |= (1<<CS12);     // Start with /256 prescaler

    while(1)
        ;
}

/Lars

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

Quote:

use Timer1 in Fast PWM mode 15, and COM1C1:0 = 2 and I found [...]

Running on the actual chip or in the AVR Studio simulator? The latter has serious bugs for a lot of timer modes.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

hehe, sorry, guys, it's my old analyzer's software problem, so it's correct

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

An apology to Atmel would be more in order I feel!
And please a more temperate use of words

Quote:
so Figure 52 is fucking wrong then!!!!

Keep it simple it will not bite as hard