Reading EEPROM data, ATMEGA16, with imagecraft c-compiler
CASTalk.com Forum Index CASTalk.com
Discussion of DSP, FPGA, storage and embedded system.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web castalk.com
Reading EEPROM data, ATMEGA16, with imagecraft c-compiler

 
Post new topic   Reply to topic    CASTalk.com Forum Index -> Embedded System
Author Message
fabrizio
Guest





Posted: Sun Dec 12, 2004 5:21 am    Post subject: Reading EEPROM data, ATMEGA16, with imagecraft c-compiler Reply with quote

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,
Back to top
Gary Kato
Guest





Posted: Sun Dec 12, 2004 6:51 am    Post subject: Re: Reading EEPROM data, ATMEGA16, with imagecraft c-compile Reply with quote

Quote:
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.
Back to top
Richard M.
Guest





Posted: Sun Dec 12, 2004 12:59 pm    Post subject: Re: Reading EEPROM data, ATMEGA16, with imagecraft c-compile Reply with quote

fabrizio wrote:

Quote:
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
Back to top
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> Embedded System All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




VoIP Electronics Powered by phpBB