O'Reilly logo

Arduino Internals by Dale Wheat

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Saving SRAM

Even more precious than the scarce program memory in the Arduino is the amount of available SRAM. Recall from Chapter 3 that the ATmega328 has a mere 2,048 bytes of SRAM. That's not megabytes or gigabytes. The ATmega2560 has 8,192 bytes of SRAM—more, but only when compared with the little one.

SRAM is mostly thought of as being used for temporary data storage, such as variables and the like. SRAM is also used for the system stack, the place where return addresses are stored during subroutine calls and interrupts. The stack is also used in interrupt handlers to preserve the contents of the registers needed by the handler itself, so that no registers are harmed in the handling of this interrupt.

Like any precious commodity, SRAM is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required