Uhm, most of this type of signalling is done with the receiving end holding the line hi through a local, high value pull-up and the switching end pulling the line lo when required - all noise and cross talk helps to hold the line hi. When the switch pulls the line lo the receiver gets the message loud and clear. If the receiver is opto coupled to the sending switch then the scheme is modified a bit, the pull-up is a much lower value to allow about 15-20mA through an LED (in the opto coupler) and contact losses can be significant. My suggestion is to set up the switches as a 24V, 20mA current loop through all 3 opto couplers with the switch pulling the signal lo (allow for a 2 volt drop across each LED). On the photo transistor side of each opto coupler hold the collector hi with a high value resistor (say 10K) and connect the resistor/collector joint to a PIC I/O pin (emitter connects directly to 0V). Don't forget a very high value resistor (100K) from the photo transistor's base to 0V to bleed off any accumulated static to avoid false triggering. This set up inverts the signal - when the line is hi (switch open) the PIC will get a lo while the photo transistor is on (diverting the pull-up to 0V). When the line goes lo the LED goes out, the photo transistor turns off and the pull-up signals a hi to the PIC. Bye. > -----Original Message----- > From: Tony Nixon [SMTP:Tony.Nixon@ENG.MONASH.EDU.AU] > Sent: Tuesday, 26 October 1999 10:08 > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: HARSH ENVIRONMENT PIC > > Brian Kraut wrote: > > > > I need to read some switch closures with PICs in a ship. The cables > > running to the switches will run several hundred feet and will be run > > alongside AC power lines and possibly some lines to big motors. There > > will be three PIC circuits in three different locations reading the > > switches. They will be daisy chained. There won't be any serial coms > > between the pics, just 11 switch lines and common. There won't be any > > fast switching, just going to alarm contacts on doors. > > > > Any suggestions for protecting the pics and keeping noise on the lines > > from looking like switch closures? > > > > Also, should I use 5V going to the closures or bump it up to 12 or 24 > > and step it down with a zeener at the pic end for better noise immunity? > > Opto couplers are cheap and simple. It's highly unlikely that the LEDs > will light except when driven by the switch closures. The PIC connects > to the transistor collectors to detect the swicth change. > > > -- > Best regards > > Tony > > http://www.picnpoke.com > Email sales@picnpoke.com