Why didn't I think of that. Seems obvious enough knowing that HIGH X also sets the relevant TRIS bit, but I hadn't considered it takes time and code to do that...Originally posted by Ioannis
First of all you may replace the High and Low commands with:
variable=1 or variable=0
Memory and speed gain with this trick.
This got me thinking so I did a little test. Just a little programm that blinks an LED
define LOADER_USED 1
define OSC 4
ADCON1 = 7 ' Set PORTA and PORTE to digital
Pin_Index var byte
trisa = 0 'all outputs
trise = 0 'all outputs
pin_index = 0
Main:
'high porta.0
'porta.0 = 1
porta.0[pin_index] = 1 'Sets PortB.4 high
pause 500
'porta.0 = 0
'low porta.0
porta.0[pin_index] = 0
pause 500
goto main
Using the HIGH/LOW comands (others commented out) this compiled to 75 words. But using the PORTA.0 = X it compled to 69 words. (looks like a savings of three words for every HIGH or LOW)
Then I tested the PIN_INDEX method, 115 words. It worked, but it seems to be a lot larger.
Then just for fun I tried compiling them with MPASM instead, I don't understand why (yet) but in all cases MPASM compiled to three words less than PM. Anyone know why?
Melanie, could you be a little more specific about the anomalies? Was it certain pics, code sequences, phase of the moon, was Mercury in retrograde? ;-)Originally posted by Melanie
I don't think this works in all cases... I posted a similar thread earlier and had to withdraw the posting after heaps of anomalies... more thorough investigation is needed on this one...
-Denny


) but in all cases MPASM compiled to three words less than PM. Anyone know why?

Bookmarks