Ben, If I understood what you are doing right (and I just gave it a quick read... sorry) you can isolate the switches from your address lines by simply adding a series diode to each switch. You can press 2 buttons and all it does is connect the address lines with two back to back diodes... which doesn't conduct. Assuming you drive an address line high to see if a switch is closed, point the diode from the PIC output to each switch. If you output lows to detect switch closures, spin the diodes round the other way. Mail me off list if this didn't make sense, and include a sketch of your thing. I'll draw you what I mean. Good luck with your project. Ernie At 12:15 AM 6/13/99 -0700, you wrote: >Hi, > >I'm building a project which requires 4 pushbuttons to be attached to >a bus interface. I *could* obviously use a tristate buffer, but I'm >trying to keep the chip count down. I do have one spare pin on the >PIC (A2), so my initial solution was to have this pin as the common >connector to 4 switches, and have the other side of the switches >wired to B0-B3, (which is in use as part of a bus interface). >When the bus in in use, I float A2, so pressing a button doesn't >interfere with the bus operation. When I'm not using the bus, I flip >B0-B3 to inputs, set A2 high, read B0-B3, set A2 low, read B0-B3 again >and figure out which switches are closed. (Alternatively, make B0-B3 >outputs, A2 input, strobe each in turn, and look for corresponding >strobe on A2). > >Of course, a moment's thought demonstrates that if two switches are >closed at the same time, unspeakable confusion will occur, because >two of the bus lines will be shorted together, regardless of whether >or not A2 is floating, and when the bus *is* in use, disaster will >occur. > >So, I'm thinking - presumably if I got a transistor for each line, >arranged in an open-collector configuration, such that B0-B3 remain >outputs, each driving a transistor, I could take the second >approach described above (use A2 as input), and it wouldn't matter >if two buttons were pressed simultaneously. (I don't need to detect >simultaneous presses - it's just that they can't interfere with >anything!). > >My question is, (and once again, I'm forced to demonstrate my >complete lack of elec eng knowledge...), how exactly do I connect >the transistors? I need a series resistor on the base, yes? If so, >what sort of value should I use? > >Alternatively, if anyone can suggest a simpler way to get around >this problem, I'm all ears! > >Cheers, >Ben > >