There are 4 bits that indicate what caused a RESET.
Code:
POR Power-On Reset PCON.1
BOR Brown-out Reset PCON.0
TO Time-out bit STATUS.4
PD Power-down bit STATUS.3
This table from the 16F818/819 datasheet shows the values of them after various reset conditions.
You can send them to an LCD or RS232 terminal to determine what happened.
<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1398&stc=1&d=117185912 4"></img>
BOR/POR must be set manually to detect a Brown-Out Reset. See datasheet section 12.9
Also, if changing the value of OPTION_REG in your program. Be aware...

Originally Posted by
PIC16F818/819 Datasheet
Note: To avoid an unintended device Reset, the instruction sequence shown in the
“PICmicro® Mid-Range MCU Family Reference Manual” (DS33023) must be
executed when changing the prescaler assignment from Timer0 to the WDT. This
sequence must be followed even if the WDT is disabled.
My guess would be something to do with the relays. Possibly back EMF feeding to the power supply.
And, even though you've got a HUGE capacitor on the power. You should still have a 0.1uf cap from VDD to VSS as close as possible to the chip.
Another possibility is a Stack Under-Flow. An Over-Flow won't do it, but an Under-Flow (Return without a Gosub) can cause it to jump to address 0000. It looks like a reset, but isn't. But you can see that from looking at those 4 bits.
HTH,
P.S. That's pretty weird sending sound thru 4 different bushes. 
<br>
Bookmarks