View Single Post
  #4   Spotlight this post!  
Unread 11-01-2007, 14:30
dcbrown dcbrown is offline
Registered User
AKA: Bud
no team
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Hollis,NH
Posts: 236
dcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud of
Re: How much memory is there really?

"You are only able to declare 256 bytes of variable space in any one MPLAB project file."

That is the default. The default is based upon the h/w architecture having 256 byte ram banks. PIC18F instructions have 8bit ram address offset hence the default of 256 byte banks. However, you can override by changing the setup in the lkr file.

This shouldn't be done lightly because it introduces more overhead in accessing data - but you essentially tell the linker to merge two adjacent ram banks and treat them in software as a single resource. Refer to the C18 user guide.

Changed 18f8722.lkr:
Code:
DATABANK   NAME=gpr2       START=0x200          END=0x2FF
DATABANK   NAME=grp3       START=0x300          END=0x3FF
DATABANK   NAME=gpr4       START=0x400          END=0x4FF
To:
Code:
DATABANK   NAME=gpr2       START=0x200          END=0x3FF
DATABANK   NAME=gpr4       START=0x400          END=0x4FF

created:
static unsigned char bigarray[500];

Build project, map file shows:

Code:
                 bigarray   0x000202       data     static user_routines.c
                           i   0x0003f6       data     static user_routines.c
x3f6-x202 = 500 byte array. Compiles/links/runs ok. I read about this in the C18 user guide somewhere. Currently only the "3.2.4 Managing the Software Stack" section jumps out at me - but it shows the steps for doing the same thing to create larger stack areas. Ram is a limited resource... use it wisely.

Bud

Last edited by dcbrown : 11-01-2007 at 14:34.