Shop OBEX P1 Docs P2 Docs Learn Events
Expanding number of variables? — Parallax Forums

Expanding number of variables?

John MacJohn Mac Posts: 5
edited 2008-12-07 04:21 in BASIC Stamp
Is it possible to add RAM (or whatever it takes) to allow an increased number of variables on a BS2? With only 32 bytes (some of which are used for special registers), that leaves no room for arrays of any significant size.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-06 18:16
    There's no way to expand the variable storage area of any Stamp. The scratchpad RAM available in different sizes in most Stamp models other than the BS2 is often used for array type access. There are special statements (GET and PUT) used that work like an array that are used to access this area.

    You can add external memory like EEPROM or Ramtron's FRAM as I/O devices. There are some serial RAMs that use the SPI protocol that only require 3 I/O pins for access and work with the SHIFTIN / SHIFTOUT statements like any SPI device. Some of the real time clocks (RTCs) have battery backed RAM. A BS2 doesn't have built-in statements for things like EEPROM or FRAM or RTCs, but the other Stamp modules have the I2CIN and I2COUT statements which make it really easy to use these devices.

    If you really must have more RAM, you should consider the Propeller which has plenty.
  • John MacJohn Mac Posts: 5
    edited 2008-12-06 21:30
    OK Thanks

    26 bytes is awful limiting...so it's either a Propeller as you suggest or go entirely to PIC Micros.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-06 22:01
    You could also use an SX using SX/B for programming. The SX has more memory than the Stamps, about 250 bytes. Most of the Stamp models (other than the BS1 and BS2) use an SX for their microprocessor.
  • ZootZoot Posts: 2,227
    edited 2008-12-06 22:22
    Mike et al -- one clarification -- only the SX48/52 has that much RAM (16 banks of 16 registers). The SX20 and SX28 have 8 banks of 16 registers. And when using SX/B nearly two half-banks are "spoken for" for shadow registers, param variables, etc.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • $WMc%$WMc% Posts: 1,884
    edited 2008-12-07 01:57
    Mr.Green

    Why is it not possible to add RAM Mem. to the BS2 ?
    Is it the physical size of the Address# ?

    This is a very interesting POST

    _______$WMc%_______________Merry Xmas___

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-07 02:12
    The Stamps (all of them) have a Basic interpreter in them. The compiler for this Basic (the Stamp Editor), the interpreter (in the PIC or SX on-chip flash memory), and the interpretive code itself have no provisions for more than 26 bytes of variables. More space than that simply doesn't exist as far as Parallax Basic is concerned. There is the scratchpad RAM, but that's treated completely separately from the variables (with the GET / PUT statements). The chips themselves (the PICs and the SXs) also have no provisions for adding RAM. You can attach RAM as an I/O device (as you can with the Stamps), but it's not equivalent to the on-chip memory and can't be used the same way.
  • $WMc%$WMc% Posts: 1,884
    edited 2008-12-07 03:05
    Mr.Green

    I Thank You for the clarity . I now have a new understanding of how things work.
    This answers A lot of questions I've had


    ___Thanks_____$WMc%________Merry Xmas__

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there
  • John MacJohn Mac Posts: 5
    edited 2008-12-07 04:21
    Thanks Mike for the good info....appreciate it
Sign In or Register to comment.