Running code from a 24LC512

vshortt

Senior Member
Hello all,

I have seriously run out of space on one of my 20x2's. I've done everything I can to make sure I have squeezed every last bit out of it!

So my next questions is this: is it possible to run code from another chip? for example, if we have one chip talkting to a 24LC512 via the i2c bus, is it possible for the 20x2 to grab a chunk of code off the memorychip and run it?

If there are other ways to increase the code capacity of our beloved picaxes, please let me know!!
 

hippy

Ex-Staff (retired)
The X2's support RUN and BOOTI2C commands which can be used with external Eeprom while the 28X2 and 40X2 have multiple internal slots, but not the 20X2.

That may achieve what you want but you cannot simply GOSUB into another slot and RETURN back again.

Alternatively you could hold your own designed commands in I2C Eeprom which you run through which tells your program what it needs to do; your own interpreter written in PICAXE basic.
 

vshortt

Senior Member
Hippy,

I sure do wish I could use the Run slot command with the 20X2, but like you said it's not supported.

I'm not too terribly worried about being able to transport data back and forth between programs. If I do, I will just write the data to the memorty chip then snag it from the chip with the next program. Thats what I'm doing now accross two 20x2's and a single 24LC512.

If I'm reading the definitions right on the Booti2c command, it seems like this is only for updating the software on the Picaxe. are you suggesting that there's a way to use this command to retrieve and run a piece of code from the memory chip? I'm interested!!

Of course, the most basic question is: how in the world do I get the code ONTO the 24LC512? It's easy enough with the hi2cin and hi2cout commands to write and retrieve variable data, but how to do put a chunk of code on there? Even if you wanted to use the 24LC512 with the booti2c command, you'd have to have a way of getting the code onto the memory chip, so how do you go about doing that?
 

eclectic

Moderator
snip
Of course, the most basic question is: how in the world do I get the code ONTO the 24LC512? It's easy enough with the hi2cin and hi2cout commands to write and retrieve variable data, but how to do put a chunk of code on there? Even if you wanted to use the 24LC512 with the booti2c command, you'd have to have a way of getting the code onto the memory chip, so how do you go about doing that?
Try Man 2, p.7

#slot (4 and above)

e
 

vshortt

Senior Member
It's my understanding that if you run a program from an external slot (say Slot #4) - then the picaxe reserves the entire i2c bus for the reading of the program.


Running a program from external i2c has some restrictions
1) The i2c bus is reserved exclusively for the program reading
2) The i2c pins cannot be used for any other purpose
3) Any hardware i2c/spi commands are completely ignored
4) Program execution speed is reduced, due to the relatively slow speed of reading data from the external
24LC128
5) The external 24LC128 only stores the program memory space. Any download data memory information (ie
from the EEPROM command) is not stored externally. Read and write commands continue to act on the​
internal EEPROM data memory space.
If I am reading this correclty, that means that I can't have any other i2c devices on the bus right? For example, If I had a DS1307 on the i2c Bus and tried to run a program from Slot 4 on an external memory chip, I would no longer be able to access the DS1307. is this correct?
 

hippy

Ex-Staff (retired)
Yes, you've read that correctly.

There might be some further optimisation you could make to your 20X2 ( 10% isn't unusual and more can be clawed-back with a redesign ) and another alternative may be to off-load some processing into another PICAXE. It does depend on the application though.
 
Top