OR ---
Here's another version that allows you to work with Timers 0-3
Code:
ASM
TMR_ON macro T
if (T==0)
bsf T0CON, TMR0ON
else
if (T==1)
bsf T1CON, TMR1ON
else
if (T==2)
bsf T2CON, TMR2ON
else
if (T==3)
bsf T3CON, TMR3ON
endif
endif
endif
endif
endm
TMR_OFF macro T
if (T==0)
bcf T0CON, TMR0ON
else
if (T==1)
bcf T1CON, TMR1ON
else
if (T==2)
bcf T2CON, TMR2ON
else
if (T==3)
bcf T3CON, TMR3ON
endif
endif
endif
endif
endm
ENDASM
This still only takes 1 instruction cycle but allows you to select which timer is being used.
Code:
@ TMR_ON 1
@ TMR_ON 3
@ TMR_OFF 0
After awhile, your include files start to define your own personal language. No longer stuck with the standard commands that are defined in the PBP compiler. You'll spend a lot less time looking at the datasheets, and more looking at your program.
Best regards,
Darrel
Bookmarks