Code space needed with MPASM??


Closed Thread
Results 1 to 6 of 6
  1. #1

    Default Code space needed with MPASM??

    I have a program that runs in a 16F877A and I want to replace the microcontroller with an 18F4550 to get more code space for extra features.

    The 877A assembled with PM takes a code space of 6567 words.
    The 877A assembled with MPASMWIN takes 6565 words.
    The 18F4550 assembled with MPASMWIN takes 10950 bytes. (Does this mean 5,475 words or 10950 words??)

    MCS+ reports program memory used for the 877A in words but MCS+ reports memory used in the 4550 in bytes. Do they really mean bytes?? I would have thought it meaningless to report the number of 16 bit program instructions needed in bytes.

    How can I quickly tell if the 4550 program really takes 5475 or 10950 words of program memory?

    Cheers
    Brian

  2. #2


    Did you find this post helpful? Yes | No

    Default The 18F4550 looks to be smaller code

    Using the same program, I checked the .HEX file made by MPASMWIN for both the 877A and the 4550 micros. The .HEX for the 877A was 37K and the .HEX for the 4550 was 31K.

    37 * 5475/6565 = 31 close enough.

    I guess MCS+ really does report in BYTES used for program memory with some microcontrollers and in WORDS for others - watch out.

    Brian

  3. #3
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Maybe this?

    If you want to change from a 877A to something bigger you should consider the 18F4620 since it shares the pinout. Just plug that PIC in the same place as the 877A and adjust the code for the PIC registers and you are up and running. It doesnt hurt either that it has bigger codespace than the 4550 unless USB is the extra feature you are looking for then you have to go for the 4550.


    /me

  4. #4


    Did you find this post helpful? Yes | No

    Default 4550 vs 4620

    Good suggestion Jumper however I work at an Australian university, all of which have suffered savage government funding cuts over the last ten years. I have 100 of the 18F4550 from another department available and the project cost is already too high. The PCBs have been ordered and the 4550 is pin for pin except RC3 which is not used in this design.

    I intend to make the 4620 the 'standard' microcontroller here as I can then retrofit numerous projects with extra features and relax about tight memory for future projects.


    Brian

  5. #5
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by BrianT View Post
    I guess MCS+ really does report in BYTES used for program memory with some microcontrollers and in WORDS for others - watch out.
    Nothing random going on – see the datasheet for the PIC in question (usually the first table in the datasheet)

    18F's have 16 bit wide instructions, which are reported as 2 bytes per 16 bit instruction.

    16F's and lower have 14 (or 12) bit wide instructions, which are reported as 1 word per 14 (or 12) instruction.

    Yes, you can divide the 18F byte count by 2 to roughly compare to the 16F family.

    HTH
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  6. #6
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Why?

    Hi,

    Why do you plan to pick the 18F4620 as you future standard PIC? I would really consider choosing the 4550 for all things instead. Sure, you will get half as much memory as the 4620 but that would force the students to keep the code short and efficient. (and the option to in worst case plug in a 4620 to save the project)


    I think USB or Ethernet support is more the future and that would allow the students to make neat stuff and connect to other devices.

    Looking at the pricing at Microchips webpage you can see that the 4550 is around 4 USD, 4620 is 4.2 USD and PIC18F67J60 is 3.5 USD.... they are more or less the same price.

    Looking at performance the PIC18F67J60 stands out. Ethernet support, 128 kB Flash (2 times 4620 and 4 times 4550) so if you are looking for maximum memory for a low cost this is your choice and cheaper than the other two. and it has PBP support :-) the only downside I can think of is that it is a 64 pin smd package....

    /me

Similar Threads

  1. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  2. 16f887 44 pin demo board code problem?
    By jessey in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 7th December 2008, 14:17
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  4. Converting to MPASM
    By btaylor in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 4th November 2005, 01:35
  5. Help with MPASM and PIC Basic
    By johngb in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 21st February 2003, 13:07

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