Mi Martin, Please not that that fraction of code intended to use other ports than just portb - just realized that the 'b' from the name setb is for portb only? Then that's ok, I was just thinking of a generic way of port handling, sorry for the confusion :-) Anyway, yes, if you use 18F and later series, you have LAT which is way better than any other shadow register solutions. Tamas On Jan 28, 2008 1:26 PM, Martin wrote: > Tamas Rudnai wrote: > > So how would you handle this code with your macros if you modify that > with > > James' suggestion: > > > > setb PORTB,0 > > setb PORTA,1 > > nop > > clrb PORTC,0 > > clrb PORTD,1 > > > > ? > > > > Tamas > > > > > > > Tamas, my macros are defined like this now: > > setb macro pin > bsf portbbuf, pin > movff portbbuf, PORTB > endm > > clrb macro pin > bcf portbbuf, pin > movff portbbuf, PORTB > endm > > > > But like Wouter and Robin reminded me, this PIC has the LAT registers > that can be safely used with read-modify-write operations. Much nicer. > > - > Martin > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist