On 2010-08-11 17:29, Wouter van Ooijen wrote: >> I've seen much code written this way and I use this technique all the >> time when writing my own code. It works, its efficient, its >> readable, its maintainable. What more do you want? > > It works, I agree. But I disagree very much with readable, and (as a > consequence) with maintainable. The fact that the OP had trouble with > this code is proof that it is confusion, at the very least. > > At the moment I am wring a small course on 'propper' programming (in C, > but that is almost irrelevant). I would qualify a technique like this > (relying on PORT/TRIs adresses being the same) as a 'last resort': don't > use it, unless you absolutely must. To quantify it: if you use such a > technique, write 20+ comment block that explains the technique and why > it is absolutely necessary to use it. That will deter most > 'unreasonable' uses. > > PS the offending code fragment: > > >> BANKSEL TRISD > >> movlw 0x00 > >> movwf PORTA > >> movwf PORTB > >> movwf PORTC > >> movwf PORTD > > does not benefit from this 'technique' in any way. Using the TRIS > registers would result in exactly the same code. Not on the actual processor (an PIC18), does it ? On a PIC16, yes... > > PPS: can you show a piece of code that really benefits from this techniqu= e? > --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .