markp@cannontech.com writes: > My question is about bank selection using the STATUS RPO/RP1 bits vs. the > BANKSEL command. When I need to transition between banks, I simply change > the RP0/RP1 bits accordingly before and after the transition. However, I > see many examples of code in the archives that use the BANKSEL command. I > do not see this command in the spec sheet, well for the 16C773 & 16C715 I > use anyway. Is it applicable to all PICs or just certain ones? What are > the advantages of its use over the RP0/RP1 select method? The primary advantage of BANKSEL is that you don't have to keep track, when writing code, of in which bank a variable (or SPFR) is allocated. This can be especially useful with relocatable code that lets the linker assign variable locations, in which case you don't, in general, know the bank of a variable at program writing time. The disadvantage is that it always generates two extra instructions, adjusting both RP0 and RP1 (for the processors that have those bits), whether what you actually need is two, one, or no extra instructions. This can significantly expand code size and slow execution. If you *know* the banks of your references as well as the current settings of the bank select bits at the time that you are writing the code, and you're beyond the beginner stage in which you don't want to think about banks, then set and clear the RP bits yourself. If you're writing a module that will be relocatably linked into several projects, and you don't want to fix up bank selection each time you use it, and you can't restrict where the using project places your variables, use BANKSEL. (I'm sorry if my anti-BANKSEL bias comes through to strongly.) Bill -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist