Skip to content
Tiogaplanet edited this page Jul 15, 2026 · 4 revisions

MiP has a built-in electrically erasable programmable read-only memory (EEPROM) which can be read from or written to. The EEPROM provides up to 16 bytes of accessible memory. MiP's internal memory addresses are 0x20-0x2F. To implement these functions, only an offset need be provided as in 0x00-0x0F.


setUserData()

void setUserData(uint8_t addressOffset, uint8_t userData)

Description

Stores one byte of user data to the offset specified. Valid offsets are 0x00-0x0F.

Parameters

  • addressOffset is the address offset at which to write the user's data.
  • userData is the one byte of data to be written to EEPROM.

Returns

Nothing

Example

  Serial1.print(F(" Original password: "));
  Serial1.printf("0x%02X\n\r", secretPassword); 

  // Power-off the MiP, comment out this line, recompile and load to the MPU: D1 mini to see EEPROM
  // data preserved across power cycles.
  mip.setUserData(eepromAddressOffset, secretPassword);

getUserData()

uint8_t getUserData(uint8_t addressOffset)

Description

Reads one byte of user data from the address offset specified. Valid addresses are 0x00-0x0F.

Parameters

  • addressOffset is the address at which to read stored data.

Returns

  • The contents of the EEPROM read from the given address offset.

Example

  Serial1.print(F(" Recovered password: "));
  Serial1.printf("0x%02X\n\r", mip.getUserData(eepromAddressOffset));

Clone this wiki locally