Shop OBEX P1 Docs P2 Docs Learn Events
Carrying Variables From One Program to Another — Parallax Forums

Carrying Variables From One Program to Another

KomaruKomaru Posts: 10
edited 2009-09-24 01:11 in Propeller 1
What I mean by "Carrying Variables" is for example, setting up a variable in one program, and then loading another EEPROM chip, then loading the previously set up variable for use in the second program. If not this, then something like modifying the variable from one program using another.
It sounds very unlikely, but I would just like to check to see if it's somehow possible, as it would be quite helpful in a project I'm working on.

Comments

  • localrogerlocalroger Posts: 3,452
    edited 2009-09-24 00:44
    You need to store the variable data externally, since the Prop's RAM is totally cleared on reset. An easy and cheap way to do this is to replace the 32K boot EEPROM with a 64K or larger EEPROM; I'm doing this right now for just this type of project. The "settings" object in the OBEX is a very complete solution for getting your data back after a reset.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-09-24 01:11
    Something else to consider ... You can use an AT24C1024B EEPROM which has 128K bytes of storage. The Propeller bootloader (and Propeller Tool) uses only the first 32K. There are a number of programs (like FemtoBasic and its variants) that allow you to copy a program to other 32K byte sections of a large EEPROM. You could keep something like FemtoBasic in the first 32K and two other programs in two 32K sections and have 32K left over for data storage. You can write a Basic program to act as a manager running first one 32K program, then another. When the program is done, it would return control to FemtoBasic which could use data in the 3rd 32K section to tell what to run next. You could also write your own Spin program to do the same thing since the EEPROM read / write / load routines are usable separately from the FemtoBasic interpreter.
Sign In or Register to comment.