PDA

View Full Version : unable to fit variable?



MOUNTAIN747
- 4th February 2010, 19:29
I want to write a program to transfer data to my offboard EEprom. My data to transfer is 111 bytes long. I am going to use a 16F877A. If I read the data sheet correctly, there should be 368 bytes of data memory. When I try to compile I get the message “Unable to fit variable ELoad”. Am I misinterpreting the data sheet? To test that this is a variable load problem I placed an END program after “ELoad VAR BYTE[111]” and compiled. The same error message occurs. Will someone please explain? I have searched for a discussion on this error only to find comments about 12F controllers or “If this occurs during compilation select another MCU with more general purpose RAM”. My program uses 119 bytes of general purpose data memory (I think) so why is an 877A coming up short? Question; does General Purpose Ram equate to device available Data Memory? Comments please!




Avar var byte ;General use variables
Bvar var byte
Cvar var byte
; 24LC02B EEPROM - I2C
dataEE var PORTB.4 ;EEPROM Data I2C
clkEE VAR PORTB.5 ;EEPROM Clock I2C
; RS232 LINK TO PC
RX_232 var PortC.7 ;rs232
TX_232 var PortC.6 ;rs232
; EEprom data
eload var byte[111]
;
; 16F887A has 368 bytes of Data Memory
eload[0]=$68
eload[1]=$68
-----
-----
-----
-----
eload[109]=$2A
eload[110]=$2B

LoadEE: ; FOR LOADING EXTERNAL EEPROM
bvar=0
For Avar = 100 TO 210
I2cWrite dataEE,clkEE,$A0, avar, [eload[bvar]]
Pause 10 ' Delay 10ms after each write
bvar=bvar+1
next avar
END

Darrel Taylor
- 4th February 2010, 19:37
For 16F's, Arrays must fit into a single BANK.
The largest BANK on a 16F877A has 96 bytes.

You could have 2 arrays of 96 bytes, another with 80, and yet another with what's left over in BANK0. But they can't be combined into 1 array.

hth,

MOUNTAIN747
- 4th February 2010, 19:52
Thanks Darrel, For some reason I thought PBP would take care of that. So if I make this two arrys PBP will take care of the banking. Is that correct?

Darrel Taylor
- 4th February 2010, 19:59
Correct!
<br>

MOUNTAIN747
- 4th February 2010, 20:20
Thanks Darrel, Your help is always appreciated!