Jan-Erik, Brent, Thys and Olin, thank you all for your helpful hints and suggestions. I had a close look at the PCB I had designed. The culprit possibly is = the thick track directly under the PIC that is connected to the Live = terminal of 240V~, supplying +5V to pin 1 of 12F629. (ASCII art of the power supply = is shown below). I will try and modify the PCB and see whether that solves = the problem. 5 Volt Power supply from 240V Mains (Caution: No isolation, high voltage at all points) +---------------+---------+---- +5V | | | =20 Live o | | =20 Zener ---- --- 470uF 240V~ 5.6V /\ --- 16V ---- | =20 Neutral o | | =20 | | | =20 +--/\/\/----||--+---|<|---+---- Gnd 220R 0.33uF 1N4007 400V Regards, Bala=20 > -----Original Message----- > From: Olin Lathrop [mailto:olin_piclist@EMBEDINC.COM] > Sent: Thursday, September 11, 2003 5:46 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC:] Why is my 12F629 resetting? >=20 >=20 > > My problem is this: After the lamp is switched on, when the=20 > Dim button > > is pressed 3 times, the lamp dims in 3 steps as expected.=20 > But when the > > button is pressed the 4th time, the PIC resets and the lamp=20 > goes off. > > (There is a start-up routine that blinks the LED 4 times.=20 > This tells me > > that the PIC has reset). I have disabled the Watchdog Timer and > > Brown-out Reset. If I replace the 60W bulb with a zero watt=20 > one, then > > the circuit works without any problems. >=20 > Sounds like the switching noise is coupling into the PIC=20 > circuit. After 3 > dimming steps the rising edge when the triac is turned on is=20 > larger and > therefore and the voltage capacitively coupled to a sensitive=20 > point gets > to the breaking point. You need to be squeaky clean about the ground > layout, decoupling, etc. >=20 >=20 > ***************************************************************** > Embed Inc, embedded system specialists in Littleton Massachusetts > (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body