1st Edition
Some Assembly Required Assembly Language Programming with the AVR Microcontroller
A family of internationally popular microcontrollers, the Atmel AVR microcontroller series is a low-cost hardware development platform suitable for an educational environment. Until now, no text focused on the assembly language programming of these microcontrollers. Through detailed coverage of assembly language programming principles and techniques, Some Assembly Required: Assembly Language Programming with the AVR Microcontroller teaches the basic system capabilities of 8-bit AVR microcontrollers.
The text illustrates fundamental computer architecture and programming structures using AVR assembly language. It employs the core AVR 8-bit RISC microcontroller architecture and a limited collection of external devices, such as push buttons, LEDs, and serial communications, to describe control structures, memory use and allocation, stacks, and I/O. Each chapter contains numerous examples and exercises, including programming problems.
By studying assembly languages, computer scientists gain an understanding of the functionality of basic processors and how their capabilities support high level languages and applications. Exploring this connection between hardware and software, this book provides a foundation for understanding compilers, linkers, loaders, and operating systems in addition to the processors themselves.
Introduction
Computer Systems
Basic Processor Architecture
Components of a Computer System
Classification of Processors
Numeration Systems
Boolean Data
Exercises
The Atmel AVR Microcontroller Family
The AVR Core
Machine Language for the AVR Microcontroller
AVR Studio
AVR Development Platforms
Introduction to AVR Assembly Language
Sample AVR Assembly Language Program
Exercises
Programming Exercises
Alternate Programs for the XPLAIN Demonstration Kit
Assembly Language
Directives
Expressions
Data Definition Directives
Instructions
The Toggler Program: Sample I/O
Exercises
Programming Exercises
Alternate Programs for the XPLAIN Demonstration Kit
Integer Data Representation
Unsigned Integer Data
Character Data
Signed Integer Data
Binary Coded Decimal
Data Values in Programs
Assignment Statements
Branch Instructions
Exercises
Programming Exercises
AVR Core: Startup, Reset, and Memories
AVR Reset Signal
Basic System Organization
Program Memory
Data Space
EEPROM
Exercises
Programming Exercises
Alternate Programs for the XPLAIN Demonstration Kit
The Stack and Function Calls
Stack
Functions
Arguments, Parameters, and Return Values
Local Storage
Auxiliary Data Stack (Software Stack)
Call By Reference Example
Exercises
Programming Exercises
Serial Communications Using the Universal Synchronous and Asynchronous Serial Receiver and Transmitter
RS-232
Serial Communication Basics
AVR USART Configuration
AVR USART Transmit and Receive
Serial Transmission Errors
Polled I/O
Seri al Communications Example
Exercises
Programming Exercises
Alternate Programs for the XPLAIN Demonstration Kit
Logical Operations
Bitwise Logical Operations
Uses of Logical Instructions
Shift and Rotate
Special Bitwise Operations
AV R Timer/Counter
Timer/Counter Example: LED Blinker
Exercises
Programming Exercises
Alternate Programs for the XPLAIN Demonstration Kit
Control Structures
Altering the Flow of Control
Jump and Conditional Branch Instructions
Selection
Looping
Pseudocode Development: A Checksum Program
Exercises
Programming Exercises
Alternate Programs for the XPLAIN Demonstration Kit
Interrupts
Interrupt Processing
General External Interrupts
Interrupt -Controlled Up/Down Counter
Timer Counter Interrupts
Interrupt-Based Switch Bounce Elimination
USART Interrupts
Exercises
Programming Exercises
Alternate Programs for the XPLAIN Demonstration Kit
Arithmetic Operations
Addition and Subtraction
AVR Addition and Subtraction
BCD Addition and Subtraction
Binary/BCD Conversion
Multiplication and Division
Numeric I/O and Type Conversions
Sieve of Eratosthenes
Exercises
Programming Exercises
Alternate Programs for the XPLAIN Demonstration Kit
Arrays
Declaring and Using Arrays
Multidimensional Arrays
Strings
Storage Allocation
Dynamic Memory Allocation
Structures
A Better Heap
Exercises
Programming Exercises
Real Numbers
IEEE Floating Point Representation
Addition and Subtraction of IEEE Floating Point Numbers
Multiplication and Division of Floating Point Numbers
Fixed Point Arithmetic
Summary
Exercises
Programming Exercises
Programming the AVR in C
Object Files and Linkers
Anatomy of a C Program
Fundamentals of C Programming
Assembly Language and C
Exercises
Programming Exercises
Appendix: Getting Started with the XPLAIN Evaluation Kit
Index
Biography
Timothy S. Margush, Ph.D., was an associate professor of computer science at the University of Akron. For over 30 years, he taught courses in mathematics and computer science, including many on assembly language programming using a variety of hardware platforms.