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

|
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.
Bookmarks