Improve the power supply noise rejection for the PIC: 100nF decoupling caps as close to PIC pins as possible, insert a 10uF decoupling cap + 100uH choke + 10uF decoupling cap in the power supply line to the PIC...
Generally PICs are a lot less affected by such noise as compared to some other architechtures. But if you still get this problem, try putting some EMI filters in the circuit. In addition to what rfmw as told you, also use ferrite beads / rings on the cables entering and leaving the circuit. For example, put a ring (in common mode) on the 2 power wires and similarly on signal wires.
Improve the power supply noise rejection for the PIC: 100nF decoupling caps as close to PIC pins as possible, insert a 10uF decoupling cap + 100uH choke + 10uF decoupling cap in the power supply line to the PIC...
Would you please uplaod schematic for the above explanation?
techie said:
Generally PICs are a lot less affected by such noise as compared to some other architechtures. But if you still get this problem, try putting some EMI filters in the circuit. In addition to what rfmw as told you, also use ferrite beads / rings on the cables entering and leaving the circuit. For example, put a ring (in common mode) on the 2 power wires and similarly on signal wires.
I understand your problem now. How do you connect the switch to the PIC? Do you use any debounce circuits? I hope that your wires from the switch to the PIC are short...
Attach your schematic and picture of the device if possible. It might be that EM noise produces a spike in your switch wires, therefore PIC senses it as if you've pressed a switch, while you really didn't...
you must put a 100nF capacitor from input pin and ground and pull up or pull down (220 ohm) resistor from input pin and power line .
I prefer make input normally pull-up with a diode 1N4148 connect series with the external switch (switch give negative when push) and i use a debounce software filter of 100mS