Not enough memory AND problem with using PROGMEM

hey, my board is pro mini 328p with ram of 2048 bytes.

i'm working on my own library to make a support for my own alphabet's on a GLCD.
i mapped characters in hex format and here is a preview of my arrays :

const uint16_t splited_map1[178] = {...};
const uint16_t splited_map2[170] = {...};
const uint16_t splited_map3[175] = {...};
const uint16_t splited_map4[171] = {...};
const uint16_t splited_map5[176] = {...};
const uint16_t splited_map6[20] = {...};

unfortunately there is not enough ram! but i used this arrays CONSTANT, i read a bit about this problem and then found PROGMEM concept, then i changed above code to this:

const uint16_t splited_map1[178] PROGMEM = {...};
const uint16_t splited_map2[170] PROGMEM = {...};
const uint16_t splited_map3[175] PROGMEM = {...};
const uint16_t splited_map4[171] PROGMEM = {...};
const uint16_t splited_map5[176] PROGMEM = {...};
const uint16_t splited_map6[20] PROGMEM = {...};

nothing changes!

im not sure why i cant define this big arrays in ROM? i need read them for short time and one by one, it is possible to remake them as smaller parts. just need read one of them at the time but all of them forced to be stored on the RAM.

PROGMEM requires special instructions to access it.
You need to use these in the code you didn't post.

for to block of the code, the used ram is same value.

the code is huge, i define this arrays in private section of the class header.

some thing like this :

#ifndef iClass_h
#define iClass_h

#if (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#endif

class iClass {
	typedef void (*callback_function)(int, int, bool);
	public:
		iClass (uint16_t width, uint16_t height, callback_function setpix);
		void printTextToBuffer(byte buffer[], uint8_t query[]);
	private:
		uint16_t lcd_width, lcd_height;
		callback_function setPixel;
		uint8_t draw_cursor = 0;
		.
		.
		.
		const uint16_t splited_map1[178] PROGMEM = {...};
		const uint16_t splited_map2[170] PROGMEM = {...};
		const uint16_t splited_map3[175] PROGMEM = {...};
		const uint16_t splited_map4[171] PROGMEM = {...};
		const uint16_t splited_map5[176] PROGMEM = {...};
		const uint16_t splited_map6[20] PROGMEM = {...};
};

#endif

and for main code:

#include <SPI.h>
#include "LCD_Functions.h"
#include "iClass.h"

iClass ici(84,48,setPixel);

void setup() {
  lcdBegin();
  setContrast(50); 
}

void loop() {
  
}

PROGMEM can only be used at global scope, I suspect.
You could try "static"

TolpuddleSartre:
PROGMEM can only be used at global scope, I suspect.
You could try "static"

thank you :slight_smile: seems ok, i dont try it yet but i check spark fun's library for nokia5110 (was included in my code) and then i saw a same array was declared via PROGMEM with static keyword.

but what is the difference between pgm_read and pgm_read near (or far)
i saw both of them was used in arduino related projects