PROGMEM max of 255 seperate enteries?

Hi; Im using arduino 1.0.4. I have found that my progmem function stops working after 255 enteries. Is there some part of the library I can edit to allow more then 255 enteries?
Thanks for any advice.

//________________________________________________________LONG STRINGS TO SAVE RAM USE PROGMEM_____________________

prog_char string_0[] PROGMEM = "CURRENT";   
prog_char string_1[] PROGMEM = "FREQ";
prog_char string_2[] PROGMEM = "DATA IN / TERMINAL";
prog_char string_3[] PROGMEM = "SIM DATA OUT";
prog_char string_4[] PROGMEM = "SCOPE";
prog_char string_5[] PROGMEM = "4800";
prog_char string_6[] PROGMEM = "9600";
prog_char string_7[] PROGMEM = "19200";
prog_char string_8[] PROGMEM = "38400";
prog_char string_9[] PROGMEM = "57600";
prog_char string_10[] PROGMEM = "WAITING ON INPUT";
prog_char string_11[] PROGMEM = "SIMULATING";
prog_char string_12[] PROGMEM = "4 CHANNELS";
prog_char string_13[] PROGMEM = "8 CHANNELS";
prog_char string_14[] PROGMEM = "12 CHANNELS";
prog_char string_15[] PROGMEM = "16 CHANNELS";
prog_char string_16[] PROGMEM = "RS 485";
prog_char string_17[] PROGMEM = "RS 232";
prog_char string_18[] PROGMEM = "2PIN MAG";
prog_char string_19[] PROGMEM = "Cal Mode";
prog_char string_20[] PROGMEM = "3PIN MAG";
prog_char string_21[] PROGMEM = "BACKLIGHT";
prog_char string_22[] PROGMEM = "Rob C"; //____________________________INSERT YOUR NAME_________________
prog_char string_23[] PROGMEM = "1.6";//_____________________________version number_____________________
prog_char string_24[] PROGMEM = " ";
prog_char string_25[] PROGMEM = "SIMULATE";
prog_char string_26[] PROGMEM = "MEASURE";
prog_char string_27[] PROGMEM = "SERIAL";
prog_char string_28[] PROGMEM = "SPECIAL";
prog_char string_29[] PROGMEM = "SETTINGS";
prog_char string_30[] PROGMEM = "BAT";
prog_char string_31[] PROGMEM = "MAX DATA";
prog_char string_32[] PROGMEM = "MORE";
prog_char string_33[] PROGMEM = "CSV";
prog_char string_34[] PROGMEM = "WITS";
prog_char string_35[] PROGMEM = "VOLTS";
prog_char string_36[] PROGMEM = "CURRENT";
prog_char string_37[] PROGMEM = "SCOPE";
prog_char string_38[] PROGMEM = "SIMULTANEOUS";
prog_char string_39[] PROGMEM = "WEIGHT GAUGE";
prog_char string_40[] PROGMEM = "VOLT SIM";
too much code deleted some here

prog_char string_285[] PROGMEM = "0114";

prog_char string_286[] PROGMEM = "RATE ";
prog_char string_287[] PROGMEM = "DEPTH ";
prog_char string_288[] PROGMEM = "WEIGH ";
prog_char string_289[] PROGMEM = "CIRC PR ";
prog_char string_290[] PROGMEM = "WEL PR ";
prog_char string_291[] PROGMEM = "RATE 1 ";
prog_char string_292[] PROGMEM = "RATE 2 ";

//_____________________________________CT vision
prog_char string_293[] PROGMEM = "0108";
prog_char string_294[] PROGMEM = "0109";
prog_char string_295[] PROGMEM = "0110";
prog_char string_296[] PROGMEM = "0112";
prog_char string_297[] PROGMEM = "0113";
prog_char string_298[] PROGMEM = "0114";
prog_char string_299[] PROGMEM = "0115";

prog_char string_300[] PROGMEM = "INJ D ";
prog_char string_301[] PROGMEM = "INJ R ";
prog_char string_302[] PROGMEM = "Weight ";
prog_char string_303[] PROGMEM = "WELL PR ";
prog_char string_304[] PROGMEM = "CIRC PR ";
prog_char string_305[] PROGMEM = "REEL D ";
prog_char string_306[] PROGMEM = "REEL S ";


