I am studying AVR from the book "the AVR microcontroller and Embedded system by Mohamed mazidi" and "atmega32A data sheet"

in the book, it puts samples of cade which start like this

.include "M32DEF.INC"

;...some macros...

;main program

.ORG 0
;some codes

if main program code starts at address 0x0000 where is the include file code starts at and even though shouldn't the address from 0x0000 to 0x003A are reserved for the interrupt vector table ?!


1 Answer 1


It relies on the fact that CPU starts executing at location 0, and since no interrups are used, there is no need for the vector table and code can be put there. In general that is not a suggested way of doing things, but with this specific AVR model and with this specific code it works. So it is a bad example for serious engineering work, but sometimes when teaching and introducing new things, for simplicity some things are skipped and introduced later how to do it properly.

The include file does not go anywhere, it has no code, it just defines symbolic names for you so that you can use for example register and bit names instead of numbers while writing code. Open the file and read it to see what it contains.

  • \$\begingroup\$ this looks very logic thank you \$\endgroup\$
    – mr.Arrow
    Mar 14, 2020 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.