Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13896
Lua rocks!
|
 |
« Reply #15 on: April 08, 2012, 02:31:30 am » |
I don't think he does sleep!
I sleep. And I drink.  Later in the day my posts get a bit more snippy. 
|
|
|
|
|
Logged
|
|
|
|
|
Monterrey, N.L. México
Offline
Full Member
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
|
 |
« Reply #16 on: April 08, 2012, 02:32:55 am » |
See you tomorrow, Nick. I'm going to watch a movie and then go to sleep, before I pass away!!!
|
|
|
|
|
Logged
|
|
|
|
|
Monterrey, N.L. México
Offline
Full Member
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
|
 |
« Reply #17 on: April 08, 2012, 02:39:09 am » |
I sleep. And I drink.
WE drink. ¡SALUD Nick! And I don't think so, you DO NOT sleep amigo. Gracias por ayudarnos. ¿Vete a acostarte YA!!! As I said before Nick, "never leave this board"
|
|
|
|
« Last Edit: April 08, 2012, 02:44:58 am by bibre »
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13896
Lua rocks!
|
 |
« Reply #18 on: April 08, 2012, 02:41:07 am » |
Buenas noches mi amigo.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Offline
Shannon Member
Karma: 116
Posts: 10138
|
 |
« Reply #19 on: April 08, 2012, 02:48:10 am » |
EEPROM is organized into pages of 4 bytes. So you will wear out 4 bytes at a time. Naw. EEPROM paging is strictly to facilitate writing by an external programmer. AVR internal EEPROMs really are composed of one byte cells.
|
|
|
|
|
Logged
|
|
|
|
|
Monterrey, N.L. México
Offline
Full Member
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
|
 |
« Reply #20 on: April 08, 2012, 02:48:10 am » |
Good night, my friend. You really have the Flash of Genious!!! Thanx.
|
|
|
|
|
Logged
|
|
|
|
|
Monterrey, N.L. México
Offline
Full Member
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
|
 |
« Reply #21 on: April 08, 2012, 03:02:28 am » |
@Coding Badly
Thanx.
So, would I better be sending my data to the host and store it there??? That's what I'm doing now.
|
|
|
|
|
Logged
|
|
|
|
|
Monterrey, N.L. México
Offline
Full Member
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
|
 |
« Reply #22 on: April 08, 2012, 03:28:12 am » |
Buenas noches, Nick!
What the heck are you doing there, Nick? What time is it in the outback?, C'mon amigo, go to rest. You've helped us! Go to sleep and please ... be here for us!
You will always be my friend.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Faraday Member
Karma: 16
Posts: 3196
20 LEDs are enough
|
 |
« Reply #23 on: April 08, 2012, 05:31:24 am » |
|
|
|
|
|
Logged
|
|
|
|
|
Monterrey, N.L. México
Offline
Full Member
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
|
 |
« Reply #24 on: April 08, 2012, 06:56:31 pm » |
Interesting idea, thank you. 
|
|
|
|
|
Logged
|
|
|
|
|
Monterrey, N.L. México
Offline
Full Member
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
|
 |
« Reply #25 on: April 08, 2012, 07:13:27 pm » |
@James C4S Program code (outside of the bootloader partition) can't save to PROGMEM.
You are right, I had completely forgotten that  , since I've never used PROGMEM at all. I had only read about it. And it makes sense since PROGMEM is only updated when uploading the sketch. Or is it also updated at reset/power-up time? Not good for run time variable data but for constant data. It is clear to me now. Thank you, James! 
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 10
Posts: 871
|
 |
« Reply #26 on: April 08, 2012, 09:07:21 pm » |
I just thought up another way, it would take a bit more coding but...
1st byte contains (0.255), you boot up, read the first byte (byte 1) of eeprom, this value represents how many times you've used that 4 bytes of memory (writing) everytime you do a write say bytes 2,3,4,5, read... Byte 1 becomes 2, etc etc.
When Byte 1 reaches 255;, leave the first 5 bytes of memory alone (so you read byte 1, is it at 255? if so, Seek 5 bytes into the EEPROM, this time, you you read it, 0 and the counter begins again, and start again, if the the next write value says 255, then read further until you find 0 . sequentially reading every 5 bytes of eeprom to find the starting memory address in which to safely write the new data.., the beauty of this is, when you've used 100 (X amount of segments eg divide 5 bytes into total eeprom memory) you can wipe every byte counter back to 0 and start again giving a nice even wear of memory to the eeprom, ie not maxing out it's life cycle for individual bytes leaving an average life left for device, even after using it for 3 years you could then sell it on knowing full well it's going to keep working for some time to come....
the first time the program runs you could format the memory, 1,5,10,15...... to the end of eeprom gets set to 0.
eeprom[1]=1; write 2,3,4,5 eeprom[1]=2;///
if (eeprom[1]=255) { baseaddress=baseaddress+5; }
int returnbaseaddress();
{ scan through each 5 bytes reading memory... etc etc }
|
|
|
|
« Last Edit: April 08, 2012, 09:15:02 pm by cjdelphi »
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13896
Lua rocks!
|
 |
« Reply #27 on: April 08, 2012, 09:19:16 pm » |
That's pretty much what I was suggesting, except to use 2 bytes. The EEPROM can stand more than 255 writes.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 10
Posts: 871
|
 |
« Reply #28 on: April 08, 2012, 09:21:51 pm » |
255 is to keep it even... so you end up using all of the EEPROM memory then you reset it all back to 0 and start again..
so for example, you don't use bytes 1,2,3,4,5 10,0000 times rendering the memory almost dead and have the rest of memory in near perfect condition, you'd not be able to sell it.
doing a 255 cycle on it means you even it out so selling it on you'd not have to worry about wearing just a few bytes of memory out.
|
|
|
|
|
Logged
|
|
|
|
|
SE USA
Offline
Faraday Member
Karma: 33
Posts: 3619
@ssh0le
|
 |
« Reply #29 on: April 08, 2012, 10:16:28 pm » |
And it makes sense since PROGMEM is only updated when uploading the sketch. Or is it also updated at reset/power-up time?
its only updated when you upload
|
|
|
|
|
Logged
|
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL
|
|
|
|
|