I went thru your code a bit to count I's and O's: looks like you have two outputs.
While you wait for your chips to arrive you may want to try this: (assuming you can ICSP this board) make up some test programs, either 4 programs to try each of the two output lines high and low, or use 1 input to step thru the combos.
That way you can see if a single output being hi or low is causing the current.
Acetronics' comment about presetting GPIO's before TRIS is well taken: GPIO is undefined after a reset and perhaps a momentary state collision is occasionally taking down the power supply and ending the program right there.
Post the schematic (as much as you will).




Bookmarks