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
    Mar 2009
    Posts
    653

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

    I'm generally bemused wrt establishing what 'spec' PIC I need for my PICBAsic program. I guess this is becuase I've not really had to worry about it - I write a simple program, I then flash the PIC - it works.

    I'm using a 16f690, for no other reason than it came bundled with my Pickit2 programmer ('lethargy rules ok')....I'm now in a position where I'd like to knock up a few 'widgets', which will need a PIC....I see there are other lesser PICs that have the same functionality as the 16f690, but with less RAM. (PIC16F631/677/685/687/689)

    How can I establish what spec PIC I need (from a RAM perspective), for my modest program? (becuase saving some dosh on buying the PIC I can 'just' get away with is always welcome).

    Is there some way of establishing that the codespace/RAM for a given picbasic program/pic is say xx% utilized etc?
    Last edited by HankMcSpank; - 22nd June 2010 at 11:11.

  2. #2
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default

    Well first of all Microchip provide free samples in small quantities.
    I've received everything from pic32s to dsPic to 12C508s for free.

    You can only really tell how much RAM you need with trial and error where PBP is concerned.
    It's own asm routines added to your program to make the BASIC command lines work are
    never really seen without disassembly of the compiled program.

    That being said, it isn't too difficult to tell how much RAM you have LEFT on the chip you are using.
    Just define a bunch of useless variables before a critical variable is defined
    (one that the program will fail without).

    An array is good for this, just up the number of elements until no more can be assigned,
    then you know bank 0 is full, do it again to consume the rest of the space until the program fails.

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


    Did you find this post helpful? Yes | No

    Default

    Say you have your code working on the 690. Look at the *.lst file near the end and see how much of what the code uses. Then dig through the specs from other chips to see what one is large enough.
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Sep 2007
    Location
    USA, CA
    Posts
    271


    Did you find this post helpful? Yes | No

    Default

    I use MicroCode Studio Plus... I think it tells you the memory used in the Status Bar.

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


    Did you find this post helpful? Yes | No

    Default

    ...

    and MPLAB has the " memory usage gauge " ... in the " view " menu ...

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

  6. #6
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Firstly my apologies....I thought I'd thanked you all, just come back to this thread to find I hadn't so Thank You!

    Ok, so it seem 4096 words being used seems to be the 'significant' number wrt using a 16f690 ....anything more & I get compilation error messages.

    So I started commenting out a few lines of code to see which commands are eating the word count.

    By taking out about six (long) lines inserted randomly throughout my code as follows,.....

    Code:
    IF debug_active= 1 then DEBUG "below     pwm= ", DEC pwm_width," Target= ",DEC target," Sig= ", DEC signal_in, " Mode_status =", DEC mode, " On_Status = ", dec on_status, " AGC Status= ", dec Agc_on_status, 13, 10
    (debug_active is just variable I use to erhmm activate/deactivate debug info out the debug port/pin)

    ......the words count used in my program plummets from around 4080-ish to about 1700 words?!!!

    Can anyone explain why? (or have a good pop & accounting for the word plummet?!)

    & while I'm on, which are the most hungry commands from using up the word space?

    cheers,
    Hank.

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


    Did you find this post helpful? Yes | No

    Default

    You can play around with Darrels CodeSize program to find some answers. I am not sure why, but it looks like each letter you are printing to your serial port is 3 words long. If you can abbreviate, you will be able to save some space.

    Check out his code here: http://www.picbasic.co.uk/forum/cont...odeSize-Update

    Walter
    http://www.scalerobotics.com

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


    Did you find this post helpful? Yes | No

    Default

    I use MicroCode Studio Plus... I think it tells you the memory used in the Status Bar.

    Where? I don't see it.

  9. #9
    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
    Where? I don't see it.
    It tells you in the status bar, here. But you have to have it turned on with:
    Code:
    Define Measure 1
    (and include the include file, of course)

    Name:  Test2.JPG
Views: 1328
Size:  66.4 KB
    http://www.scalerobotics.com

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


    Did you find this post helpful? Yes | No

    Default

    Bottom left hand corner after you compile.

    Success:blablabla bytes used.
    Dave
    Always wear safety glasses while programming.

  11. #11
    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?

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