cancel
Showing results for 
Search instead for 
Did you mean: 

Cosmic and @eeprom

jarek
Associate
Posted on February 14, 2011 at 09:10

Cosmic and @eeprom

2 REPLIES 2
saranyim
Associate II
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

luca239955_stm1_st
Senior II
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