How do you BACK UP user input data when prop is turned off?
DavidM
Posts: 630
Hi,
How do you allow a user to input data and have the PROPELLER chip remember that data when the prop is turned off?
I understand that I load the chip with my spin code ( in the EPROM) , and that variables can be set/changed during execution, But in my current project I need the user to create/edit some data ( that is inputed via an LCD/ INPUT buttons) and have that data stored/changed, but especially kept when the prop is turned off
regards
Dave M
How do you allow a user to input data and have the PROPELLER chip remember that data when the prop is turned off?
I understand that I load the chip with my spin code ( in the EPROM) , and that variables can be set/changed during execution, But in my current project I need the user to create/edit some data ( that is inputed via an LCD/ INPUT buttons) and have that data stored/changed, but especially kept when the prop is turned off
regards
Dave M
Comments
Mahjongg
I need a little more info than that,
OK I can store the info in the area above 32k of the eprom. that good.
But what commands put the data in there ?
Dave M
Do the commands BYTEFILL, WORDFILL & LONGFILL serve this purpose?
I need only to store small values..
Dave M
One thing to watch-out for: when you re-program the PChip, it re-writes all of the EPROM. Actuall, having said that, it _may_ only be the first 32K that gets blatted - anyone know for sure?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheers,
Simon
BTW: I type as I'm thinking, so please don't take any offense at my writing style
www.norfolkhelicopterclub.co.uk
You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)
You comunicate with the EEPROM using I2C routines:
en.wikipedia.org/wiki/I2c
They are available in the objects exchange but also check out this thread:
http://forums.parallax.com/showthread.php?p=626983
Graham
Do the commands BYTEFILL, WORDFILL & LONGFILL do this?
Dave M
the commands BYTEFILL, WORDFILL & LONGFILL only work with RAM not the EPROM,
The eprom is connected to the PROP via an i2C line, So I need i2c code to read & rwrite to the eprom and I should use the BYTEFILL, WORDFILL & LONGFILL to modify the RAM with the data that is read.
Correct?
I have download the simple basic i2c spin code, I will have a read.
dave m
heres what I plan to doo
1) I2CSTART
2) I2C WRITE
3) I2CSTOP
When the user changes some data , that data will be written to the eprom after it is written to the main ram, then when the power is turned of then on again all of the eprom, including the user data is put into the main ram?
Is my understanding of this correct?
dave M
The First 32k of EEPROM is the data that gets loaded into RAM on startup. Any thing you write to the upper 32k while the prop is running using the I2C routines will be there when you reboot. Provided you wrote to EEPROM at addresses that are not being used by your main program, in which case your prop may excert unwanted behavior. As mentioned, if you have an EEPROM greater than 32k then writting to addresses above 32k will not be loaded into ram by the boot loader. You will have to use the I2C routines to get this data.
Regardless, If you do not have another prop or microcontroller on the I2C bus there is no way of loading EEPROM from the programming connection or alternate UART to another smart device. Loading of the EEPROM is done with the I2C only.
There may be devices EEPROM in nature that interface via a UART( Though I do not know of any).
MisRead your post Dave. No, just turning off and on will not place data that is in ram into your EEPROM. The I2C routines 1,2,and3 did that already. What you wrote with the routines will be loaded when you reboot.
Post Edited (bambino) : 3/14/2007 1:01:59 PM GMT
If you put your data in the first 32k of the eeprom then it will get loaded into the main RAM when the power is turned on but you will need to be careful not to over write your program. I'm not sure of the best way to code it without sitting down and thinking about it.
If you put your data in the eeprom beyond the first 32k then you can simply use the I2C routines again but this time you will read the data.
Graham
EEPROMs are a bit more complicated than Start/Write/Stop. You have to send an address to the EEPROM, then the data. If you're reading, you have to send the address, then reselect the device for a read transfer. Please use the routines in either "Basic I2C Driver" or in "i2c Object and examples" from the Propeller Object Exchange. These have specific routines for reading/writing EEPROM locations that take care of this detail.
If you only have 32K for a boot EEPROM as in the Demo Board, you can use the upper end of the EEPROM for data storage as long as you understand that the whole first 32K will be erased when you download a program using the Propeller Tool. If you have a Proto Board, there's a second 32K that is not touched unless you access it yourself. You can always add extra EEPROM either to the boot EEPROM I/O pins (28/29) or to any other pair of pins.
The first 32KB of EEPROM contains the exact image, bit-for-bit, that gets loaded into the 32KB SRAM on boot-up. So, you can make variables declared·by either VAR or DAT statements non-volatile by updating them at identical offsets in the EEPROM.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
That is a very good tips.
dro.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
in medio virtus
Owen
You can have two 24LC1024 (like the Hydra with its memory expansion card) for a total of 256K bytes. You can actually have up to eight 24LC512 because of the way the parts are wired for a total of 512K bytes.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
dave M
Why would you think that?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 3/14/2007 11:59:42 PM GMT
So does this mean that there are 32,000 memory locations/addresses, each 8 bits wide, within a 24LC256 EEPROM?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I stand on the shoulders of giants
Yes. Most 8-pin EEPROMs get their part numbers from the number of bits in the EEPROM even though they're organized as bytes so a 24LC256 as you've indicated is 32K x 8, similarly a 24LC512 is 64K x 8, and a 24LC1024 is 128K x 8.
For a simple solution, the simplest solution might be to add -another- EEPROM on a seperate pair of I/O pins, so your storage EEPROM has nothing to do with your boot EEPROM.
Another solution would be to use the same I2C interface, but use a second EEPROM with a different adress. For example, on a AT24C1024 pin 2 controls which "address" the memory chip is placed. For smaller EEPROM,s pins 1,2 and 3 are used.
I am not sure, but I think the simple boot I2C driver must be modified to drive more than one EEPROM, I think I read somewhere that it now "hard drives" the data and clock lines, instead of leaving them "open collector", so if your design does not use a pullup resistor on both the data line and clock lines, maybe you need to add them.
Perhaps Parallax, or somebody else, can write a comprehensive set of library routines to write/read from the memory above the 32K border, and place them in the library (and/or a "sticky thread"). It seems a lot of people are trying to use the EEPROM to add more than the available 32K of code, or to store data permanently.
It would be a valuable addition to the library, so that nobady has to "re-invent the wheel" each time when trying to do more with the EEPROM than just booting off it.
Mahjongg
As far as these routines are concerned, it doesn't matter whether you have an EEPROM larger than 32K x 8 or two or more EEPROMs on the same set of pins or on different sets of I/O pins. You don't need to have any EEPROM other than the boot EEPROM (see Chip's comment earlier).