code size VS speed optimization setting?


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    yeah ive written a program nearly 3000 lines long, and ive hit the end of the 32k of code space my PIC has. I pulled all the strings out into EEPROM and that saved some space, but im likely to run out again soon. I've done the most obvious things to save space.

    *edit* i guess the only thing left to do is go thru all 3000 lines looking for where i can make it more efficient... *sigh* that will be a chore
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

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


    Did you find this post helpful? Yes | No

    Default

    Just a thought...
    Move some of the routines over to another PIC, Maybe something that has some heavy calculations. PIC#1 sends data to PIC#2 for calcs, when finished PIC#2 sends data back to PIC#1. Sort of like an interrupt.
    Dave
    Always wear safety glasses while programming.

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kamikaze47 View Post
    yeah ive written a program nearly 3000 lines long, and ive hit the end of the 32k of code space my PIC has. I pulled all the strings out into EEPROM and that saved some space, but im likely to run out again soon. I've done the most obvious things to save space.
    *edit* i guess the only thing left to do is go thru all 3000 lines looking for where i can make it more efficient... *sigh* that will be a chore
    Have you tried moving the most commonly used variables to BANK 0? (only applies if you're using a 16Fxxx series PIC, doesn't do anything on an 18Fxxx series)

  4. #4
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    using an 18F4550

    I would just get a pic with more code space. but i need the USB functionality of the 4550.
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kamikaze47 View Post
    using an 18F4550
    I would just get a pic with more code space. but i need the USB functionality of the 4550.
    Repeat...Until uses less space than a For...Next, about 3 bytes for each one...

    Multiplies and Divides by power's of 2 can be replaced by shifts << and >> ...

    For...Next loop that are (for instance) "0 to 7" take up less space than "1 to 8", again, only a few worth...

  6. #6
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    thanks for the tips

    i'll go thru my code

    *cringe*
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

Similar Threads

  1. decoding quadrature encoders
    By ice in forum mel PIC BASIC Pro
    Replies: 93
    Last Post: - 28th February 2017, 09:02
  2. Problem runing my code
    By Mus.me in forum mel PIC BASIC Pro
    Replies: 33
    Last Post: - 1st December 2009, 20:36
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  4. pic18F code size problem???
    By dogi in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 7th March 2005, 21:52
  5. Need help, high speed D/A converter, see code
    By rpatel in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 20th December 2004, 01:33

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