As eeprom know how many positions are left.

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
pibepru
Posts: 7
Joined: Fri Nov 20, 2009 10:40 am

As eeprom know how many positions are left.

Post by pibepru »

Hi all, anyone can tell me how I can know how much I have eeprom memory free.

Thanks

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: As eeprom know how many positions are left.

Post 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
Martin

pibepru
Posts: 7
Joined: Fri Nov 20, 2009 10:40 am

Re: As eeprom know how many positions are left.

Post 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.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: As eeprom know how many positions are left.

Post 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.

pibepru
Posts: 7
Joined: Fri Nov 20, 2009 10:40 am

Re: As eeprom know how many positions are left.

Post by pibepru »

Thank you very much for your help

Muchas gracias por vuestra ayuda.

Post Reply