by Dale Wheat

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

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 ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required