PDA

View Full Version : Error 126 Out of Variable



silverback
02-28-2010, 11:16 AM
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.

Franklin
02-28-2010, 01:05 PM
www.parallax.com/tabid/436/Default.aspx (http://www.parallax.com/tabid/436/Default.aspx)
26 variables

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

W9GFO
02-28-2010, 01:27 PM
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. (http://www.gadgetgangster.com/206)

davejames
02-28-2010, 01:48 PM
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

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

silverback
02-28-2010, 09:35 PM
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.

W9GFO
03-01-2010, 01:37 AM
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. (http://www.gadgetgangster.com/206)

legoman132
03-01-2010, 02:38 AM
Use the EEPROM for data storage (amount of space depends on size of program)

Mike Green
03-01-2010, 02:59 AM
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.

silverback
03-01-2010, 10:19 AM
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

W9GFO
03-01-2010, 03:02 PM
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. (http://www.gadgetgangster.com/206)

silverback
03-02-2010, 07:25 AM
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.