How to use different Memory Slots in BS2P40?
we·have being using BS2P40 the new Chip for a long time, but now we are facing a problem that our EPROM is fulled. But as i know we haven't used our all 8 memory slots in our chip & still we don't know how to get it worked.
Eventhough we divided our full programme coding to two different files still we face problem in switching it from Slot0 to Slot1 &· vicevarsa
Some cases though we could switch it from Slot0 to Slot1, then we can't make it returned to Slot0 to Slot1 ..
so thats where the main problem for us.
If anyone has any idea of solving this matter please help me on this.
Thanks.
Eventhough we divided our full programme coding to two different files still we face problem in switching it from Slot0 to Slot1 &· vicevarsa

Some cases though we could switch it from Slot0 to Slot1, then we can't make it returned to Slot0 to Slot1 ..
so thats where the main problem for us.If anyone has any idea of solving this matter please help me on this.
Thanks.

Comments
http://forums.parallax.com/showthread.php?p=664324
and this one also:
http://forums.parallax.com/showthread.php?p=664914
edit: Maybe you should post your program also.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Rick
Post Edited (RDL2004) : 8/29/2007 10:32:49 PM GMT
and
www.emesystems.com/BS2SX.htm#Crossbank
Both have really good info about some neat tricks with multi-slot programs. These are written up for the BS2SX but the technique is identical for any of the multi-slot Stamps.
The most crucial thing to remember if you are using the "same" (i.e. persistent) variables from slot to slot is define them the same, and in the same order, in each program for each slot, otherwise the variables may "change value" when you switch slots.
Beyond that, if you put
RUN 0
in any code, anywhere, the program will go to slot 0 AND START AT THE BEGINNING. You must take this into account if you don't want any initialization (or start) routines to run more than once in slot 0.
Same goes for subsequent slots. You can make it somewhat easier by using slot 0 only for setup stuff, then go to the other slots (and don't come back), e.g.
'slot 0 code...
start:
'initialize a bunch of stuff
'more stuff
RUN 1 ' go to slot 1
'slot 1 code...
' do a bunch of stuff
RUN 2 ' go to slot 2
'slot 2 code...
'do a bunch of stuff
RUN 1 'go to slot 1 --- don't run slot 0 again because it's your "setup" slot
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
Run 0
Run 1
Run 2
Run 1
Does program execution start at the beginning of slot 1 upon execution of the last "Run 1"?
Thanks!
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
The simple answer is YES it does. However, you can certainly change that programatically through the use of PBASIC commands like ON...GOTO or BRANCH at the beginning of slots 1-N, having set the "offset variable" in the prior slot. Slot 0 is something of a special case.
At least that's how I do it, but there are probably other viable methods as well.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Got'cha! Simple solution!
Thanks.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
THISSLOT CON 2 '0..7 -- which slot is THIS initState VAR Byte 'remember that whatever vars you use, put them exactly the same way, same order in every slot program Start: 'upon reset or run (slot 0) or run (any slot), code *always* starts at the beginning initState.BIT0(THISSLOT) = 1 'set bit flag that this slot has "initialized" the first time ON 1 - initState.BIT0(THISSLOT) GOTO Main 'bit for this slot is 1, skip init stuff 'do initialization or setup stuff for this slot 'more stuff 'more stuff Main: 'you initialized first time, now you're just running 'program 'program SlotDone: RUN THISSLOT+1 'run next slot, or whatever END▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support