How about this?
Code:
Main:
n = n + INTCON.2
INTCON.2 = 0
IF n.3 THEN
LATA = LATA ^ %000011
n=0
ENDIF
goto Main
It won't produce exactly the same frequency as your example but it's 12% smaller (37 words). I suppose there's also the odd chance/risk of the TMR0 interrupt bit being set in between checking it and clearing it. You COULD also do away with the n=0 at the start with the drawback of the FIRST iteration taking longer depending on the start value of n. AND, possibly, get rid of the GOTO Main and let the PC freerun and start over from the top.
Adding DEFINE NO_CLRWDT 1 saves one or two words depending on which version.
Using TMR1, which is 16 bits with its 8:1 prescaler instead of counting overflows should achieve similar results
Code:
T1CON = %00110001
Main:
IF PIR1.0 THEN
PIR1.0 = 0
LATA = LATA ^ %000011
ENDIF
Goto Main
Combining these I got it down to 34 words but have not checked if it actually works.
/Henrik.
Bookmarks