Thread: Select Memory
View Single Post
  #2   Spotlight this post!  
Unread 05-02-2003, 15:23
Skabana159's Avatar
Skabana159 Skabana159 is offline
Robotics and Field Hockey
AKA: Jesse C. Owens
#0159 (Alpine Robotics)
Team Role: Mentor
 
Join Date: Mar 2002
Rookie Year: 2000
Location: Ft. Collins, CO
Posts: 92
Skabana159 is on a distinguished road
Send a message via AIM to Skabana159
Well, in autonomous mode, be aware that the switches must be attached to the RC, not the OI.
But yes, you can have up to 8 different programs on the stamp (0-7). Slot 0 is always run by default first, so you will need to serin your switches, and depending on input, you can run any of the slots. You run a program in a different slot with the command "run." You set different files into your slots by having them all open in the editor, and making your directive comment look like this:

'{Stamp BS2SX, slot1filename.bsx, slot2filename.bsx ...}
This will go in your program for slot 0, and all the ones in the list will fill up 1-7.

Let's say that you have your slot 0, with all the fancy initialization code, and you have two different autonomous programs, in slots 1 and 2. Then, you have your driver-control program in slot 3.

if auto_mode = 0 then run 3
if rc_sw1 = 1 then run 1
if rc_sw2 = 1 then run 2

In all of your slots, you should always check for auto_mode, because you want driver control to return as soon as possible. This should always be your first thought in all your programs.

Also remember that your 26 bytes of variable memory are shared between all of your slots. If you declare all of them in the same order, their values will be preserved. Otherwise, you must assume that they are chaos at the begining of each slot. I recommend that you find out which variables must be in all slots, and declare them all at the beginning of each slot. Then you can declare independent variables after those.
__________________
"What most people do not understand is that the Buddha, the Godhead, resides just as comfortably in gears and circuits as in hills and trees. To believe otherwise is to dilute the Godhead."
-Robert Pirsig, Zen and the Art of Motorcycle Maintenance

Last edited by Skabana159 : 05-02-2003 at 15:25.