Menu

Error: Program is too large, cannot fit all subroutines into available program memory

Help
2016-12-06
2016-12-06
  • Edward LaBudde

    Edward LaBudde - 2016-12-06

    Hi All I need more help from you Great Cow Boys. I get this message when I try to compile. However if I change the chip to a 18F2455 it compiles, they both have about the same memory. Thanks, Ed. I will post a link to the code in next post.

     
  • Edward LaBudde

    Edward LaBudde - 2016-12-06

    Code:

     
  • Anobium

    Anobium - 2016-12-06

    16f and 18f have different memory architectures. I am sure others will go into more detail but 18f is a flat memory model and the 16f is a paged memory model.

    Putting code into 18f is essentially sequential. Putting same code in 16f requires the code to be placed in pages and that means that no routine can exceed the page size and therefore you can have memory within a page that is not used.

    The main cause of the memory usage... these ** Load12_AmpsMax = (Load12_AmpsMax - L12_amp_OS)1023/(1023-L12_amp_OS)15** methods... I change to function. You are essentially repeating the method over and over and over again - use a function.

     
  • Edward LaBudde

    Edward LaBudde - 2016-12-06

    Evan, Thanks. In this application only the average and maximum load current is important to record. If I remove the minimum block it complies OK, Thanks again, Ed.

     
    • Anobium

      Anobium - 2016-12-06

      Load10_AmpsMax = (Load10_AmpsMax - L10_amp_OS)1023/(1023-L10_amp_OS)15

      The really should be function =1023 will use a lot of memory. Change that bit to a function. And, the 15 that could be a function also.

      The code fits into 16f. I added one function.

      14.1 Sec. Compiler Version: 0.95.010 2016-10-28 Program Memory: 6143/16384 words (37.49%) RAM: 219/1024 bytes (21.39%) Chip: 16F1938

       'lots and lots.... I now call T15 todo the *15
       '''code
       ''' ....
        Load12_AmpsMin = T15(Load12_AmpsMin - L12_amp_OS)*1023/(1023-L12_amp_OS)
      End Function
      
      Function T15 ( tt as long )
      
        t15 = tt * 15
      
      End function
      
       

      Last edit: Anobium 2016-12-06

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.