> -----Original Message----- > From: piclist-bounces@mit.edu > [mailto:piclist-bounces@mit.edu] On Behalf Of Olin Lathrop > > GM wrote: > > First, refer to the documentation for the RRF and RLF > instructions in > > MicroChip's Mid-Range MCU manual. > > No, I'm not going to dig that out. If you want me to see > something small, reproduce it here. Someone got up on the wrong side of the bed this morning. :-) > > contains 0x17 after execution. The W reg is not the destination for > > the instruction, which is given as RRF INDF,1. > > You should use mnemonics for the destination. I do. The #include files supplied with MPASAM define W and F as mnemonics. I use those when coding. BUT - that is not what is shown in the example in the manual, which I was reproducing verbatim. I'm a programmer by trade, therefore I have learned that magic numbers are to be avoided. It annoys me when my cow-orkers embed numbers and string literals in the source when they could just as easily have written code that is easier to read and easier to maintain, using constants or "mnemonics." You're preaching to the choir, so to speak. > > In any case "RRF INDF, F" will have no effect on W. The > result will be stored in the register indicated by FSR and > the indirect bank bit in STATUS, and it will effect the C bit > of course. That is what I thought, but being a novice I wasn't certain. Thank you, and the others who have responded, for confirming my suspicions and also for the other useful info you have included. > > > Second, I'm wondering just how much use most programmers > make of the > > assembler directives. > > Not much, since most programmers don't seem to bother reading > the manual. But I do, even to the point of catching errors in the docs. > > > as is using $ to refer to the PC. > > Don't do that except in very limited special circumstances. > Never do that when the target is not an adjacent instruction. > This will also cause problems when moving code between PIC > 16 and PIC 18. The PIC 16 has 1 address per instruction > word, but the PIC 18 has 2. Therefore GOTO $-2 jumps to the > previous instruction on a PIC 18 (unless its a two word > instruction in which case it will jump back to the second > word of the two word instruction, which is a NOP), but goes > two instructions back on a PIC 16. Confused? Good. Don't do that. > Not confused, makes sense. I'll avoid $. Regards, Glenn Minch -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist