Reading EEPROM data, ATMEGA16, with imagecraft c-compiler

Dec 12, 2004 2 Replies

Hei all,



The intension is to read out a table located in EEPROM using the imagecraft C-compiler version 6.31A



Definition in C



--------------- #pragma data:eeprom char Output_Ports_Table[] = { 0x38, 0x02}; #pragma data:data



.. ..


In the program i write following code ... ... unsigned char Table_Contents;



EEPROM_READ((int)&Output_Ports_Table[0], Table_Contents);


Table_Contents should get the value 0x38, however it keeps getting the value FFFF ?



After compiling the c-file i get a file with extension eep and hex. Both files are downloaded to the ATMEGA16 using the Ponyprog tool. When reading the EEPROM data with Ponyprog, i can see the values 0x38 and 0x02. The EEPROM should be programmed correctly.



Can you help me out with this please.



Regards, Fabrizio,


I don't have a C compiler for AVR. What does EPROM_READ take as parameters?

That second paramter should probably be: &Table_Contents

You want to pass the address of the variable, not the value.

That ought to work. Email me directly with the question and I will help you out.

// richard http://www.imagecraft.com

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required