Shop OBEX P1 Docs P2 Docs Learn Events
Not seeing any extra memory space with BS2px24? — Parallax Forums

Not seeing any extra memory space with BS2px24?

BigMikeBigMike Posts: 34
edited 2009-02-08 16:24 in BASIC Stamp
Hello Parallax,

It has been a very long time since I last posted here! Feels good to be back and building another project on my Stamp [noparse]:)[/noparse]

I recently wrote a program and completely ran out of memory for my BS2 Homework board.

So I purchased a BOE and a BS2px24 chip because it has more memory.

I changed ' {$STAMP BS2} to say ' {$STAMP BS2px}, but I still have the same memory issue.

When I compare the two memory maps, I notice there is no difference despite the px having more memory!

My Question: Is there some command needed to gain the additional memory of the px chip?

To be honest, I need a LOT more programming space. I am out of space on the BS2 homework board chip and my program is about 50% completed. [noparse]:([/noparse]

Thank you for your help!
Regards,
BigMike

Comments

  • BigMikeBigMike Posts: 34
    edited 2009-02-08 08:58
    I forgot to post the memory comparisions. I know this is common knowledge available at the main site, but I wanted to also post it here for reference:

    BS2:
    RAM: 32 Bytes
    Scratch Pad RAM: N/A
    EEPROM (Program) Size: 2K Bytes, ~500 instructions

    BS2px:
    RAM Size: 38 Bytes
    Scratch Pad RAM: 128 Bytes
    EEPROM (Program) Size: 8 x 2k Bytes, ~4000 instructions

    So it is very clear that the BS2px chip has 8 times more memory for program space, which is very, very good in my situation as this allows a lot of room to grow and expand beyond my projected use, but I can't seem to open up or unlock this space?

    Also, what is the scratch pad RAM? How can I access or unlock it?

    Thank you very much in advance!

    Regards,
    BigMike
  • MrBi11MrBi11 Posts: 117
    edited 2009-02-08 09:01
    You'll need to use different program slots.
    Break your program into different 'sections' that run independent of one another.
    [noparse][[/noparse]i.e. setup routine in one slot, 'run mode' in another]

    chip runs program in slot 0 first so this needs to be your master control.
    call other slots with the RUN x command where x is the desired slot.

    Scratch RAM uses the GET & PUT commands to access..

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Smile ... It increases your face value!

    Post Edited (MrBi11) : 2/8/2009 9:12:38 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2009-02-08 15:29
    There's a Nuts and Volts Column on multi-slot programming. Have a look at it. It explains the use of the additional memory pretty thoroughly. Go to the main Parallax webpage and click on the Resources tab and you'll see a link to the Nuts and Volts Columns index.
  • rixterrixter Posts: 95
    edited 2009-02-08 16:24
    BigMike,

    I recently was able to take advantage of the extra memory that the 2P series of BASIC Stamps provide and had to come to understand the methods for dealing with the extra features. I think the main things to understand are the difference between memory as used for your program and memory as used for variables and/or data. The beauty I found with the program slots as used for your programs is that you get a fresh set of variable space. For my particular program, this was a big bonus. As Mrbi11 points out, you have a "control" program (or menu in my case), in the first slot (zero), and you can jump to the other slots with the SLOT command. If you need to pass variables back and forth between program slots, you could use either RAM or EEPROM. Understand that RAM will be erased on reset of the Stamp and EEPROM will remain until over-written. But EEPROM writes have a limit. Choose which works best for your application.

    Accessing EEPROM in the slots is another story. That is accomplished with the STORE command, followed by READ and WRITE commands. This can be done from ANY slot that your currently running program may be operating in. The biggest challenge I faced was trying to see memory as one continuous entity for my application because physically, it is broken up into those slots of 2K each..... 8 x 2K in the case of most 2Ps and 16 x 2K in the case of the BS2pe that I have. Parallax has some examples of how to view this as a contiguous storage area and I've adopted something similar that is customized for my particular application. Basically you need to have an algorithm that determines what slot a particular memory location would fall in. In my case I maintain two Word variables... one named rmem (real memory) and one named vmem (virtual memory). In a BS 2pe you have 32768 bytes of EEPROM memory. There is your "virtual" memory. But you can't access memory locations greater than 2047. You must first specify the slot with the STORE command, then access memory locations 0-2047 in that slot.

    It's a wonderful thing once you understand it.

    Good luck!

    Rick
Sign In or Register to comment.