Here's the linker, and I have "Release" in MPLAB and #pragma config DEBUG = OFF in the C file. In the LKR I see: DATABANK NAME=gpr0 START=0x80 END=0xFF, and in the map, I think that area is assigned. Unfortunately the 1320 has only 256 data memory. I do have another option, though, but rather not go there - the PIC communicates with a PLC, and I could do the averaging/filtering there. // File: 18f1320_g.lkr // Generic linker script for the PIC18F1320 processor #DEFINE _CODEEND _DEBUGCODESTART - 1 #DEFINE _CEND _CODEEND + _DEBUGCODELEN #DEFINE _DATAEND _DEBUGDATASTART - 1 #DEFINE _DEND _DATAEND + _DEBUGDATALEN LIBPATH . #IFDEF _CRUNTIME FILES c018i.o FILES clib.lib FILES p18f1320.lib #FI #IFDEF _DEBUGCODESTART CODEPAGE NAME=page START=0x0 END=_CODEEND CODEPAGE NAME=debug START=_DEBUGCODESTART END=_CEND PROTECTED #ELSE CODEPAGE NAME=page START=0x0 END=0x1FFF #FI CODEPAGE NAME=idlocs START=0x200000 END=0x200007 PROTECTED CODEPAGE NAME=config START=0x300000 END=0x30000D PROTECTED CODEPAGE NAME=devid START=0x3FFFFE END=0x3FFFFF PROTECTED CODEPAGE NAME=eedata START=0xF00000 END=0xF000FF PROTECTED ACCESSBANK NAME=accessram START=0x0 END=0x7F #IFDEF _DEBUGDATASTART DATABANK NAME=gpr0 START=0x80 END=_DATAEND DATABANK NAME=dbgspr START=_DEBUGDATASTART END=_DEND PROTECTED #ELSE //no debug DATABANK NAME=gpr0 START=0x80 END=0xFF #FI ACCESSBANK NAME=accesssfr START=0xF80 END=0xFFF PROTECTED #DEFINE _SPECIALSIZE 0x40 - _DEBUGDATALEN #DEFINE _STACKSIZE _SPECIALSIZE / 2 #IFDEF _CRUNTIME SECTION NAME=CONFIG ROM=config #IFDEF _DEBUGDATASTART STACK SIZE=_STACKSIZE RAM=gpr0 #ELSE STACK SIZE=0x40 RAM=gpr0 #FI #FI Rolf wrote: > Carl Denk wrote: > >> I have an 18F1320 with a C18 program and MPLAB (latest version). The >> program has been running fine for several years, and recently I wanted >> to add software averaging/filtering to the 3 ADC inputs, which included >> declaring 3 int extern arrays [10]. Apparently I was just under the >> maximum data locations. The memory gauge shows 1683/4096 program and >> 152/256 data before any changes. It would seem that 256 - 152 = 104 >> would be sufficient, but even declaring one additional "int a[10]" array >> creates the ".udata_c018i.o' can not fit the section. Section >> '.udata_c018i.o' length=0x0000000a" error. I had been assuming that the >> memory usage gauge reflected the actual memory used, including those >> locations added by the compiling/assembling process, but after reviewing >> the map file, that does not appear to be the case. I thought the gauge >> info was generated at link time, and should include all the memory used. >> Is this a MPLAB error? >> >> I looked, but didn't find a replacement for the 18F1320 with more data >> memory, does anyone know of one? I use 3 ADC and the UART. Speed isn't a >> priority. Fitting the existing 18Dip is. I am going to study my code to >> see if I can optimize the memory usage, but doubt I can free up enough >> to do the job. I do put several initialized constants in code already. >> >> >> > Check the linker file for the sizes of the declared memory segments.... > > Common things I get wrong are things like using the 'debug' linker file > instead of the 'real' one. > > The linker declares various memory areas, and the memory declarations of > your program have to fit in to one memory segment. Changing your linker > script will likely resolve your problem... > > Rolf > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist