PDA

View Full Version : 18f242 reset



Armadus
- 13th August 2007, 21:06
I am using an 18F2424 to drive a transistor and relay for a 12V LED lamp output.
When simply flashing the circuit on and off with a pause 700 statement the pic often resets to the start up point. Are there any general causes for the 18f2424 to reset?

BobK
- 13th August 2007, 21:45
Hello Armadus,

Without seeing your work we can only take guesses. Do you have a .1uF cap across the Gnd and Vdd of the PIC? Do you have a good clean 5vdc power source? What does your program have at the end? (Goto Start?) Do you have the WDT enabled?

I could go on like this for a while.

HTH,

BobK

Armadus
- 13th August 2007, 22:59
Bob,

Thanks for the reply. I do have a cap across +5 and Gnd. The program is simply

High PortC.1
YR:
Low PortC.1
High PortC.2
Pause 700
Low PortC.2
Pause 700
goto YR

I do have the WDT enabled

It will generally run for about 5 minutes, but sometimes only a few cycles, and resets to High PortC.1.

I am using a 7805 regulator, well filtered.
I have been working on the theroy that the power supply is dropping out, but it always appears to be at full power.

Thanks

Andy Wood
- 13th August 2007, 23:42
Bob,

Thanks for the reply. I do have a cap across +5 and Gnd. The program is simply

High PortC.1
YR:
Low PortC.1
High PortC.2
Pause 700
Low PortC.2
Pause 700
goto YR

I do have the WDT enabled

It will generally run for about 5 minutes, but sometimes only a few cycles, and resets to High PortC.1.

I am using a 7805 regulator, well filtered.
I have been working on the theroy that the power supply is dropping out, but it always appears to be at full power.

Thanks


Do you have a diode across the relay coil to suppress the back emf? If not, the "spike" when the relay is switched off could be causing the pic to reset.

Andy

Armadus
- 14th August 2007, 15:09
Andy,

There is a diode accross the relay.

Thanks

mackrackit
- 14th August 2007, 21:13
Try replacing the transistor with a LED and a 470 ohm resistor to make sure it is not something to do with the transistor or relay.

Is the cap across power rails large enough for BOR fuse. Rule of thumb, LED with resistor across power rails should go dim not instant off when power is cut.

What have you done with MCLR?

Armadus
- 14th August 2007, 22:20
Dave,

1. I have replaced the transistor and relay, but made no difference. I will try the resistor and LED you suggested.

2. I have a 330uF cap between the output of the regulator and Gnd.

3. MCLR pin is connected to +5 via a 4.7K series resistor, and a 0.1uF cap to gnd.

Thanks

mackrackit
- 15th August 2007, 02:32
One more thing if the other does not get it. Tie all un-used pins to ground with a 10k or so. If there is "noise" could have something to do with it. Good to do this on finished projects.