Forum Index > Projects > LED Pegboard and Matrix Projects
 EEPROM, capacitor and bootloader question...
 |  Printable Version
By: KenCorey (offline) on Tuesday, January 20 2009 @ 04:59 AM PST (Read 2506 times)  
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?

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.

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?

-Ken


Forum Henchperson
Henchperson

Status: offline

Registered: 01/02/09
Posts: 22

Profile Email    
   
By: Windell (offline) on Tuesday, January 20 2009 @ 01:05 PM PST  
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. Mr. Green


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/

Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 06/15/06
Posts: 1932
Sunnyvale, CA

Profile Email Website  
   



 All times are PDT. The time is now 08:14 PM.
Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Able to Post 
Filtered HTML Allowed 
Censored Content 

Evil Mad Scientist Forum Archives — Read only!

Please visit our new forums for new discussions.


DIY Hardware for Electronic Art


The Original Egg-Bot Kit


Octolively
Interactive LED kits


Meggy Jr RGB
LED matrix game
development kit.


Business-card sized
AVR target boards


Peggy 2
LED Pegboard kits

My Account






Lost your password?