Hello, all. I have just subscribed to this list, although I have read several of the messages in the archive. I have considerable experience programming the PIC1600 series in assembler. So that it won't be a waste of everyone's time to read this, I offer a few 'tricks' which I devised (probably not for the first time) and many list readers may not know about: (Non-programmers: Possibly incomprehensible programming instructions follow. ) Swapping W with a File (RAM) register (PIC 16Cxx) Sometime you need to swap the data in W with that in RAM, a port, or a special purpose register (i.e. W<->F). This may appear to be easy with a few MOV instructions and a temporary RAM location, but when you sit down to code it you'll see that it'll take *two* temporary locations and 6 instructions to shuffle the data around using only MOVs. So, like many things with a PIC program, an unconventional technique can be really useful... like this: XORWF file,w XORWF file,f XORWF file,w Try it on paper until you're convinced it will work. Remember that XORing the W+F+F leaves a result of the original value of W (the two xors with the same data cancel out, so the final result is W xor 0 = W). The sequence affects the Z flag, of course (one that had a MOVFW in it would as well), but not in a particularly useful way. This will work as-is with a port which is set for all output. The port will be read 3 times, but written to only once during the second instruction. If the port has some bits set for input, the result left in W for the input bits is probably going to be wrong. (I'll leave it to you to analyze the situations when it happens to be right) A correct read of the input bits can be done with a conventional MOVFW after the routine is used to update the output bits. Understanding this, I now present the logical extension: swapping two file registers. This is tremendously useful to indirectly index two data sets at the same time (didn't think that was do-able, eh... Whining to Microchip about putting two FSRs in is not the only solution!) First, a conventional solution is worth considering: MOVFW FSR (the special purpose register) MOVWF tmp (a temporary location) MOVFW fsr2 (a location defined to hold the alternate index) MOVWF FSR MOVFW tmp MOVWF fsr2 This is 6 instructions, and requires a temporary location. If RAM is scarce in your design (and it probably is, since you want to indirectly index two data sets at once), consider using the W<->F method above... The obvious approach is to use the routine above three times, assuming you wrote it as a macro: swapwf FSR swapwf fsr2 swapwf FSR So this is 9 instructions, but W is not affected, and no temporary RAM is required. If you can tolerate losing the value in W while swapping the files, then this shorter version will also work: MOVFW FSR swapwf fsr2 MOVWF FSR This is a total of only 5 instructions, 1 less than the conventional method. Allocating a temporary location to store W during the swap would add 2 more. Everything is a trade-off, I suppose. I hope this is useful to someone, and I'm looking forward to participating in the PICLIST. -Mike