WGM register in TCCR2A

Hi friends,
I'm starting to work with timers and arduino registers recently and i have a question with a the TCCR2A register. In this datasheet, page 130, there's a table explaining the modes. What i dont' understand is why it's write WGM2, WGM1 and WGM0 instead of WGM21 and WGM20, so i can't undersand the table.
My TCCR2A is B10000011, what mode it would be?

If someone could explain what's the function of WGM too, I would be thankful, because i have an idea but not clear at all.

Thank you

This excellent tutorial should help: Gammon Forum : Electronics : Microprocessors : Timers and counters

why it's write WGM2, WGM1 and WGM0

There are three WGM bit fields for each timer.

My TCCR2A is B10000011, what mode it would be?

Can't say. You need to state the value of WGM2 in TCCR2B.

Thank you!

On the ATmega328P, the two 8-bit timers (Timer0 and Timer2) have the same Waveform Generation Modes so the bits are abbreviated as WGM2, WGM1, WGM0 instead of WGM02/WGM22, WGM01/WGM21, WGM00/WGM20.

Note: Timer1 (the 16-bit timer) has a WGM13 bit for twice as many modes.

Note: WGM1 and WGM0 are in the TCCRxA register and the higher WGM bits are in TCCRxB. It is easy to forget that and think that all 3 or 4 bits are next to each other.

or
TCCRnA?

or
TCCRnx?

===> TCCR1C (n = 0, 1, 2; x = A, B, C)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.