Jinx wrote: > Just a couple of things. As you get to know the registers better > you could cut down on the BANKSELs. For example PortA, > PortC and TMR0 are all in bank0 so > > BANKSEL PORTA > CLRF PORTA > CLRF PORTC > CLRF TMR0 Hmm. I'm not sure I like that. I think it's better for a newbie to use BANKSEL in front of every SFR access, except for the ones specifically documented to be mapped to all banks (INTCON, STATUS, etc). Implicit assumptions in the source code about what bank things are in is a bad idea in my opinion. Using BANKSEL isn't a good way to write prodution code because it inserts a lot of needless diddling of RP0 and RP1, but it's a reliable way to get started. Once a newbie has a general comfort with the PIC and understands the memory architecture better, it's time to re-examine banking. At that point they're ready for DBANKIF and related facilities in STD.INS.ASPIC at http://www.embedinc.com. > You can define a name for a bit in a register (such as a pin) > > #define led porta,1 > > would allow you to use the expression > > BCF LED > > instead of BCF PORTA,1 Yes, this is a good point. Once past the initial learning stage, the next step is to use the /INBIT and /OUTBIT directive of my preprocessor which do this but also define a bunch of other constants related to an I/O bit, and the standard PORT module then automatically initializes everything as you specified. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist