Skip to main content
Visitor II
February 14, 2011
Question

Cosmic and @eeprom

  • February 14, 2011
  • 2 replies
  • 716 views
Posted on February 14, 2011 at 09:10

Cosmic and @eeprom

    This topic has been closed for replies.

    2 replies

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:11

    I'm using EEPROM in different way. I'm not sure that just declare variable in eeprom arae.

    here is my source code 

    void EEPROM_WRITE(u16 addr,u8 data){

    FLASH_Unlock(FLASH_MEMTYPE_DATA);

    addr = 0x4000 + addr;

    FLASH_ProgramByte(addr, data);

    FLASH_Lock(FLASH_MEMTYPE_DATA);

    }

    u8 EEPROM_Read(u16 addr){

    u8 returndata;

    FLASH_Unlock(FLASH_MEMTYPE_DATA);

    addr = 0x4000 + addr;

    returndata =  FLASH_ReadByte(addr);

    FLASH_Lock(FLASH_MEMTYPE_DATA);

    return returndata;

    }

    to use EEPROM in my way you need to include STM8S_FLASH.C and .H from ST Standard Library into your project

    Saran

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:11

    Hi,

    from the user manual, page 51:

    ****

    The library routines are also using a few external symbols to locate the command registers in the I/O register space. When a standard header file provided with the

    compiler is included in at least one source file of the application, these

    symbols are automatically found. Otherwise, it is necessary to provide

    these symbols either by extra C declarations...

    ****

    Regards,

    Luca