Best solution for a Propeller Database: FSRW->SD, SettingsOBJ->EEPROM, ROMEngin
WBA Consulting
Posts: 2,935
I am working on a project for a component baking oven that will require a simple database to store data dynamically for use by itself (not for export to a PC for Access or other database software). The data to be stored is somewhat simple, but I am still uncertain as to which route I should take to properly implement a SPIN database. My setup already has SD, so it can use SD, the upper portion of of the 64K boot EEPROM, or a secondary EEPROM. The data to be stored consists of the following chunks:
Tag# (2 digit number, 1-140))
MSL# (single digit, 1-6)
Initials (two alphabetical characters, IE: "AW")
Date (in four digit format, IE: "0427")
Time (in four digit 24 hour format, IE: "1700" (5pm))
Item# (alphanumeric string up to 24 characters, IE: "EIN-044-1944-001")
The user interface will prompt for a tag# to start a record which will be entered by scanning a barcoded tag with a Symbol LS1220 serial scanner. The operator will then be prompted to enter the MSL#, their initials, and the item#. The date and time will be added by the Prop using a RTC. This group of data needs to be stored in a manner that can be pulled back using the tag# (and if possible the item#) by the propeller to display status information as requested on a screen (analog TV or Ray's 4.3" touchscreen).
The data will not be used with a PC, only on the propeller setup, so I don't need to make the data PC friendly however it is stored.
Anyhow, I have been digging through EEPROM options (ROMEngine Object and Settings Object) but as I dig, I am concerned that I may be heading the wrong direction. I already use a few SD objects, but the data handling seems a little harder than the EEPROM objects (I am still unsuccessful at reading logged data properly back from SD).
It appears that I could use the Settings object easily, but I think I would have to make a key for all 140 tags in the CON section to handle them. Seems like a mess of work for something simple.
The ROMEngine seems easy to use by utilizing the Tag# as an EEPROM offset for the location in EEPROM and just store the data in chunks at that offset. (am I understanding those two objects correctly?)
Any suggestions on where to look deeper to make my SPIN Database?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
WBA-TH1M Sensirion SHT11 Module
Special Olympics Polar Bear Plunge, Mar 20, 2010
Post Edited (WBA Consulting) : 4/28/2010 1:35:05 PM GMT
Tag# (2 digit number, 1-140))
MSL# (single digit, 1-6)
Initials (two alphabetical characters, IE: "AW")
Date (in four digit format, IE: "0427")
Time (in four digit 24 hour format, IE: "1700" (5pm))
Item# (alphanumeric string up to 24 characters, IE: "EIN-044-1944-001")
The user interface will prompt for a tag# to start a record which will be entered by scanning a barcoded tag with a Symbol LS1220 serial scanner. The operator will then be prompted to enter the MSL#, their initials, and the item#. The date and time will be added by the Prop using a RTC. This group of data needs to be stored in a manner that can be pulled back using the tag# (and if possible the item#) by the propeller to display status information as requested on a screen (analog TV or Ray's 4.3" touchscreen).
The data will not be used with a PC, only on the propeller setup, so I don't need to make the data PC friendly however it is stored.
Anyhow, I have been digging through EEPROM options (ROMEngine Object and Settings Object) but as I dig, I am concerned that I may be heading the wrong direction. I already use a few SD objects, but the data handling seems a little harder than the EEPROM objects (I am still unsuccessful at reading logged data properly back from SD).
It appears that I could use the Settings object easily, but I think I would have to make a key for all 140 tags in the CON section to handle them. Seems like a mess of work for something simple.
The ROMEngine seems easy to use by utilizing the Tag# as an EEPROM offset for the location in EEPROM and just store the data in chunks at that offset. (am I understanding those two objects correctly?)
Any suggestions on where to look deeper to make my SPIN Database?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
WBA-TH1M Sensirion SHT11 Module
Special Olympics Polar Bear Plunge, Mar 20, 2010
Post Edited (WBA Consulting) : 4/28/2010 1:35:05 PM GMT
Comments
I recall seeing something about a FAT file system object for SD cards? Perhaps this would be at the object exchange...
http://obex.parallax.com
Then so far as storing the data, there is a thing called a "flat file database". You can just list your data in a text file with a text editor like "notebook". More on that here...
http://en.wikipedia.org/wiki/Flat_file_database
Then if you have "access" to Microsoft Access (db program), with this you can import or export data... OK.... So what you do is create a database with the fields you want above (with Microsoft Access or something similar like Open Office perhaps?), then fill in maybe 10 records of the information you want to store (as you said above)...
Then simply export·that data·using the different flat file formats listed in Access. Such as comma delimited, rich text, etc., then see what·that data looks like. See which flat file format you would prefer to use.
That would be data stored in a format a regular database could import and use.
Then you could use one of these same simple formats on your SD card. And/or store this in a regular text file using the above FAT file system object? (I have not looked at that and have no idea what it does???).
Anyway if you could store that data on the SD card in such a format, then in theory you should be able to stick that sd card in a PC, import the data with a regular database like Microsoft Access, then use that data.
So then the data could be read / shared. And then the only thing to do would be to write code so you could write/read this data with the Propeller.
But a flat file database has its data stored in the most simple format possible. It is just text! Yet also a "database".
Post Edited (bill190) : 4/28/2010 8:11:34 AM GMT
The hex editors I have used show hex values on most of the screen and ASCII characters in the right column (same data).
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
WBA-TH1M Sensirion SHT11 Module
Special Olympics Polar Bear Plunge, Mar 20, 2010
Use the Basic_I2C_Driver object to read and write this. If you keep the entries aligned on a 32 byte address boundary, you can use paged writes to write the whole thing in one 10ms write cycle when you need to update it.
For testing purposes, you might write a program that would dump the EEPROM database to an SD card file for analysis on a PC. This program would always be loaded into RAM and run when needed, never to EEPROM. Similarly, you could have an EEPROM database initialization program that would be only loaded and run from RAM when needed.
Post Edited (Mike Green) : 4/28/2010 2:28:10 PM GMT
Apple DOS 3.3 Text File Commands
OPEN name Opens a text file for reading.
CLOSE name Closes a text file.
READ name Sets the file 'name' to read mode.
WRITE name Sets the file 'name' to write mode.
APPEND name Sets write mode for 'name' at the end of the current file.
POSITION name,x Moves the record pointer for 'name' to the position specified by x.
EXEC name Reads text from file 'name' entering it as though it were typed from the keyboard.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I always have someone watching my back.
There are all sorts of problems which can occur when you try to read that stored data and display *just* the data. So if you use an existing format, you would know that it would work in all situations. (You can avoid potential problems.)
There are always exceptions/changes and human input error. (Be sure to only allow·valid characters to be input - you wouldn't want someone to be able to accidentally enter a comma in a comma delimited format database!)
And people are people (management). Frequently a database will be designed and "set in stone", then the customer/management will come along and say "Can we add an additional field to the database so we can do this and that?"
If it is designed to allow for future changes, then this would be much easier to do.
Post Edited (bill190) : 4/28/2010 3:13:15 PM GMT
@Mike: Are you looking at my notes? You describe exactly what I derived after spending about an hour between the Propeller manual, PEKit book, and the EEPROM datalogging PE Kit lab. My notes are in pencil on graph paper so I can't scan them in to share, but attached is the storage template I was brainstorming.
I don't really understand page writes (I believe that means I will have to use some type of buffering to hold the different pieces of the 32 byte page?) Your idea of dumping to SD sounds good and I think I may have the end of my main loop check for the presence of an SD card and if it exists, prompt to dump the EEPROM data onto it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
WBA-TH1M Sensirion SHT11 Module
Special Olympics Polar Bear Plunge, Mar 20, 2010
Dave