Last edited by skimask; - 23rd January 2008 at 17:47.
Also,
1. If you have small subroutines and/or small loops , keep them at the beginning.
Also,
2. if you are comparing a byte variable to a word variable, make sure, you compare the byte variable to the lowbyte of the word variable.
Ex:
A var byte
B var word
Instead of
IF A = B THEN Home
use,
IF A = B.LowByte THEN Home
Also,
3. If you have HIGH and LOW commands, make them direct access to PORT register.
Ex:
Instead of
HIGH PinA
Use,
PinA = 1
=================
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
See Cliff Griffin's hints here
http://www.rcfaq.com/PIC/optimize.htm
Paul Borgmeier
Salt Lake City, UT
USA
__________________
If minimal code size is the goal, then PBP is a LOT of work.
Reducing gosubs is not always the best rule, unless you are getting rid of the subs that were only added to make the code more "readable". If you can insert a few subroutines to eliminate duplicate code, they are very helpful.
One thing to do is eliminate as many built-in basic commands as possible. For instance, hserout is very inefficient. You can manually load your values into the TXreg and save a lot of space. The ADCIN command is probably even worse.
Hi and thanks everyone.
Using a combination of Lookup and assembler
the code is now 3768 !!!! beauty !
I noticed that lookup can reduce code but can also
increase code, so be carefull !
thanks
kind regards
Peter![]()
Pete
Bookmarks