Using the Controller Chip Hardware

18.0 Introduction

The Arduino platform simplifies programming by providing easy-to-use function calls to hide complex, low-level hardware functions. But some applications need to bypass the friendly access functions to get directly at hardware, either because that’s the only way to get the needed functionality or because higher performance is required. This chapter shows how to access and use hardware functions that are not fully exposed through the Arduino programming environment.

Note

Changing register values can change the behavior of some Arduino functions (e.g., millis). The low-level capabilities described in this chapter require care, attention, and testing if you want your code to function correctly.

There are four key hardware features that you need to understand before getting deeper into the hardware. Registers are memory locations in the microcontroller that can be used to alter its behavior. When you work with the other hardware features, you will often be manipulating registers to configure them. Interrupts are signals generated by the microcontroller, generally in response to an external event, allowing Arduino sketches to respond immediately when something happens. Timers can generate a signal after a predetermined delay, or repeatedly generate a signal based on a duration you specify. As with interrupts, you can take an action in your sketch in response to a timer. You’ve already seen how to work with analog and digital pins ...

Get Arduino Cookbook, 3rd Edition 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.