Go to Post Our Digital Sidecar can attract metal chips from distant planets. - electroken [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #11   Spotlight this post!  
Unread 02-12-2002, 01:55
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Re: Re: A couple of noodle scratchers

Quote:
Originally posted by Jnadke


One way to get around this is by loading the program into "slots". Read the manual for more details, but basically each slot has its own 26 bytes available to it. However, the data is not carried over from each slot.

Scratchpad RAM, however, is carried over.
Actually, the data is carried over between slots and all eight share a common 26 bytes of memory. The key is just making sure your variables "line-up" the same between slots. For example, if you have a byte variable named "myByte," you need to make sure it is in the same location in all slots if you want to access it in multiple programs.

The easiest way to do this is explicitly tell the PBASIC compiler where to put each variable. This can be done by making all variables "aliases" to the built-in, primitive ones (named b0-b25 and w0-w13). Note that these names do overlap. B0 and B1 are the two bytes of w0, b2 and b3 are the parts of w1, etc.

So far, I haven't seen a single program that was broken into multiple slots that couldn't have been done in a single slot. In fact, the only real advantage I see is that it could let you store different programs for different configurations (if your bot was modular), but even that can be done with a few well-placed "if" statements.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I'll delete this in a couple of hours. hixofthehood Chit-Chat 9 04-02-2003 23:26
couple of questions... archiver 2001 5 23-06-2002 22:48
A couple of problems I observed at the MAR archiver 2000 3 23-06-2002 22:27
Couple other thank yous Jason Haaga Thanks and/or Congrats 0 29-04-2002 03:29
A Couple Questions about Chairman's Award ben_whly Chairman's Award 4 26-01-2002 18:24


All times are GMT -5. The time now is 04:25.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi