Question
Error writing to data EEPROM using @eeprom
Posted on December 06, 2013 at 21:36
I have a STM8S207 board and I'm using STVD version 4.3.3 with the Cosmic compiler. I am trying to use the @eeprom directive for writing/reading the data EEPROM and my system hangs when I try to write the data. Here's what I've been trying so far.
#include <string.h> #include ''stm8s.h'' #include ''stm8s_flash.h'' @eeprom s16 eeData; s16 localData; /* Read the data */ localData = eeData; // Works /* Write the data, scenario 1 */ eeData = localData; /* Write the data, scenario 2 */ eecpy(&eeData, &localData, 2); In both cases, the system hangs on the instruction in which I attempt to write to eeData. When stopping with the debugger I see that it is stopped inside function c_eewrw (library function?) at the following instruction: BTJF 0x505f, #2, 0xb155 Is there something else I need to do to get the system ready to write to data EEPROM? Thanks, Bryan