Page 1 of 1

As eeprom know how many positions are left.

Posted: Tue May 25, 2010 3:51 pm
by pibepru
Hi all, anyone can tell me how I can know how much I have eeprom memory free.

Thanks

Re: As eeprom know how many positions are left.

Posted: Tue May 25, 2010 5:02 pm
by medelec35
Hello pibepru.
When you use the EEprom Component that should state how many bytes you have in total e.g 64 Bytes. I believe It does not work like ram or rom, since you need to state the address and byte. So only you can determine how how many bytes are left. E.g if writing a loop that is accessed 4 times and each time address 0 to 3 is assigned with a value then you know 64-4 bytes are left. I don't think the information is given on compiling since the eeprom is only accessed during running of code, therefore can't be a fixed allocated amount (like ram and rom). Hope I have made that clear,and I have got that right :P

Re: As eeprom know how many positions are left.

Posted: Tue May 25, 2010 10:28 pm
by pibepru
Madeles35 Hello, my problem is knowing that I have used memory locations in the code and which are free to not repeat in the code that somehow there has Flowcode registration which are used and those not??
Thanks for your help.


Hola madeles35, mi problema es saber que posiciones de memoria he utilizado en el codigo y cuales estan libres para no repetir en el codigo existe alguna manera que Flowcode tenga el registro de las que estan usadas y las que no????
Gracias por tu ayuda.

Re: As eeprom know how many positions are left.

Posted: Wed May 26, 2010 1:44 pm
by Benj
Hello,

You could use free allocation. Eg create a routine that reads each byte of the EEPROM. You would need a value to signify that a byte of the EEPROM memory is empty. It makes sense to make this 255 as the EEPROM will all revert to 255 when it is erased.

Eg

idx = -1
data = 255
while (idx < 64) && (data = 255) - this is if you have 64 bytes of EEPROM
{
idx = idx + 1
data = EEPROM Read (idx)
}

The downside of this would be that you will have to remember the index positions for each and every location you are freely assigning. You could do this in an array but for most programs hardcoding the assignments will more then do the job.

Re: As eeprom know how many positions are left.

Posted: Wed May 26, 2010 4:21 pm
by pibepru
Thank you very much for your help

Muchas gracias por vuestra ayuda.