91% program memory with almost empty code

Hello everyone:

¿why a simple almost empty sketch needs 91% of program memory of an atmega8 when I compile (Ctrl + R) ?

This is the sketch:


#include <Adafruit_PCD8544.h>

void setup()
{
Adafruit_PCD8544 display= Adafruit_PCD8544(9, 10, 11 , 12, 13);
}

void loop()
{
}

without "display" declaration, it only needs 13% of PM

The basic part of the Adafruit_PCD8544 library which your 'almost empty code' initialises takes up a fair bit of space, 20% on an Arduino UNO for instance, not much you can do about that.

2 Likes

because the PCD8544 LCD driver / (Nokia 5110) is a graphic display and needs resources.

if you are low on memory, why not use a common 1602 LCD? As it is character only, it uses only a small amount of resources.

1 Like

The ATmega8 only has 8K of FLASH. That's 1/4 the FLASH of the ATmega328p on an Arduino UNO.

I can't use a 1602 because all (box, front case, pcb) is already designed :S BUT.... I take off the atmega8 and put an atmega328p. Now it's works fine ready to program.

Thanks to everyone :slight_smile:

Thanks :slight_smile: I will use that atmega8 for other stuff :slight_smile: