> >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. > > > > Guess you could always write xxxx'xx01 and xxxx'xx10, on regular > digital pins. Sure: But here I only have to write 1 pin and the other 'magically' switches state. Saves me at least one instruction. Gotta have some use :-) > And actually, you can drive a piezo quite well using > a single pin on a PIC. In fact, as it is, you normally have to use > a 100-1000 ohm attenuation R in series, or it will drive you right > out of the room. Out of the room was the whole idea. Actually, I used this trick to get two volume levels: for key-click prompts and warning tones I held one output fixed and toggled the other. For the alarm output I toggled the two outputs 180 degrees out of phase with each other. 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.