Banks related to memory problem?


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: Banks related to memory problem?

    the strange thing is ...

    PBP states there is ( should be ? ) no problem with banks spanking with 18F devices ...

    PBP manual $ 2.6.2 :
    Arrays may span banks on PIC18 devices.
    On PIC18 devices, BYTE, WORD and LONG-sized arrays are only limited in length by the amount of available memory. The compiler will assure that arrays, as well as scalar variables, will fit in memory before successfully compiling.
    so, one also could have a look to $ 7.2 " Code Pages and RAM Banks" if some assembler coding is included somewhere ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  2. #2
    Join Date
    Jul 2013
    Posts
    6


    Did you find this post helpful? Yes | No

    Question Re: Banks related to memory problem?

    I am now able to share the code for debugging, so attached are the five .pbp files that go into this whole software. OACIS-Main is the main program and includes the other 4 codes. R134a_R404a_K contains the conversion table that was having problems disappearing before, but now that it is in bank 4, it is having no trouble.

    The new problem is the RPMAvg variable being lost (or one of the three variables that goes into calculating RPMAvg).

    Another thing I noticed is that I have an array of 166 longs for my temperature conversion table. This makes for 664 bytes and is way bigger than the theoretical maximum bank size of 256. Could this be causing the problem of kicking other variables out of memory?
    Attached Files Attached Files

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: Banks related to memory problem?

    I am more likely to be one of your customers than someone who can give you any meaningful help,BUT
    I sort of think the subroutines should endif before the return is called, so you do not overflow the stack. I might be wrong, but that is my thoughts.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: Banks related to memory problem?

    Yup, always end your IFs before returning.

    Robert

  5. #5
    Join Date
    Jul 2013
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: Banks related to memory problem?

    Thanks for your help.

    I am assuming you are talking about the cases below where this problem occurs?

    I found this problem to occur once in the OACIS-Main code:

    if fButtonHold = 1 then 'If a button is being held, return to prevent too quick button responses.

    if MenuPage = 8 and fHoldEnable = 1 then 'Or if we are on page 8 force the Valve on holds
    if RightButton = 0 then 'but only if the code was put in to enable forcing.
    pEvapEEV = 1
    pBuzzer = 1
    elseif LeftButton = 0 then
    pEvapEEV = 0
    pBuzzer = 1
    endif
    'Update the display to reflect forced valve
    hserout2[$FE, $47, 20, 2, dec1(pEvapEEV)]
    endif

    return
    endif



    And in three locations in the PCB6_3 Setup.txt:

    if(AOValue > 1023) then AOValue = 1023 ; limit value
    if(AOValue < 0) then AOValue = 0
    if(AOCh > 7) then return ; limit value
    if(AOCh < 0) then return

    EEWRITE:
    if(EEAddress > 131071) then EEAddress = 131071 ; limit value

    ....

    return


    EEREAD:
    if(EEAddress > 131071) then EEAddress = 131071 ; limit value

    ....

    return

    • I'll see what I can do to fix these and then get back to you guys with whether or not that fixed the problem.

      Thanks again.









    • #6
      Join Date
      Jan 2005
      Location
      Montreal, Quebec, Canada
      Posts
      3,172


      Did you find this post helpful? Yes | No

      Default Re: Banks related to memory problem?

      Does this work?
      Code:
      Routine:
      If bla bla then goto exitroutine
      Bla
      Bla
      Bla
      Endif
      
      Exitroutine:
      Return
      If you use this in multiple routines, then just suffix with a number so the labels are unique.
      Robert

    Similar Threads

    1. Replies: 10
      Last Post: - 11th October 2011, 07:01
    2. Memory Problem
      By morphyn in forum mel PIC BASIC Pro
      Replies: 1
      Last Post: - 18th February 2009, 21:59
    3. How to select timeout related to buadrate for HSERIN ?
      By grich in forum mel PIC BASIC Pro
      Replies: 3
      Last Post: - 7th May 2008, 17:19
    4. 18F out of memory problem
      By tom in forum mel PIC BASIC Pro
      Replies: 5
      Last Post: - 23rd January 2007, 06:58
    5. All USB related topics should be posted here
      By NavMicroSystems in forum USB
      Replies: 0
      Last Post: - 11th July 2005, 12:51

    Members who have read this thread : 0

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

    Tags for this Thread

    Posting Permissions

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