I have a problem with using the internal eeprom of the atmega16. I am using codevision C and in the help file they say to do something like this : //declare global eeprom a=0; then then you can write the eeprom with changing the value for a , the eeprom adress is the adress the compiler has given soo you should not worry about that. but this doesnt work, in my opinion due that every time you restart your system the eeprom is erased and get the inital value of 0 due to the global declaration. They claim that this initial value is only been given when programming the atmega if i understand correctly, anyone exprience with this? Thanks Yannick

Internal eeprom acces with Atmega16
Started by ●March 14, 2006
Reply by ●March 14, 20062006-03-14
> //declare global > eeprom a=0; > > then then you can write the eeprom with changing the value for a , the > eeprom adress is the adress the compiler has given soo you should not > worry about that.I don't use this toolchain. However, I imagine what this really does is: 1. declare a temporary RAM variable 'a'. 2. declare an EEPROM value 'a' which is loaded with your initializer value. When you flash new code into the chip, as long as you haven't disabled this functionality, the EEPROM will be erased and reloaded. Programming the EEPROM area might be a separate step depending on your programming software (AVR Studio for instance it's a separate step - also for the various command-line utilities such as uisp, avrdude, and so forth). 3. implement some bizarre functionality underlying the RAM copy of a which reads it and writes it from EEPROM when accessed at runtime. I'd be very leery of something this "smart".
Reply by ●March 14, 20062006-03-14
The best place to ask this question is the CodeVision support forum on Yahoo. Ken www.speechchips.com
Reply by ●March 15, 20062006-03-15
Hi, I think you should read the EEPROM section in the datasheet for the Mega 16. There is an example. Regards Jens "Yannick" <yannick_de_wit@pandora.be> skrev i en meddelelse news:1142357589.285303.248370@j52g2000cwj.googlegroups.com...>I have a problem with using the internal eeprom of the atmega16. I am > using codevision C and in the help file they say to do something like > this : > > //declare global > eeprom a=0; > > then then you can write the eeprom with changing the value for a , the > eeprom adress is the adress the compiler has given soo you should not > worry about that. > > but this doesnt work, in my opinion due that every time you restart > your system the eeprom is erased and get the inital value of 0 due to > the global declaration. They claim that this initial value is only been > given when programming the atmega if i understand correctly, anyone > exprience with this? > > > Thanks > > Yannick >
Reply by ●March 15, 20062006-03-15
Yes there is, for programming the eeprom externally electrical , but not how to do it internally with codevision C... maybe i just should do it in assembler but wanted to do it with the codevision code as this would be much easier...
Reply by ●March 15, 20062006-03-15
Yannick wrote:> Yes there is, for programming the eeprom externally electrical , but > not how to do it internally with codevision C... maybe i just should do > it in assembler but wanted to do it with the codevision code as this > would be much easier... >Did you REALLY read the data sheet? Get Atmel document doc2466.pdf from the Atmel Web pages and read pages 16 to 20 again. -- Tauno Voipio tauno voipio (at) iki fi
Reply by ●March 17, 20062006-03-17
You are right, but it was confusing because they do not mention these pages in the table of contents for eeprom, if you see in the table of contents for programming memory you get to page 150 or something and there it is for externally program the memory... but yes indeed at page 16-20 it is described very well, it works perfect now... i had to look better, thanks for giving me the good pages:) Yannick
