----- Original Message ----- From: Dan Michaels > Hi Tony, I think this is not exactly correct. If you only exercise > a single pin uisng BSF/BCF, it will work correctly, but if you do > successive BSF/BCFs to > 1 PortA pins, then only the last will be > operated upon corrrectly, and all others will always end up being > cleared. > > BSF PORTA, 0 > BSF PORTA, 1 > BSF PORTA, 2 > > will leave the port in the following state: xxxx'x100 > > [either that or it's naptime]. > Dan, Right: Given A,0 A,1 and A,2 defined as analog and as output: BSF PORTA,0 will SET A.0 and CLEAR A.1 and A.2 BSF PORTA,1 will SET A.1 and CLEAR A.0 and A.2 BSF PORTA,2 will SET A.2 and CLEAR A.0 and A.1 So, when you are done you will indeed end up with a zero on A.0 and A.1, but there will have been a nice pulse of 1 in the meanwhile. Now that gets me to thinking: Here is a neat trick to get a 'push-pull' output from two PORT A pins: 1: define them as analog (ADCON1) 2: TRIS them as outputs. Now, when you BSF either of them the other will automatically be cleared. This would have been useful in a system I built that drove a piezo transducer directly off two PIC pins. Bob Ammerman RAm Systems (contract development of high performance, high function, low-level software) -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.