Chapter 8. Hardware Interrupts

This chapter introduces perhaps the most useful of the AVR’s hardware peripherals—the interrupt system. Up to now, our programs have been very much linear, going from one command to the next command to the next command. However, you often have to deal with input from the real world that arrives asynchronously, almost at random—you want the AVR to respond when you press the button, not when it’s ready to have you press the button.

In this chapter, we’ll take our first steps into interrupt programming. The first two examples will demonstrate how interrupts can run code for you any time an input pin changes state. And while it’s pretty cool to have the interrupt hardware directly ...

Get Make: AVR Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.