PROGMEM const char *string_table[] = 	   // change "string_table" name to suit
{   
  string_0,   string_1,   string_2,   string_3,   string_4,   string_5,   string_6,   string_7,   string_8,   string_9,   string_10,  string_11,  string_12,  string_13, 
  string_14,  string_15,  string_16,  string_17,  string_18,  string_19,  string_20,  string_21,  string_22,  string_23,  string_24,  string_25,  string_26,  string_27, 
  string_28,  string_29,  string_30,  string_31,  string_32,  string_33,  string_34,  string_35,  string_36,  string_37,  string_38,  string_39,  string_40,  string_41,
  string_42,  string_43,  string_44,  string_45,  string_46,  string_47,  string_48,  string_49,  string_50,  string_51,  string_52,  string_53,  string_54,  string_55,
  string_56,  string_57,  string_58,  string_59,  string_60,  string_61,  string_62,  string_63,  string_64,  string_65,  string_66,  string_67,  string_68,  string_69,
  string_70,  string_71,  string_72,  string_73,  string_74,  string_75,  string_76,  string_77,  string_78,  string_79,  string_80,  string_81,  string_82,  string_83,
  string_84,  string_85,  string_86,  string_87,  string_88,  string_89,  string_90,  string_91,  string_92,  string_93,  string_94,  string_95,  string_96,  string_97,
  string_98,  string_99,  string_100, string_101, string_102, string_103, string_104, string_105, string_106, string_107, string_108, string_109, string_110, string_111,
  string_112, string_113, string_114, string_115, string_116, string_117, string_118, string_119, string_120, string_121, string_122, string_123, string_124, string_125,
  string_126, string_127, string_128, string_129, string_130, string_131, string_132, string_133, string_134, string_135, string_136, string_137, string_138, string_139,
  string_140, string_141, string_142, string_143, string_144, string_145, string_146, string_147, string_148, string_149, string_150, string_151, string_152, string_153, 
  string_154, string_155, string_156, string_157, string_158, string_159, string_160, string_161, string_162, string_163, string_164, string_165, string_166, string_167, 
  string_168, string_169, string_170, string_171, string_172, string_173, string_174, string_175, string_176, string_177, string_178, string_179, string_180, string_181, 
  string_182, string_183, string_184, string_185, string_186, string_187, string_188, string_189, string_190, string_191, string_192, string_193, string_194, string_195, 
  string_196, string_197, string_198, string_199, string_200, string_201, string_202, string_203, string_204, string_205, string_206, string_207, string_208, string_209, 
  string_210, string_211, string_212, string_213, string_214, string_215, string_216, string_217, string_218, string_219, string_220, string_221, string_222, string_223, 
  string_224, string_225, string_226, string_227, string_228, string_229, string_230, string_231, string_232, string_233, string_234, string_235, string_236, string_237,
  string_238, string_239, string_240, string_241, string_242, string_243, string_244, string_245, string_246, string_247, string_248, string_249, string_250,   

  //_________for wits ID'D

  string_251, string_252, string_253, string_254, string_255, string_256, string_257, string_258, string_259, string_260, string_261, string_262, string_263, string_264, 
  string_265, string_266, string_267, string_268, string_269, string_270, string_271, string_272, string_273, string_274, string_275, string_276, string_277, string_278,
  string_279, string_280, string_281, string_282, string_283, string_284, string_285, string_286, string_287, string_288, string_289, string_290, string_291, string_292,
  string_293, string_294, string_295, string_296, string_297, string_298, string_299, string_300, string_301, string_302, string_303, string_304, string_305, string_306 
};

instrumentek:
Hi; Im using arduino 1.0.4. I have found that my progmem function stops working after 255 enteries.

I just tried this: works fine.

void setup()
{
	uint16_t n, x;

	char buffer [32];

	static const char *messages[] = {
		PSTR("CURRENT"),
		PSTR("FREQ"),
		PSTR("DATA IN / TERMINAL"),
		PSTR("SIM DATA OUT"),
		PSTR("SCOPE"),
		PSTR("4800"),
		PSTR("9600"),
		PSTR("19200"),
//////////  SNIP ///////////
		PSTR("RS 485"),
		PSTR("RS 232"),
		PSTR("2PIN MAG"),
		PSTR("Cal Mode"),
		PSTR("3PIN MAG"),
		PSTR("BACKLIGHT"),
		PSTR("Rob C"),
		PSTR("1.6"),
		PSTR(" "),
		PSTR("SIMULATE"),
		PSTR("MEASURE"),
		PSTR("SERIAL"),
	};

	Serial.begin (115200);

	n = sizeof (messages) / sizeof (*messages);
	sprintf (buffer, "string count is %u\r\n", n);
	Serial.print (buffer);

	for (x = 0; x < n; x++) {
		sprintf_P (buffer, messages[x]);
		Serial.println (buffer);
		_delay_ms (1000);
	}
}


void loop()
{
}

I cut out a lot in the example I posted for size reasons, but I have 650 separate strings in the working code.

Hope this helps.

(edit to add): I did this on a MEGA2560 board. If you are using a 328P based board (like an UNO), I think there is a 0-255 limit on PROGMEM because it only supports near (8 bit) reads (i.e. pgm_read_byte_near) while the MEGA also supports “pgm_read_byte_far” (i.e. 16 bit pointer or 65535 entries).

In the code I posted above, the “sizeof (*messages)” is 2 which means 16 bit address.

I may be wrong… not sure - maybe someone else can chime in.

Hi, Thanks

I am using a teensy with the arduino software. I believe it uses the AT90USB1286. Does this chip support the pgm_read_byte_near (8 bit) or the pgm_read_byte_far (16 bit)?

You don't need to put all the data into ONE array in PROGMEM. Use multiple arrays.

Thanks, I moved the data into 2 strings and it worked well thank you!

Thanks, I moved the data into 2 strings and it worked well thank you!

Two strings? Or two arrays?