How can I establish what RAM I need...and therefore which PIC.


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Red face

    Oh, there it is! That's telling you how much flash/program memory you're using, right? Is there a way to see or monitor your RAM useage?

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by circuitpro View Post
    Oh, there it is! That's telling you how much flash/program memory you're using, right? Is there a way to see or monitor your RAM useage?
    That's right, its program data not RAM. Unfortunately I do not know of a clean way to read how much ram you are using. But someone taught me a trick of:
    Code:
    test var byte[96]
    And if it is too big to fit, make it smaller. The size allowed in the program will be the amount of RAM you have left.
    http://www.scalerobotics.com

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    http://www.picbasic.co.uk/forum/showthread.php?t=10381
    Talks about RAM.
    I never did fix the little program in the thread though
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Hi Hank,
    Each character within double quotes of the debug statement eats three bytes of program memory. Counting the number of characters in that single line you posted makes for 70 characters or 210 bytes worth of program space.

    The Debug statement itself seems to eat 52 bytes but it's a "one time deal" ie, it doesn't cost you 52 bytes each time you use DEBUG. (It might cost you a byte or two depending on where in the program they are placed.)

    There may be ways around this (search for Strings in codespace) but if you just need "a couple" of more bytes then try to reduce the number of characters in your DEBUG statements.

    If you do look at the Strings in codespace threads I'd be interested in what you come up with. I'm pretty much having the same issue but using ArrayWrite. The problem with Strings in codespace are they are strings (constants) and I haven't yet figured out how to mix them with numeric values "printed" with the DEC modifier etc.

    /Henrik.

  5. #5
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by HenrikOlsson View Post
    Hi Hank,
    Each character within double quotes of the debug statement eats three bytes of program memory. Counting the number of characters in that single line you posted makes for 70 characters or 210 bytes worth of program space.

    The Debug statement itself seems to eat 52 bytes but it's a "one time deal" ie, it doesn't cost you 52 bytes each time you use DEBUG. (It might cost you a byte or two depending on where in the program they are placed.)


    /Henrik.
    Thanks (& to all the others) I was figuring it must the the monster amount of characters I'm using upo in the debug lines - the problem I have is I need to see a fair amount of data as my program works it's way back & forward....abbreviations become awkward to interpret with such a lot of onscreen info - I guess I could always go & make sure all the debug output columns align & put a bit of paper along the top of my screen with what each column means!

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Hi Hank,
    Instead of using a bunch of spaces have you tried "lining up" you columns by sending the ASCII code for TAB, I think it's 9, that might save a couple of bytes here and there.

    Another option worth looking into is to use the REP modifier, these two lines:
    Code:
    DEBUG "Ten spaces to follow:          ", 13, 10 
    DEBUG "Ten spaces to follow:", REP " "\10, 13, 10
    Prints the same thing on the screen but the second takes up 6 bytes less space. Obviosuly there's a break-even point where the extra codespace needed by REP eats up more than simply spelling out the repeated characters but you get the idea.

    Good luck!
    /Henrik.
    Last edited by HenrikOlsson; - 17th August 2010 at 21:19.

  7. #7
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by HenrikOlsson View Post
    Hi Hank,
    Instead of using a bunch of spaces have you tried "lining up" you columns by sending the ASCII code for TAB, I think it's 9, that might save a couple of bytes here and there.

    Good luck!
    /Henrik.
    Just to give some feedback here - a judiscious amount of abbreviating in my original unfeasibly long debug line, coupled with use of Henrik's tab idea above - ie of boshing in a load of ,9, entries throughout debug the line vs the spaces I was using (which is also superb for lining all the onscreen info up - much easier on the eye) has seen my program wordcount plummet - (from about 4080 to circa 2200) I'm chuffed to bits.

    My Uart 'VT' is somewhat irritatinlgy outputting a line with corrupt characters every 7-10 lines - could this be because my program uses two interupts ....thereby garbling the serial data a little?
    Last edited by HankMcSpank; - 19th August 2010 at 10:44.

  8. #8
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Talking

    Very nice tool, Dave. Thanks very much!

  9. #9
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by circuitpro View Post
    Very nice tool, Dave. Thanks very much!
    I guess I should try to fix it. But read Darrel's comments and you will get the idea of the problem.
    Dave
    Always wear safety glasses while programming.

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