In-Circuit Programming
MPLAB IDE and a hardware programmer are the essential components of the Microchip toolset. Originally, PIC® chips had to be removed from the circuit for programming in a separate module, and then replaced in the target application board. Now, in-circuit programming allows the chip to be programmed without being removed, which avoids possible mechanical (broken/ bent legs) and electrical (static) damage. The MCU must incorporate the necessary hardware features to support this option. If in-circuit debugging (ICD) is supported by the design of the target hardware (six-pin connector and suitable connections to the MCU), the programming module can act as both a programming and a debugging interface.
The connections shown in Figure 7.1 are common to the low-price PICkit2/3 and the ICD2/3 programmer/debugger modules. Each has a six-pin connector, with the PICkit using a single in-line (SIL) connector on the target board. The program is downloaded via ICSPDAT/PGD (in-circuit serial programming data) synchronized by ICSPCLK/PGC (clock). If the target board does not need too much current, it can be powered from the host computer via the universal serial bus (USB) programming module (VDD and VSS). For example, the PIC 16F690-based low- pin count (LPC) demo board can be programmed without an external supply. The target board reset can be controlled from MPLAB (!MCLR) and VPP provides the programming voltage.
If the chip and development system support ICD, the same MPLAB simulation tools can be used to test the program as it runs in the actual chip, with the real hardware providing the inputs and outputs. This allows the interaction with the target hardware to be examined more closely and a final debugging stage implemented to ensure correct operation of the MCU in the actual
circuit. All the usual techniques are available: single stepping, breakpoints, register monitoring and so on. The finished program can then be run at full speed in the target hardware, and any final bugs removed that become apparent. Previously, an expensive in-circuit emulator would have been needed for this type of testing.
Unfortunately, the 16F690 chip does not support ICD without a header. If this feature is required, the 44-pin demo board with the 16F887 chip on board is available, since this chip contains the ICD interface while the 16F690 does not.