2016-09-08 04:22 AM
What is the right procedure to write to EEPROM?
I saw the following code:
oid CEEPROM::UNLOCK_EEPROM_IF_LOCKED()
{
if ( EEPROM_IS_WRITE_PROTECTED() )
{
FLASH_DUKR = 0xAE;
FLASH_DUKR = 0x56;
while (EEPROM_IS_WRITE_PROTECTED());
}
}
void CEEPROM::LOCK_EEPROM()
{
FLASH_IAPSR_DUL = 0;
while( !EEPROM_IS_WRITE_PROTECTED() );
}
void CEEPROM::Write(unsigned short address, unsigned char data)
{
UNLOCK_EEPROM_IF_LOCKED();
*(unsigned char*)(address) = data;
LOCK_EEPROM();
}
but I doubt it.
2016-09-08 06:08 AM
2016-09-08 06:58 AM
I work with IAR for STM8
2017-08-17 08:47 PM
What c and h file you include ?? And where to find them ?? I am using Cosmic compiler.