Shop OBEX P1 Docs P2 Docs Learn Events
Error 126 Out of Variable — Parallax Forums

Error 126 Out of Variable

silverbacksilverback Posts: 40
edited 2010-03-02 00:25 in BASIC Stamp
What is the limit of Variables on a BS2?
can't find it in any of the help files

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If you convince yourself that something is impossible before you even try; you are sure to prove yourself right.

Comments

  • FranklinFranklin Posts: 4,747
    edited 2010-02-28 06:05
    www.parallax.com/tabid/436/Default.aspx
    26 variables

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • W9GFOW9GFO Posts: 4,010
    edited 2010-02-28 06:27
    13 Word sized or 26 Byte sized or 52 Nib sized or 208 Bit sized or some combination that add up to 26 bytes.

    Rich H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Simple Servo Tester, a kit from Gadget Gangster.
  • davejamesdavejames Posts: 4,047
    edited 2010-02-28 06:48
    Silver - check page 83 in the "BASIC Stamp Syntax and Reference Manual". Or look under "VAR" in the Editor help file.

    Table 4.2 (RAM Organization for all BS2 models) and its Note describe what's available. There are a total of 32 byte-size variables, 6 dedicated for I/O. That leaves 26 available to the user.


    Regards,

    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • silverbacksilverback Posts: 40
    edited 2010-02-28 14:35
    Thanks for the info.

    How do some of you get around this limitation?

    Here is the pseduo for the program I was wanting to make :

    take a total of 10 Ambiet light samples (5 left, 5 right (10 Word VAR)) rotating the BOEBot between each sample;
    then average each group (2 Word VAR (left Average, right Average)):

    take 10 light samples with the flashlight (10 Word Var (I could reuse first 10));
    the average each group (2 Word VAR):

    Use the 4 averaged VARS to create 2 Threshold levels (2 Word VAR):

    From there -
    the program takes RCTIME readings to control the servos (based on light readings compared to the averaged thresholds.)

    (this is a variation of Flashlight controlled Boebot (RCTIME) from the Robotics manual p210 (p224 PDF))

    At the bare medium I need 16 Word VARs to make this happen.

    Would Read\Write be a way to get the amounts of readings I want?

    The idea behind this program is that I wanted to make it possible to calibrate the boebot to different areas with different light levels without re-assigning constants.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If you convince yourself that something is impossible before you even try; you are sure to prove yourself right.
  • W9GFOW9GFO Posts: 4,010
    edited 2010-02-28 18:37
    silverback said...
    Thanks for the info.

    How do some of you get around this limitation?

    Create a VAR named workVal (name not important). Use this variable over and over again in your code anywhere that the value that it contains does not need to be retained.

    Rich H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Simple Servo Tester, a kit from Gadget Gangster.
  • legoman132legoman132 Posts: 87
    edited 2010-02-28 19:38
    Use the EEPROM for data storage (amount of space depends on size of program)
  • Mike GreenMike Green Posts: 23,101
    edited 2010-02-28 19:59
    You can use part of the EEPROM for data storage, but it will "wear out" eventually. Most EEPROMs are rated for about 100,000 write operations for any given location. Beyond that, they will eventually not be able to be written with the bits stuck at 1. If a given location is constantly being written, it doesn't take as long as you think to exceed that.
  • silverbacksilverback Posts: 40
    edited 2010-03-01 03:19
    Thanks for all the help.
    I got the program written, tested, and running.

    in14 is a tac button·to start·the configuration process.
    lights on 0 and 15 display operational states for testing without motors active
    11 and 10 is a bi-color led (Red\Green) to display ready state





    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If you convince yourself that something is impossible before you even try; you are sure to prove yourself right.

    Post Edited (silverback) : 3/1/2010 3:25:39 AM GMT
  • W9GFOW9GFO Posts: 4,010
    edited 2010-03-01 08:02
    It looks like you could replace leftAMbdata and rightAMbdata with a single "workVal" variable. You are only using it to store the value from the RCTime function and I don't see where it is used after that.

    Also, I would think that you could scale the other variables. Do you really need them to be Word sized?

    Rich H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Simple Servo Tester, a kit from Gadget Gangster.
  • silverbacksilverback Posts: 40
    edited 2010-03-02 00:25
    W9GFO- Yep, you are right, I can condense leftAMBdata and rightAMBData into one reuseable var.
    As far as Word VARS, I think I wanted cover my bases for really low light areas, On testing I got a reading of 1000 on one of the RCTime functions. But I would think that thresholds could be reduced to a byte.

    Think I am going to trim up the program and add some extra error checking and ambient samples when establishing the Threshold.
    thanks for the input.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If you convince yourself that something is impossible before you even try; you are sure to prove yourself right.
Sign In or Register to comment.