Difference between revisions of "More debugging tips"
From Mech
Jump to navigationJump to search(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<b>Use your LEDs</b> |
|||
*Indicate phases of program operation by illuminating LEDs. In particular a lot of electrical faults cause the PIC to resst. The first thing your code should do is illuminate a "startup LED" for 100mS. If you see that LED flashing repeatedly, you'll know your PIC is reseting. |
|||
<b>Why is my PIC reseting?</b> |
|||
⚫ | |||
*Often from voltage spikes. Add 1uF capacitors near your digital chips, especially H-bridges. In extreme cases, where capacitors and good grounding does not do the trick, you might want to have separate power supplies for your electrically noisy power-hungry circuits and for your low-power circuits, with communication happening through optoisolators. This way there is no direct electrical connection between the circuits; communication is through light. |
|||
<b>Runs only with ICD unit attached</b> |
|||
⚫ |
Latest revision as of 09:38, 29 January 2008
Use your LEDs
- Indicate phases of program operation by illuminating LEDs. In particular a lot of electrical faults cause the PIC to resst. The first thing your code should do is illuminate a "startup LED" for 100mS. If you see that LED flashing repeatedly, you'll know your PIC is reseting.
Why is my PIC reseting?
- Often from voltage spikes. Add 1uF capacitors near your digital chips, especially H-bridges. In extreme cases, where capacitors and good grounding does not do the trick, you might want to have separate power supplies for your electrically noisy power-hungry circuits and for your low-power circuits, with communication happening through optoisolators. This way there is no direct electrical connection between the circuits; communication is through light.
Runs only with ICD unit attached
- Make sure you are not in debugger mode. Try adding the NOBROWNOUT fuse at the top of your code.