EEPROM

gdenehy

Member
Is there somewhere on the picaxe that I can store data that stays there when the power is off or the picaxe is reset.

This is data that the program must change on the fly, but then store there.
 

westaust55

Moderator
YES

All PICAXE chips have EEPROM that can be used as you seek.
On smaller PICAXE such as the 08MM the EEPROM is the same area as for the program - they data and program areas are shared.

Larger PICAXE chips have separate EEPROM areas.

Have a read at the EEPROM, READ and WRITE commands in the PICAXE Manual part 2.

How often are you looking to change the values you store in EEPROM?
There limits to the number of time that data can be written tio EEPROM - you can read as often as you wish.
Microchip datasheets indicate 1,000,000 write cycles for EEPROM life.
 
Last edited:

yurif74

New Member
hi, i'm a little confused about that eeprom, i mean, you know that x2 parts have 4 program slots;
is the data memory unique for each slot? or is it shared?
the table memory (that share with program memory) is unique for each slot? or is it shared and if is shared what program slot it use?

another thing: x2 parts have 4096 bytes of ram, is it total ram or ram available for each slot? (total of 16384 bytes)

the manual says:
>#slot number
>Select the internal program slot (0-3) or i2c program slot (4-7) on X2 parts

what it mean? how the program slots 4-7 can be accessed? where are they stored?

i know.. a lot of questions... please help!
bye
 

hippy

Ex-Staff (retired)
Welcome to the PICAXE forum.

The PICAXE X2's have variety of types of memory ...

Variables (RAM)
Data Ram (RAM)
Scratchpad (RAM)
Data Eeprom (internal Eeprom)
Program Storage (Flash)
Table Data (Flash)
Access to External I2C Eeprom (external Eeprom)

Both Program Flash and External I2C Eeprom can store program code. These are stored in 'Slots'. Slots 0-3 are held in Internal Flash, Slots 4 and upwards are held in External I2C Eeprom. How many of slot 0-3 are available depends on the particular X2; 20X2 has just Slot 0, 28X2 and 40X2 have Slots 0 to 3.

Variables, Data Ram, Scratchpad and Data Eeprom are a common resource, one set, regardless of number of slots, shared by all program slots.

Table Data, I believe, is per slot. Thus a READTABLE in one slot will get data from its own TABLE data, another program in a different slot from its own TABLE data.
 

hippy

Ex-Staff (retired)
ReadTable is unique for each slot ...

Code:
#Picaxe 28X2
#Terminal 9600
#Slot 0
Table  ( "Table  = I'm in slot #0", CR, LF )
Eeprom ( "Eeprom = I'm in slot #0", CR, LF )
b0 = 0
Do
  ReadTable b0,b1
  SerTxd( b1 )
  b0 = b0+1
Loop Until b1 = LF
b0 = 0
Do
  Read b0,b1
  SerTxd( b1 )
  b0 = b0+1
Loop Until b1 = LF
Run 1
Code:
#Picaxe 28X2
#Terminal 9600
#Slot 1
Table  ( "Table  = I'm in slot #1", CR, LF )
Eeprom ( "Eeprom = I'm in slot #1", CR, LF )
b0 = 0
Do
  ReadTable b0,b1
  SerTxd( b1 )
  b0 = b0+1
Loop Until b1 = LF
b0 = 0
Do
  Read b0,b1
  SerTxd( b1 )
  b0 = b0+1
Loop Until b1 = LF
Run 0
If Slot 0 is downloaded before Slot 1 you'll see ...

Table = I'm in slot #0
Eeprom = I'm in slot #1
Table = I'm in slot #1
Eeprom = I'm in slot #1
Table = I'm in slot #0
Eeprom = I'm in slot #1
etc

If Slot 1 is downloaded before Slot 0 you'll see ...

Table = I'm in slot #0
Eeprom = I'm in slot #0
Table = I'm in slot #1
Eeprom = I'm in slot #0
Table = I'm in slot #0
Eeprom = I'm in slot #0
etc

The Eeprom in the last downloaded sets the shared Data Eeprom. Use #No_Data for downloads which want to leave Data Eeprom as it is or set by another slot program.
 
Last edited:

yurif74

New Member
thank you Hippy,
now it's almost clear to me, however reading through the entire manual there are no references on how store programs on external i2c eeprom (and how to execute it)
any help or examples?
i palyed around with command "RUN" and i found that accept a word as value, so "run 65535" is correct and is compiled correctly..
any information about that method of programming? it could be interesting in expand memory, but how's big each i2c slot?

thank you again
 
Top