Matching PIC memory and program size?


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2006
    Location
    Isle of Man
    Posts
    32

    Cool Matching PIC memory and program size?

    I need help in understanding how to select a PIC with the flash program memory size to accommodate my PBP-compiled programs.

    For example, Microcode Studio tells me that one of my small programs for the 16F877 compiles to 377 words, while Windows Explorer gives the HEX file size as 2.14K. Once the project is completed, I want to choose a device with minimal size and cost to fit the code.

    In general, how do you understand each of these memory sizes, and then choose a suitable PIC device?

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    The number you get from Microcode Studio is the more accurate. The .HEX file is in Intel Hex format, which is an ASCII representation of the binary source.
    A 512 byte or 1K byte PIC should easily hold your code.

    If you want to find out what that .HEX file really contains (as well as the load addresses of the code), you can decode the .HEX file according to the rules given at:

    www.cs.net/lucid/intel.htm
    Charles Linquist

  3. #3
    Join Date
    Feb 2006
    Location
    Isle of Man
    Posts
    32


    Did you find this post helpful? Yes | No

    Cool Matching PIC memory and program size

    Thanks for the clues, Charles.

    However, I am still a little bit confused. For example, suppose I change to a 16F676, which the data sheet says has "1024 Flash Words" of program space. Do these WORDS equate with the WORDS given by Microcode Studio?

    It is a pity that this is not properly explained in any of the MCS or PBP documentation and that MCS (or my MEL chip programmer) does not give the % space remaining or used in the device selected.

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


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by manxman
    Do these WORDS equate with the WORDS given by Microcode Studio?
    Yes, pls refer to the picture.

    The word size of a PIC should match (or stay lower) then the word size that your compiler compiles for you.

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

  5. #5
    Join Date
    Feb 2006
    Location
    Isle of Man
    Posts
    32


    Did you find this post helpful? Yes | No

    Cool PIC Program size

    Many thanks Sayzer and Charles for the final WORD (!). All clear now. I can now program a device until it (almost) bursts.

  6. #6
    Corona's Avatar
    Corona Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Sayzer
    The word size of a PIC should match (or stay lower) then the word size that your compiler compiles for you.
    Methinks you mean the capacity of the PIC should be HIGHER than the compiled code size...in words

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


    Did you find this post helpful? Yes | No

    Smile Looking at the mirror from the other side.

    Yes, actually I stated it from the other side.

    You are right Corona.

    PIC capacity should be higher.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  8. #8
    Corona's Avatar
    Corona Guest


    Did you find this post helpful? Yes | No

    Default

    no problem

    I've found that soon after using the MIN / MAX PICBasic functions, I get confused over Up/Down Right/Wrong myself

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


    Did you find this post helpful? Yes | No

    Default

    Also take a look at this post here:

    Word sizes for the same code but for different PICs are also different.


    http://www.picbasic.co.uk/forum/showthread.php?t=3548
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

Similar Threads

  1. Presetting Configuration Fuses (PIC Defines) into your Program
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 82
    Last Post: - 15th December 2013, 09:54
  2. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  3. Which pic has a big flash program memory?
    By amindzo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 1st November 2006, 19:35
  4. program memory size
    By volcane in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 25th October 2005, 19:45
  5. size of program vs mem on pic
    By PICMAN in forum General
    Replies: 1
    Last Post: - 1st March 2005, 17:23

Members who have read this thread : 1

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