>Both the relays and solenoid valves, being inductive, will generate a >surge of voltage when turned off. Connecting any heavily inductive or >capacitive load directly to a PIC pin is likely to cause trouble. Don't >expect the protection diodes in the PIC to carry heavy current and still >maintain proper operation. They are intended mostly to prevent permanent >damage. Use an external diode arrangement to prevent any voltage higher >than Vdd from reaching the PIC. The best way to do it is to use driver >transistors for each relay. I have transistor drivers for each relay and also have diodes in the coil of the relay. >Dumping the inductive kickback into the Vdd line can also cause trouble. >If the circuit doesn't use a lot of power, the burst of energy from a >relay coil can make Vdd jump well above 5V. A large capacitor (1000 uF) >from Vdd to ground can limit this voltage rise. Such a capacitor should >be standard in any design that's used in a noisy environment anyway. Also I have large cap in the power supply (+-1000 uF) >If driving the solenoids via relays, the inductive "kickback" from the >solenoids can make the relay contacts arc as they open. The >high-frequency energy from this arcing may couple into the PIC and >disrupt it. It also is likely to shorten the life of the relay. Either >an MOV or a series resistor-capacitor snubbing network can be connected >across the solenoid coil or maybe the relay contacts to reduce this >problem. Just using a capacitor would make the relay contacts arc as >they close. I'll probe with the snubber (100 Ohm and .1 uF I think) >If you still have problems, test without the solenoids connected or >energized to see if it's coming from the relay coils or the solenoid >coils. The circuit has no problems without load. When I connect the solenoid I get the reset I still don't know if a power on reset or an mclr reset is the signal that reset the circuit thanks for the suggestion I'll probe it