Skip to main content
Added example code.
Source Link
Nick Gammon
  • 38.9k
  • 13
  • 70
  • 126
 

See Putting constant data into program memory (PROGMEM) for tips about putting stuff into PROGMEM. However personally I wouldn't get too excited about saving 6 bytes.


Example code:

Declare data globally:

const byte mac [6] PROGMEM = { 0x90, 0xA2, 0xDA, 0x0F, 0xE1, 0x85 };

Get a copy for use into a temporary variable:

  char foo [6];
  memcpy_P (foo, mac, sizeof foo);

See Putting constant data into program memory (PROGMEM) for tips about putting stuff into PROGMEM. However personally I wouldn't get too excited about saving 6 bytes.

 

See Putting constant data into program memory (PROGMEM) for tips about putting stuff into PROGMEM. However personally I wouldn't get too excited about saving 6 bytes.


Example code:

Declare data globally:

const byte mac [6] PROGMEM = { 0x90, 0xA2, 0xDA, 0x0F, 0xE1, 0x85 };

Get a copy for use into a temporary variable:

  char foo [6];
  memcpy_P (foo, mac, sizeof foo);
Source Link
Nick Gammon
  • 38.9k
  • 13
  • 70
  • 126

See Putting constant data into program memory (PROGMEM) for tips about putting stuff into PROGMEM. However personally I wouldn't get too excited about saving 6 bytes.