EmbeddedRelated.com
Forums

Reading EEPROM data, ATMEGA16, with imagecraft c-compiler

Started by fabrizio December 11, 2004
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,
>EEPROM_READ((int)&Output_Ports_Table[0], Table_Contents); >
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.
fabrizio wrote:

>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 > > >
That ought to work. Email me directly with the question and I will help you out. -- // richard http://www.imagecraft.com