I think the same thing applies there too. If TMR1_ON = %00000001, and the next person is trying to use an external crystal on timer1. It can cause problems.
Apparently I do things different than everyone else, but I try to do things in as Low Level as possible when controling SFR's.
This is also where Includes can come in handy.
In that file you can have predefined macro's that give good names to common functions. For the above example it might look like this...Along with many other Timer related macro's.Code:ASM TMR1_ON macro bsf T1CON, TMR1ON endm TMR1_OFF macro bcf T1CON, TMR1ON endm ENDASM
Then in the main program, you no longer need to worry about what registers, and what bit's need to be in a Magic Number or an Aliased variable. Just call the macro like this...As a side benefit, those macros only take 1 instruction cycle, instead of the 2 required to copy a constant to a byte variable.Code:@ TMR1_ON '-- OR -- @ TMR1_OFF
I don't think the buffer_size example applies here because it's not a bitwise operation. It's a whole number that still requires a constant. (CON, not =)
Darrel




Bookmarks