Ryan wrote: > Hi folks, > > I'm working on a project using the atmega8, and would like to > implement more features into it. Basically, there are 3 different > flavors for this project to control, and (now) the end user has to > select one before I send it to them. > > I'd much rather have them program it themselves. Now, the problem is, > I didn't design it with this in mind. <grin> > > The good news, is I don't think I need to make any hardware changes. > PD0 and PD1 (RXD and TXD) go directly to the outside world via a > connector. A max232 interface is needed there, but no big deal. > > Now, the question is, can I use these two pins to have a PC/laptop > write to the internal EEPROM? Not directly, but your program can receive characters and program the EEPROM. One trick from the bootloaders is to only receive these configuration commands within (say) the first 2 seconds, and to also have some way to uniquely identify these commands. The datasheet describes how to program the EEPROM; if you're using a language that has libraries there's probably a library for doing the EEPROM stuff already. For instance, in the avr-libc there is: #include <avr/io.h> #include <avr/eeprom.h> #include <stdint.h> uint8_t EEMEM myModeSaved = 0; // byte in EEPROM, defaults to 0 // to read it... uint8_t myMode = eeprom_read_byte(&myModeSaved); // to write it... eeprom_write_byte(&myModeSaved, 3); > I thought about uploading new firmware > each time, but then I have to worry about encryption, etc, etc. So > instead, just write to eeprom a few bytes about how to control the > output pins correctly for whatever flavor the user wants. Have the > eeprom read at startup or what have you. > > Can this be done? Sure. > What will it take? Thanks! See the above. Enjoy, -- Ned Konz ned@bike-nomad.com http://bike-nomad.com
Message
Re: [AVR-Chat] serial to EEPROM on Atmega8?
2006-06-04 by Ned Konz
Attachments
- No local attachments were found for this message.