Go to Post sometimes you have to dig through the trash and clean off the layers of dirt and grime in order to find diamonds in the rough. - Travis Hoffman [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

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-01-2004, 14:01
WizardOfAz's Avatar
WizardOfAz WizardOfAz is offline
Lead Mentor
AKA: Bill Bennett
FRC #1011 (CRUSH)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Tucson, AZ
Posts: 101
WizardOfAz will become famous soon enough
Send a message via AIM to WizardOfAz
memory management and organization

They say we only get 1800 bytes of variable space, but the chip has 2048 bytes of ram. Anybody know where the other 248 bytes went? I guess they are reserved for some special purposes, or already used up by the loader or other control functions, but if anybody knows the real answer, I'd like to hear it.

As I understand it, local variables and function parameters, unless declared static, are allocated on the software stack, which uses ram. This means the sum of all local vars and parameters for all functions on the call stack at any one time have to fit on the stack. The stack is 256 bytes in the default linker script (18F8520i.lkr), so seems like this could get used up real easy.

Anybody know what happens if you blow the stack? Does the PROGRAM STATE LED light up to warn you that it happened, or do you just start getting hard to explain bad behavior?

I get most of this, but if anyone would care to provide a good summary of how the various parts of ram are managed and tips and tricks for making good use of it, that would be great. Or pointers to where in the books to read, or white papers, or app notes, and so on.

Thanks
Bill
  #2   Spotlight this post!  
Unread 09-01-2004, 14:37
danielkitchener's Avatar
danielkitchener danielkitchener is offline
408 Computer Nerd
AKA: Daniel Kitchener
#0408 (Roboticks)
Team Role: Alumni
 
Join Date: Sep 2003
Rookie Year: 2001
Location: Pompano Beach, Fl
Posts: 52
danielkitchener is on a distinguished road
Re: memory management and organization

I believe the other 248 are to store our program on...however, I may be wrong. Hey, anything is better than PBASIC, and its small amount of space, less than 30 bytes...messed up a coupla good teams last year who decided to use counters for their autonomous, only to find it looping once the counter passed 254...
  #3   Spotlight this post!  
Unread 09-01-2004, 17:05
RoboCoder RoboCoder is offline
Registered User
#1002 (Circuit Runner)
 
Join Date: Jan 2003
Location: Wheeler High School, Marietta Ga
Posts: 65
RoboCoder is on a distinguished road
Send a message via AIM to RoboCoder Send a message via Yahoo to RoboCoder
Re: memory management and organization

last year, though there still was the option of using words, for example, as a variable data type. We used this as a counter for auton mode, and had no problems as far as that goes.
__________________
You might be an Engineering Major....

if you'll assume that a "horse" is a "sphere" in order to make the math easier

if you know vector calculus but you cant remember how to do long division

if it is sunny and 70 degrees outside, and you are working on a computer
  #4   Spotlight this post!  
Unread 09-01-2004, 17:18
Jay Lundy Jay Lundy is offline
Programmer/Driver 2001-2004
FRC #0254 (The Cheesy Poofs)
Team Role: Alumni
 
Join Date: Jun 2001
Rookie Year: 2001
Location: Berkeley, CA
Posts: 320
Jay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to all
Re: memory management and organization

RAM is 2048 bytes (8 banks at 256 bytes each), but 256 bytes of that are used for SFRs (special function registers). These things control the settings for all the functions on the processor.

96 bytes of bank 0 and 160 bytes of bank 15 are used for SFRs. That leaves us with 1792 bytes of variable space.
Closed Thread


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


All times are GMT -5. The time now is 00:32.

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