Выбрать главу

The ICD2, a low-cost in-circuit debugger (see Figure 5.17) manufactured by Microchip Inc., can debug most PIC microcontroller-based systems. With the ICD2, programs are downloaded to the target microcontroller chip and executed in real time. This debugger supports both assembly language and C language programs.

Figure 5.17: ICD2 in-circuit debugger

The ICD2 connects to a PC through either a serial RS232 or a USB interface. The device acts like an intelligent interface between the PC and the test system, allowing the programmer to set breakpoints, look into the test system, view registers and variables at breakpoints, and single-step through the user program. It can also be used to program the target PIC microcontroller.

ICD-U40

The ICD-U40 is an in-circuit debugger (see Figure 5.18) manufactured by Custom Computer Services Inc. to debug programs developed with their CCS C compiler. The device operates with a 40MHz clock frequency, is connected to a PC via the USB interface, and is powered from the USB port. The company also manufactures a serial-port version of this debugger called ICD-S40, which is powered from the target test system.

Figure 5.18: ICD-U40 in-circuit debugger

PICFlash 2

The PICFlash 2 in-circuit debugger (see Figure 5.19) is manufactured by mikroElektronika and can be used to debug programs developed in mikroBasic, mikroC, or mikroPascal languages. The device is connected to a PC through its USB interface. Power is drawn from the USB port so the debugger requires no external power supply. The PICFlash 2 is included in the BIGPIC4 development kit. Details on the use of this in-circuit debugger are discussed later in this chapter.

Figure 5.19: PICFlash 2 in-circuit debugger

5.2.4 In-Circuit Emulators

The in-circuit emulator (ICE) is one of the oldest and the most powerful devices for debugging a microcontroller system. It is also the only tool that substitutes its own internal processor for the one in the target system. Like all in-circuit debuggers, the emulator’s primary function is target access—the ability to examine and change the contents of registers, memory, and I/O. Since the emulator replaces the CPU, it does not require a working CPU in the target system. This makes the in-circuit emulator by far the best tool for troubleshooting new or defective systems.

In general, each microcontroller family has its own set of in-circuit emulators. For example, an in-circuit emulator designed for the PIC16 microcontrollers cannot be used for PIC18 microcontrollers. Moreover, the cost of in-circuit emulators is usually quite high. To keep costs down, emulator manufacturers provide a base board which can be used with most microcontrollers in a given family, for example, with all PIC microcontrollers, and also make available probe cards for individual microcontrollers. To emulate a new microcontroller in the same family, then, only the specific probe card has to be purchased.

Several models of in-circuit emulators are available on the market. The following four are some of the more popular ones.

MPLAB ICE 4000

The MPLAB ICE 4000 in-circuit emulator (Figure 5.20), manufactured by Microchip Inc., can be used to emulate microcontrollers in the PIC18 series. It consists of an emulator pod connected with a flex cable to device adapters for the specific microcontroller. The pod is connected to the PC via its parallel port or USB port. Users can insert an unlimited number of breakpoints in order to examine register values.

Figure 5.20: MPLAB ICE 4000

RICE3000

The RICE3000 is a powerful in-circuit emulator (Figure 5.21), manufactured by Smart Communications Ltd, for the PIC16 and PIC18 series of microcontrollers.

Figure 5.21: RICE3000 in-circuit emulator

The device consists of a base unit with different probe cards for the various members of the PIC microcontroller family. It provides full-speed real-time emulation up to 40MHz, supports observation of floating point variables and complex variables such as arrays and structures, and provides source level and symbolic debugging in both assembly and high-level languages.

ICEPIC 3

The ICEPIC 3 is a modular in-circuit emulator (see Figure 5.22), manufactured by RF Solutions, for the PIC12/16 and PIC18 series of microcontrollers. It connects to the PC via its USB port and consists of a mother board with additional daughter boards for each microcontroller type. The daughter boards are connected to the target system with device adapters. A trace board can be added to capture and analyze execution addresses, opcodes, and external memory read/writes.

Figure 5.22: ICEPIC 3 in-circuit emulator

PICE-MC

The PICE-MC, a highly sophisticated emulator (see Figure 5.23) manufactured by Phyton Inc., supports most PIC microcontrollers and consists of a main board, pod, and adapters. The main board contains the emulator logic, memory, and an interface to the PC. The pod contains a slave processor that emulates the target microcontroller. The adapters are the mechanical parts that physically connect to the microcontroller sockets of the target system. The PICE-MC provides source-level debugging of programs written in both assembly and high-level languages. A large memory is provided to capture target system data. The user can set up a large number of breakpoints and can access the program and data memories to display or change their contents.

Figure 5.23: PICE-MC in-circuit emulator

5.2.5 Breadboards

Building an electronic circuit requires connecting the components as shown in the relevant circuit diagram, usually by soldering the components together on a strip board or a printed circuit board (PCB). This approach is appropriate for circuits that have been tested and are functioning as desired, and also when the circuit is being made permanent. However, making a PCB design for just a few applications — for instance, while still developing the circuit — is not economical.

Instead, while the circuit is still under development, the components are usually assembled on a solderless breadboard. A typical breadboard (see Figure 5.24) consists of rows and columns of holes spaced so that integrated circuits and other components can be fitted inside them. The holes have spring actions so the component leads are held tightly in place. There are various types and sizes of breadboards, suitable for circuits of different complexities. Breadboards can also be stacked together to make larger boards for very complex circuits. Figure 5.25 shows the internal connection layout of the breadboard in Figure 5.24.

Figure 5.24: A typical breadboard layout

Figure 5.25: Internal wiring of the breadboard in Figure 5.24

The top and bottom halves of the breadboard are entirely separate. Columns 1 to 20 in rows A to F are connected to each other on a column basis. Rows G to L in columns 1 to 20 are likewise connected to each other on a column basis. Integrated circuits are placed such that the legs on one side are on the top half of the breadboard, and the legs on the other side are on the bottom half. The two columns on the far left of the board are usually reserved for the power and ground connections. Connections between components are usually made with stranded (or solid) wires plugged into the holes to be connected.

Figure 5.26 shows a breadboard holding two integrated circuits and a number of resistors and capacitors.

Figure 5.26: Picture of a breadboard with some components