Search code examples
avratmegaavr-gcc

Mismatching MCUCR definitions between handbook and AVR-GCC library


The ATmega8A manual defines the bits contained in MCUCR register at page 56.

These definitions don't match the #defines contained in the ATmega8A I/O library supplied by avr-gcc, located at /usr/lib/avr/include/avr/iom8a.h.

For example, the SE bit (Sleep Enable) is defined in the manual as bit 5, while in the above library it is #define SE 7.

I haven't checked if the AVR actually misinterprets these MCUCR flags. Am I missing something here?


Solution

  • The data sheet seems to be wrong.

    Section "14.8.1. MCUCR – MCU Control Register" on page 56 states enter image description here

    while section "17.1.1. MCUCR – MCU Control Register" on page 74 states

    enter image description here

    which is not possible, since bit 2 and 3 would be ambiguous.

    The register summary is correct:

    enter image description here

    That means the library definitions are correct.