cancel
Showing results for 
Search instead for 
Did you mean: 

ST7, COSMIC Compiler and EEprom

jens239955
Associate II
Posted on November 10, 2003 at 12:08

ST7, COSMIC Compiler and EEprom

6 REPLIES 6
jens239955
Associate II
Posted on October 29, 2003 at 14:12

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 Kapmeyer
sjo
Associate II
Posted on October 30, 2003 at 05:38

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

sjo
jens239955
Associate II
Posted on October 30, 2003 at 12:18

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

Jens

itsmejatinus
Associate II
Posted on November 03, 2003 at 08:37

Try to initialize the variable in the starting so as not to get the unexpected results.

jens239955
Associate II
Posted on November 10, 2003 at 09:07

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 !

Jens

sjo
Associate II
Posted on November 10, 2003 at 12:08

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