Skip to main content

Microcontrollers

Chapter 15 AVR Assembly

Assembly can be used to program the ATmega328P; it requires a detailed understanding of the AVR instruction set. (Refer to [16.15].) In order to access all of the information stored in general purpose registers, data memory, and program memory, an understanding of memory addressing (discussed in SectionΒ 13.4) is fundamental.
When writing out values in assembly, prefixes can be used to denote the number system of a value. If no prefix is used, the value is assumed to be in decimal (base 10). If the prefix 0b is used, the value is assumed to be in binary (base 2). If the prefix 0x is used, the value is assumed to be in hexadecimal (base 16).
Assembly code can contain comments. These are portions of the code that will be ignored by the compiler. A comment is indicated by a semicolon: ;.