Shop OBEX P1 Docs P2 Docs Learn Events
I need more programming space! — Parallax Forums

I need more programming space!

everesteverest Posts: 141
edited 2009-06-01 17:33 in BASIC Stamp
Hello,

I desperately need more programming space for my project. . .I'm currently using a BS2. . .is a BS2e pretty much just like a BS2 but with more programming space? I can't really tell from the descriptions. Thanks!

-Jeff

Comments

  • everesteverest Posts: 141
    edited 2009-06-01 02:43
    Actually, to be very specific, I also need more variable space. . .I'm completely out of space apparently, and that's just on one of the two programs I need to run! I have plenty of IO pins though. . .just not enough space!
  • SRLMSRLM Posts: 5,045
    edited 2009-06-01 02:51
    Yes, the BS2e is essentially just a BS2 with more RAM and EEPROM. You can't declare more variables, but you can store values in SCRAM and use aliases. Side note, but it's my favorite BS2 variant... [noparse]:)[/noparse]

    If you don't want to change modules I suggest that you post your code (as an attachment) and get feedback on how to make it more efficient.
  • xanatosxanatos Posts: 1,120
    edited 2009-06-01 02:54
    Try something like the BS2sx - it has 8 x 2k (that's eight separate 2k memories - each can run a separate program, and you can run one program from another with the RUN command (actually, it more effectively transfers control from one program to the other).· There is a 64 bit scratchpad ram in it so you can load values into it from one program to read from the next.· I love the BS2sx's - they're great!

    Be aware, if you go this route - that there are some timing and pulsing issues as the sx runs a 50mHz clock, while the regular old BS2 runs a 20mHz clock.·

    Hope this helps!

    Dave X

    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-01 02:54
    There is only 26 bytes of variable space in any of the Stamp models. What you have to do is to share the same variables in different parts of your program. Read the section of the Stamp Basic Syntax and Reference Manual on memory allocation and aliases for a description and examples of how to reuse the same variables under different names. You might also look at how to use bytes instead of words, nibbles instead of bytes, and bits instead of nibbles for cases where the value will fit in the smaller space.

    The Stamps other than the BS1 and BS2 come with what's called Scratchpad RAM. This is extra memory, but it can't be used as variables. The GET and PUT statements and one "formatter" (STR) are used to access it. The Manual has chapters on GET / PUT / SERIN you should read.
  • everesteverest Posts: 141
    edited 2009-06-01 02:59
    Thanks guys. . .I'll look into "recycling" variables. . .that probably would solve my problem in terms of number of variables. The ability to run multiple programs is perfect. . .I actually have two specific programs I need to run and they could just ping pong back and forth, with the one writing some data to scratch memory that the other could look at to see what the results were. Thanks!

    My code is ridiculously inefficient I'm sure. . .I'd be embarrassed to post it until I've taken a shot at optimizing it myself. I'll post it in a few days and see if anyone has comments to help me continue to learn. Thanks!

    -Jeff
  • everesteverest Posts: 141
    edited 2009-06-01 03:42
    Actually no need to optimize. . .I really only need one variable, a Bit to pass back and forth and I can recycle 100% of the variable otherwise. . .so I think a BS2e is in my immediate future. . .

    Does the BS2e require a different compiler? How do you push in two different pieces of code?

    -Jeff
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-01 04:03
    It's the same Stamp Editor for all the Stamp models. There's a compiler directive that tells it which model you're using. Read the Stamp Basic Syntax and Reference Manual for details. The Manual also tells you how to make a multi-slot program. There's also a Nuts and Volts Column (#87) on the subject. www.parallax.com/Resources/NutsVoltsColumns/tabid/272/Default.aspx
  • everesteverest Posts: 141
    edited 2009-06-01 14:56
    Thanks Mike!! Perfect!

    Last question. . .will the new stamp module drop into my BoE?

    -Jeff
  • SRLMSRLM Posts: 5,045
    edited 2009-06-01 16:00
    Yes.
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2009-06-01 17:33
    Jeff, Also consider the BS2pe. It has twice as much scratchpad RAM as the BS2e, and it also has a lot of additional commands like those that allow much easier and more efficient interface to I2C sensors, and those that allow for easy cross-slot data logging in the expanded EEPROM.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.