Shop OBEX P1 Docs P2 Docs Learn Events
Accessing memory locations (2px) — Parallax Forums

Accessing memory locations (2px)

SN96SN96 Posts: 318
edited 2005-09-06 01:08 in BASIC Stamp
I have finished the book "What's a micro controller" using the Basic Stamp2. I want to get the Basic Stamp 2px next, but I was wondering how do you access each of the eight 2k memory slots when programming? Can someone give me a simple code example demonstrating the usage of say just two slots, going from one slot to the other?
·
Thanks
·
Mike

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-09-05 23:39
    Mike,
    ·· The command needed·is the RUN command.· STORE can also be used to affect which banks are used by READ/WRITE commands.· A simple bank switching program would be:
    '   {$STAMP BS2px, PROG2.bpx}
    '   {$PBASIC 2.5}
     
    DEBUG HOME, "HELLO, THIS IS THE FIRST PROGRAM SLOT!", CR
    PAUSE 1000
    RUN 1
    
    

    Below is PROG2.bpx
    '   {$STAMP BS2px}
    '   {$PBASIC 2.5}
     
    DEBUG "HELLO, THIS IS THE SECOND PROGRAM SLOT!", CR
    PAUSE 1000
    RUN 0
    
    

    This will alternate between slot 0 and slot 1.· Of course, a·good idea would be to read the Nuts & Volts article at the following link.

    http://www.parallax.com/dl/docs/cols/nv/vol3/col/nv87.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-09-06 00:05
    As Chris showed you, you can use RUN to jump from one slot to another. If you want to READ data from, or WRITE data to a slot different than the one you're currently running, use STORE to point READ and WRITE to that slot.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • SN96SN96 Posts: 318
    edited 2005-09-06 01:08
    Thanks! That help out more than you know. I needed to see a code example to help me understand better.

    Mike
Sign In or Register to comment.