Pages: [1]   Go Down
Author Topic: arduino databse eeprom lib  (Read 3049 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 91
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

im looking for a db lib
all dedicated solutions i found are broken on 1.0
roll my own?

http://www.arduino.cc/playground/Code/ExtendedDatabaseLibrary
http://www.arduino.cc/playground/Code/DatabaseLibrary
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 631
Posts: 50115
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
all dedicated solutions i found are broken on 1.0
So? Fix one of them.

You really don't have a lot of room for a database on an Arduino. 2K doesn't hold a lot of data.
Logged

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 91
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok, attached zip of extendeDb lib compiles under 1.0.1


* EDB_1.0.1.zip (9.7 KB - downloaded 67 times.)
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 220
Posts: 13846
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for sharing,

added a link on - http://arduino.cc/playground/Code/ExtendedDatabaseLibrary - to this thread so people see your updated lib
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 91
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks robtillaar, to make compatible i replaced WProgram.h with

Code:
#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
#else
  #include "WProgram.h"

actually i dont real like that lib, made me want to get closer to the metal.
anyways i did some benchmark using EEPROMEx lib, and was a bit shocked to find out the write speeds of EEPROM

Code:
Check how much time until EEPROM ready to be accessed
-----------------------------------------------------
Time to write 1 byte  (ms)                        : 0
Recovery time after writing byte (ms)             : 4
Time to write Long (4 bytes) (ms)                 : 10
Recovery time after writing long (ms)             : 4
Time to read Long (4 bytes) (ms)                  : 0
Recovery time after reading long (ms)             : 0
Time to write 7 byte array  (ms)                  : 20
Time to update 7 byte array with 7 new values (ms): 18
Time to update 7 byte array with 3 new values (ms): 10
Time to read 7 byte array (ms)                    : 0

so i've been thinking about moving over to PROGMEM land (using this FLASH lib).

my db is about 510 bytes.
is flash memory a better path?
not just for speed. any cons?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 631
Posts: 50115
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
so i've been thinking about moving over to PROGMEM land (using this FLASH lib).

my db is about 510 bytes.
is flash memory a better path?
not just for speed. any cons?
Besides being read-only? Nope. Can't think of any.
Logged

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 91
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 smiley
Logged

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 91
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

dont get it, eeprom is also technically "read only"
http://www.arduino.cc/playground/Learning/Memory

i've seen text that mentioned you can not use progmem to write variables.
but the learning page is a bit slim on details.
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Where does it say that EEPROM is read-only? It says

Quote
EEPROM is memory space that programmers can use to store long-term information.

and

Quote
...EEPROM memory are non-volatile (the information persists after the power is turned off).

Neither of which imply read-only.
Logged

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 91
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 Electrically Erasable Programmable Read-Only Memory
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Electrically Erasable Programmable Read-Only Memory

I know what it means. It's a bit of a misnomer really though.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 220
Posts: 13846
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

wrt performance issues:

The database code does not take into account that EEPROM writes are often done in pages (chucks of bytes, powers of 2, 16/32/64 etc)
If you need to updat 7 vars in 1 page you can do that in 7 writes but also in 1.
Seems that you did it per byte.
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 91
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks for the tip,

so:
PROGMEM (Flash) data region can only be populated at program burn time. You can’t change the values in the flash after the program has started running.
i think its worth mentioning in the learning.Memory section.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 220
Posts: 13846
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

note added
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Pages: [1]   Go Up
Jump to: