Understanding the Inner Workings of Arduino: Registers

Arduino is an amazing teaching tool that has been used in classrooms all over the world to engage students with material, introduce them to programming and entice them to start tinkering with electronics. If you've been curious about what's actually going on underneath the easy-to-use Arduino language, we have a video to help you understand how "registers" (tiny bins of storage in the processor) work:

 

Understanding how to manipulate registers is a necessary step if you (or your students) are looking to do more advanced things in Arduino. For example, you may want to:

  • Set up timer interrupts to send data over infrared (IR)
  • Quickly flash an LED on or off — even more quickly than what digitalWrite() can do! — which can be great for refreshing a 7-segment LED
  • Make complex code smaller so that it will fit in the Arduino's (already limited) program memory

 

The Arduino framework does an amazing job of hiding all these gory details for us, but sometimes it can be helpful to dig into the underlying layers to see what's going on underneath the hood.

This hiding of technical details is known as "abstraction," and is often used in engineering and software development. Abstraction works by understanding how a user interacts while suppressing the complex details often required by that interaction. In effect, this leaves a well-designed interface for the user that is, hopefully, much easier to use.

Creating a layer of abstraction often has the downside of taking up more program space and requiring more processing cycles in the computer, making performance slower. However, it can result in a system that is much easier to use and to develop for, as in the case of Arduino. So, if you want something to run as fast as possible in the smallest amount of space (and don't mind learning a more complex system), remove layers of abstraction. If you value ease of use (and don't mind the performance hit), abstraction is a wonderful thing.

Even if you don't want to dig way down into the weeds with Arduino to work with registers manually, it can certainly be helpful to understand what's going on in the background and why Arduino is such a popular tool among educators and hobbyists. It's all about the abstraction! 

Subscribe to SparkFun Education Blog

Recent Posts

Submit Your Idea