unable to fit variable?


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2009
    Location
    Alabama,USA
    Posts
    219

    Default unable to fit variable?

    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!

    Code:
     
    
    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

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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,
    DT

  3. #3
    Join Date
    Jan 2009
    Location
    Alabama,USA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Reply

    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?

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Correct!
    <br>
    DT

  5. #5
    Join Date
    Jan 2009
    Location
    Alabama,USA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Reply

    Thanks Darrel, Your help is always appreciated!

Similar Threads

  1. EEPROM Variables (EE_Vars.pbp)
    By Darrel Taylor in forum Code Examples
    Replies: 79
    Last Post: - 26th October 2012, 00:06
  2. Unable to pass a variable to LCDOUT without getting compile errors
    By Ferroto Baggins in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th February 2010, 16:43
  3. AT/PS2 Keybord - PIC Interface?
    By Kamikaze47 in forum Code Examples
    Replies: 73
    Last Post: - 9th August 2009, 16:10
  4. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  5. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts