18F26K80 Code Optimisation.


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: 18F26K80 Code Optimisation.

    My other thread about running the PIC at 80mhz is here.. (I failed to get it working)

    https://www.picbasic.co.uk/forum/sho...heck-and-4xPLL.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: 18F26K80 Code Optimisation.

    Do you NEED it to run faster? Are you at or close to the limit or do you just want to see what can be done?

    I would not bother with overclocking the PIC, running it 25% above its specification, which I said in the other thread. Perhaps you couldn't make it work because it simply does not work.
    Besides, I don't think PBP has a valid DEFINE OSC for 80MHz so all software timing etc will be wrong, which I now see Alain also said in the other thread. That can of course be compensated for but nah...

    Here's what I'd do.
    Start wrapping subroutines and small sections of code with LATB.0=1 / LATB.0=0 (or whatever pin is available) and put a scope probe on that pin.
    Measure the sections and figure out where most of the time is spent. Then look at that section in more details.

    Shaving off a couple of instructioncycles here and there on code that runs 5 times per second doesn't pay off. Shaving off the same number of cycles in code that runs thousands of times per second does. I'd probably start with the display update code as outlined in my previous reply. Which I now realise is completely the oposite of what I just said but if there's anywhere you can save a LOT of cycles it might be there.

    /Henrik.
    Last edited by HenrikOlsson; - 16th August 2023 at 16:38.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: 18F26K80 Code Optimisation.

    Quote Originally Posted by HenrikOlsson View Post
    Do you NEED it to run faster? Are you at or close to the limit or do you just want to see what can be done?
    I wanted to see if it could run at 80mhz and if it did that would give me some free time with no code optimising.

    I understand the define osc would need tweaking.

    If I could get it going at 80mhz I was going to do define osc 40mhz and just double up on pauses and other commands that use that define etc

  4. #4
    Join Date
    Aug 2011
    Posts
    453


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: 18F26K80 Code Optimisation.

    Try using a clock osc chip instead of a crystall or resonator.

    That's what I used (an external 20Mhz osc) and it worked for me.
    Of course, that doesn't mean it'll work for all chips.

    If you want to increase the speed switch to a chip that has the CAN controller builtin.
    That avoids all the SPI transfers to the external controller.

    Why use the 2515 at all when the K80 has CAN?
    Last edited by tumbleweed; - 16th August 2023 at 16:40.

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: 18F26K80 Code Optimisation.

    Quote Originally Posted by tumbleweed View Post
    If you want to increase the speed switch to a chip that has the CAN controller builtin.
    That avoids all the SPI transfers to the external controller.

    Why use the 2515 at all when the K80 has CAN?
    Because I'm talking on three separate CAN buses.

    The K80 only has one internal CAN module.

Similar Threads

  1. 18F26K80 Serial setting sanity check and 4xPLL.
    By retepsnikrep in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 20th August 2023, 16:05
  2. Replies: 0
    Last Post: - 9th September 2018, 01:43
  3. Serial problem between BasicStamp code and PBP code
    By AllanZilkowsky in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 6th April 2014, 02:15
  4. Working code but my layman approach uses too much code space
    By Christopher4187 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 14th December 2012, 20:44
  5. Code: Why is this code greater than 2000 words?
    By DrDreas in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 1st June 2007, 19:51

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