2003-11-10 03:08 AM
2003-10-29 05:12 AM
Hello programmers,
I have a problem with the COSMIC Compiler (for ST7Lite0) when I want to work with EEprom variables. Just declaring them by @eeprom char xyz; and treating them like ''normal'' variables seems not to be enough - the compiler unses some internal routine for writing the variable, but there seems to be no reading routine so I get nothing but nonsense. An assembler routine I used instead works fine with EEprom cells, but I want to use ''pure'' C. Does anyone know how to treat EEprom variables in ''Cosmic C'' ? sincerely Jens Kapmeyer2003-10-29 08:38 PM
When you read the eeprom it is read just like normal memory so no special routines are required
To use eeprom declare variable: @near @eeprom char xyz; Make sure you use the memory qualifier otherwise cosmic may get confused as to the location of the memory Regards sjo2003-10-30 03:18 AM
Hi sjo,
thanks for your advice, basically it works, but not very reliable ! My simple program is like: @near @eeprom ee_test; .... Main() { ee_test++; (then put EEprom cell content to the LED port to visualize) } I expect to see the counter (via LEDs) increased every time I start my program on the inDART board. It works very well when I restart with the ''reset'' button. But interupting the supply voltage instead gives unexpected results from time to time ! Using my assembler routine it seems to work correctly in both cases. There was one guy having problems with the EEprom in this forum, he asked if it may come from RF influences, because he had a transmitter nearby, maybe he's got ''my'' problem ? cu Jens2003-11-02 11:37 PM
Try to initialize the variable in the starting so as not to get the unexpected results.
2003-11-10 12:07 AM
Hi Ranjeet,
thanks, but initializing EEprom variables makes no sense, because the EEprom cells should have the value they had the last time the prozessor was running before switching off the apparatus, initializing would destroy these values ! Jens2003-11-10 03:08 AM
The only other advice I could give is make sure you have +lite0 options enabled for cosmic and double check memory model and matching library in your linker file.
Regards sjo