Running Out of Programing Memory


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Do you have any programming tips that I can use?
    For an usefull answer you must post a sample of your code.

    Al.
    All progress began with an idea

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,144


    Did you find this post helpful? Yes | No

    Default

    Have a look here but be very carefull with direct ASM commands.

    http://www.rcfaq.com/PIC/optimize.htm#morefornext

    Ioannis

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


    Did you find this post helpful? Yes | No

    Question just to see what we are talking about ...

    Quote Originally Posted by aratti View Post
    For an usefull answer you must post a sample of your code.

    Al.
    + 500 !!!

    first: do you use V2.60 ??? ( some good " room saving " enhancements included )

    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 " !!!
    *****************************************

  4. #4
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Change the location of subroutines in the program.

    Also, if you are comparing bytes to words (or the other way), just compare the low.byte of the words.

    Also, if you are using AND, OR etc in the IF condition, remove them and use separate IF condition for each AND or OR.

    Also, if you are using an IF condition similar to the one as follows,
    IF a+b = c THEN x=y.
    Change it to something like
    temp = a+b
    IF temp = c THEN x =y

    _____________________________
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  5. #5
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Tip1.

    In your program you will probably have variables that are used often... put those variables in BANK ZERO...

    For example, you have a variable called CounterA, you would normally deline it as...

    CounterA var Byte Bank0

    ...all you have to do is change that to...

    CounterA var Byte Bank0

    I did that in one program and recovered close to 2K... so it's really worth doing.

    Eventually, you'll fill up Bank0 and can't fit any more variables into it, so there's a limit here, therefore pick the variables you use MOST OFTEN to go into Bank0.

    Come back and tell us how much you saved just by doing this...

    Tip2.

    Put your SUBROUTINES at the start of your program and your first instruction is a jump over them... eg GOTO START. The more commonly used subroutines and variables that you can stuff into the first Bank of Memory in your PIC the better for the overall compactness of your program when it starts to grow.

  6. #6
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    704


    Did you find this post helpful? Yes | No

    Default

    Hi,

    I will try all of your recomendations and will keep you posted.

    My program is 8100 words when compiled, that is closed to 40 pages if you print it out, so posting it in here would be too much.

    I am using PBP 2.50, and I don't know if that really makes a difference when compared to PBP 2.60.

    I will try Sayzer and Melanie recomendations and will keep you posted.

    Any other tips? Thank you,

    Robert

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


    Did you find this post helpful? Yes | No

    Lightbulb

    Hi, Robert

    A simple trick in the Manual ...

    disable the watchdog ... see CLRWDT command.

    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 " !!!
    *****************************************

  8. #8
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    968


    Did you find this post helpful? Yes | No

    Default

    One thing that will save you a lot of code is replacing repeated segments of code like for example - SEROUT ..... or LCDOUT. So, if you have a LCDOUT "Hello World" maybe 5 times in your code, it would be better to replace 4 of them with a gosub ShowHelloWorld and keep the LCDOUT "Hello World" in that subroutine.
    Last edited by Jerson; - 8th November 2009 at 02:34.

Similar Threads

  1. fatal error out of memory (pbpw.exe)
    By hardcore in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 14th March 2010, 19:13
  2. Need the code to write to a memory
    By Hamlet in forum General
    Replies: 0
    Last Post: - 20th August 2007, 00:22
  3. Replies: 4
    Last Post: - 2nd March 2007, 06:12
  4. sample code for M25P32
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th January 2007, 02:37
  5. Use internal program memory like DATA memory
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th December 2006, 18:38

Members who have read this thread : 0

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