Just so you would ask why, of course. It's been a while since I've done any major PIC programming, and the last chip I used was the 12F675, so I didn't remember the LAT registers. Thanks for reminding me. - Martin Robin Abbott wrote: > Why would you be doing this instead of using the LAT registers - which give > you a much clearer view of what is happening when an input changes to an > output. > > Robin Abbott > Forest Electronics - Home of WIZ-C ANSI C Compiler for PIC's with RAD Front > end > robin.abbott@fored.co.uk > www.fored.co.uk > > > -----Original Message----- > From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf Of > Martin > Sent: 25 January 2008 19:35 > To: Microcontroller discussion list - Public. > Subject: [PIC] macros to get around read-modify-write > > Do you use macros in your assembly program to get around the fact that you > shouldn't be using read-modify-write commands on a port? > I wrote two macros that should accomplish this: > > setb macro port, pin > movff port,portbuf > bsf portbuf, pin > movff portbuf, port > endm > > > clrb macro port, pin > movff port,portbuf > bcf portbuf, pin > movff portbuf, port > endm > > Simple, right? They don't work right. If I do this: > > setb PORTB,0 > setb PORTB,1 > nop > clrb PORTB,0 > clrb PORTB,1 > > Pin 0 is set then goes low while pin 1 goes high, then pin 1 goes low - so > it looks like the second "setb" doesn't occur until pin 0 is cleared. > The pulses don't overlap at all. > Do you know what the problem is? > - > 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