--- Martin Tedjawardhana wrote: > Hello people, > > I need to connect a simple push-on switch with a PIC, but the cable > connecting it can be up to 30 meters. What are the potential problems > here? Interference and such? Cable resistance? Can I get away with > only a simple pull up resistor, or should I put an extra transistor > and use the switch to trigger it ? Or is there another way of doing > it? > > Thank you in advance. > If you are putting this into an industrial environment et al well heck if you are putting this in any normal environment, (IE not specifically made for low noise), I suggest ye olde isolated voltage source (with isolated ground perhaps) and a opto isolator input with current limiting resistor. A simple derangement. More seriously that cable will be a conduit for noise injection into your system. A simple pull up will not remove ground noise etc. Since the opto will be on or off and have a bit of hysterisis it should be sufficient to remove it being a trigger for noise. You do need a pull up on it's output or pull down depending if you use its output as open collector or open emitter. If you don't need speed, then don't use one that has it (less to glitch). Once your button makes positive contact you are all set. This is assuming you aren't trying to multiplex this or anything of course :) ===== Stephen R. Phillips was here Please be advised what was said may be absolutely wrong, and hereby this disclaimer follows. I reserve the right to be wrong and admit it in front of the entire world. __________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist