|
|||||||
![]() |
Forum Index > Projects > LED Pegboard and Matrix Projects | ||
EEPROM, capacitor and bootloader question... |
|||
| | | Printable Version |
|
KenCorey | ||||||||
|
I know the 168 has 512 bytes of EEPROM storage on it...but does the Meggy Make any use of it? Any reason why using it would fry my Meggy? |
![]() Henchperson Status: offline
Registered: 01/02/09 |
||||||||
|
|||||||||
|
Windell | ||||||||
|
II know the 168 has 512 bytes of EEPROM storage on it...but does the Meggy Make any use of it? Any reason why using it would fry my Meggy?The EEPROM is completely free for your use. It's perfect for high scores or an option to save your game. The Arduino distribution includes a lightweight (non-bloated) library with simple read/write functions: http://arduino.cc/en/Reference/EEPROM, you won't do much better on your own. Two cautions: The EEPROM is rated for 100,000 cycles. That seems like a lot, but if you automatically save the state in a loop, it can be gone in a blink. Second, the EEPROM can be corrupted by programming when the voltage is too low. Be careful.
I know this might be dreaming, as the power switch simply cuts power, but is there any way to retain power long enough in my program so that there's time to save those 512 bytes of memory in the EEPROM before shutting down? Could I potentially install a capacitor that provides another second of juice before the machine dies? Extra points if there's a way to signal a program that a loss-of-power event has happened, and it should batten down its hatches.Well, that *is* a tall order. Yes, you can add more capacitors. It will need to be on the order of 1000 uF more if it's going to be a significant change. Next.... You can set the ADC to read the value of the 1.1 V internal reference with reference to the AVCC pin, which is tied to VCC; that will let you detect when VCC starts to droop. I *THINK* this will work without interfering with the buttons. When the voltage droops *just* far enough, turn off the LEDs (easily and quickly done through the transistors) to slow the rate of voltage loss and write to the EEPROM. Yes, I think it will work.
As a side topic... "Where's the bootloader?" I know I've loaded some over-large programs in, and seem some *mighty* strange behaviour. Can I fry my meggy that way?Well, that's the 14k, not 16k upload limit. The bootloader section should be "locked" to prevent overwriting it when reading in a program via the bootloader. (It's possible to override that with an ISP programmer, of course, or if the lock bits are set incorrectly.) No, things won't work right if your program size is too big, but I have not seen a confirmed case (on the Meggy Jr) of the bootloader allowing itself to be overwritten. Windell H. Oskay drwho(at)evilmadscientist.com http://www.evilmadscientist.com/ |
![]() Evil Scientist ![]() Status: offline
Registered: 06/15/06 |
||||||||
|
|||||||||
|
|
| All times are PDT. The time is now 08:14 PM. |
|
|
Octolively
Interactive LED kits
Meggy Jr RGB
LED matrix game
development kit.
Business-card sized
AVR target boards
Peggy 2
LED Pegboard kits