Varkha Agrawal
Newbie level 4
I want to change the preset variable in run time by use of eeprom, please help with coding.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I want to change the preset variable in run time by use of eeprom, please help with coding.
void WriteEEPROM (unsigned char xdata *addr, unsigned short Data)
{ // WriteEEPROM
EECON |= EEMEN;
EECON |= EEMWE;
EECON |= EELD;
*addr = Data >> 8;
EECON &= ~EELD;
*(addr+1) = (unsigned char)Data;
while (!(EECON & EERDY));
EECON &= ~EEMWE;
EECON &= ~EEMEN;
} // WriteEEPROM
short ReadEEPROM (unsigned char xdata *addr)
{ // ReadEEPROM
short Result;
EECON |= EEMEN;
Result = (*addr << 8) + (*(addr+1));
EECON &= ~EEMEN;
return (Result);
} // ReadEEPROM