Hi , Just wondering if anyone has any ideas on how to improve on this input/output circuit. Using 2 I/Os (RB0 and RB1 on a 16C505) I am trying to drive two back to back LEDs and read a switch at the end of 2 long wires: Here is some bad ascii art. The function is as follows: RB0 RB1 GREEN RED 1 0 ON OFF 0 1 OFF ON 0 INPUT ( CHECK SWITCH) The wire I am driving(reading) is quite long approx. 300 ft. I am having troubles reading the switch.I can read the switch ok if I don't change RB1 to an output . But thats no good because I have to be able to switch the LEDs.I tried putting nops between my TRIS statements etc. A code snippet is below If anyone has any suggestions I'd be grateful ie. LED1 (Red, Green and 10K in parallel) - |<|---- (Red) 470 ohm long wire | | RB0 ----/\/\/\/\----o o-------------------- -|>|---- LED2 (Green) | | | -/\/\/\/-------0 (shorts RB0 to RB1 when ON) _|__ 10K ohm /o SPST switch ___ .01 uF | | GND | | 100K | _/\/\/\/----+5 Volts | | | | 470 ohm long wire | RB1 ----/\/\/\/\----o o------------------------------------- | _|__ ___ .01 uF | GND Check_Switch bcf PORTB,0 ; set input to switch 0 nop nop nop nop nop nop nop nop movlw b'00000010' TRIS PORTB ; change RB1 to input nop nop nop nop nop nop nop nop bcf FLAG,POWER_ON btfss PORTB,1 bsf FLAG,POWER_ON movlw b'00000000' TRIS PORTB ; put RB1 back to output nop nop nop nop nop nop nop nop return