Hi. I'm working on a project where I need to store some variables in EEPROM. My project structure looks like this:
global.h - global variables, counters, flags used by interrupts and the main loop, pin aliases
global.c - extern definitions
init.h - function declaration for initializing functions: init_interrupts, int_lcd, init_variables_from_eeprom*
init.c - implementation
interrupt.c - interrupt handlers
main.c - main loop
The main() looks like this:
int main() { init_lcd(); init_interrupts(); init_variables_from_eeprom(); sei(); while(1) { ... } }
So in global.h I have some variables which are used in main.c, init.c and interrupt.c.
extern volatile uint8_t EEMEM my_eeprom_variable;
I have a second variable:
volatile uin8_t my_volatile;
Both of these variables are incremented in the same code snippet, one after other, but when I print them on LCD, the my_volatile increments and the my_eeprom_variable remains 0;
What I have done wrong?