If you use external MCLR you can always connect a push button and a 100 ohm resistor to gnd. Close the button and MCLR is held low and the PIC will reset and when you release the button the PIC will start from the top of your program again.
Do not pull MCLR directly to GND without a 100 ohm resistor or something similar because too big currents on this pin might cause latch up and then the PIC will stay off. This is mentioned in the datasheet for you PIC usually in the MCLR section.
If you have an 18-series PIC you can just add a button in your normal code and then when it is pushed you do @RESET and then it will restart. But this way you need to make sure you can always scan the button from inside every loop. Using the PB on MCLR will allow you to reset the PIC even if the software has hung up on some unexpected event.
Bookmarks