Electronic – Programming/Debugging with ICD3 and PIC16F819-I/P

mplabpicprogramming

ICD3 passes internal test with MPLAB IDE using the Test Interface Module
PIC16F819-I/P supports ICSP and In-Circuit debugging source.
ICD3 pinout is as follows (source):

1) Vpp/!MCLR
2) Vdd
3) Vss
4) PGD
5) PGC
6) LVP

The relevant PIC16F819-I/P pinouts are as follows (source):

 4) RA5/!MCLR/Vpp
14) Vdd
 5) Vss
13) RB7/T1OSIPGD
12) RB6/T1OSO/T1CKI/PGC
 ?) LVP

The documentation for the PIC states that it can be debugged using RB6 and RB7 provided that the DEBUG bit in the Configuration Word is set to '0' (page 102).
Q1) How do I do this? Can it be done through MPLAB?).

Q2) Is programming and debugging as simple as connecting up Vpp, Vdd, Vss, PGD, and PGC (ignoring LVP) from the ICD3 to the pins of the PIC? I have a small breadboard to do this, but I'm wondering if I need additional passive components, which leads me to Q3.
Q3) How should I set up my breadboard to program the PIC?
Q4) Given Q1-Q3 are all satisfied, is programming and debugging as simple (using MPLAB IDE) as writing the code, downloading it to the PIC, and debugging from there? I understand that this question may fall outside the scope of my original 'how do I get started' question. Feel free to ignore it if you feel that it does.

Thank you so much for any guidance on this. I sincerely want to do this correctly!

EDIT: The resolution to this specific issue was eventually found here.

Best Answer

A1. MPLAB will set the debug bit as necessary. Note that in MPLAB there is a Debugger menu as well as a Programmer menu. Which one you use determines how it sets up the PIC. A PIC programmed from Debug may not run if the ICD3 is removed. To run without the ICD3, program it from the Programmer menu.

A2. The ICD3 does not provide power to your device, so you need to apply power externally. LVP doesn't usually have to be connected. There have been a few parts that needed this line held disabled in order to be recognized, but I haven't seen that in a long time. MCLR will operate properly from the debugger, but you will need at least a pull up resistor there when you attempt to run without the ICD3 connected.

A3. The PIC should be recognized by the ICD3 as soon as it's been selected as your Debugger. A message appears in the output window as to whether it sees it or not. Note that if you are using the internal oscillator (thereby not having to add an external crystal), your program should specify that the internal oscillator is to be used. Otherwise, you may be able to program the PIC, but it won't respond afterward. You don't "lose" the part, but you do have to fix the error and program it again.

A4. You can do all those things you described from inside MPLAB. I hesitate to use the word "simple", as you have to get everything set just right (example: choose the right chip from "Configure") before it works. After the "hello world" exercise it becomes easy (not counting writing the software, of course).