Page 226 - Mechatronics with Experiments
P. 226
212 MECHATRONICS
Microcontroller Development Tools for PIC 18F452 The development
board for PIC 18F452 (and PIC 18F4331) is the PICDEM 2 Plus Demo board plus vari-
ous peripheral hardware devices that allow the PIC 18F452 microcontroller to effectively
interface with electro-mechanical devices. These include a proper power supply through a
9V AC/DC adapter and regulator, a 4 MHZ clock, RS-232 interface, LCD, four LEDs, and
a prototyping area.
The MPLAB ICD 3 module is a low cost debug and development tool that connects
between the PC and the PICDEM 2 Plus Demo board (or the designer’s target board) allow-
ing direct in-circuit debugging of PIC 18F452 microcontroller (Figure 4.2). It is also used
as the communication and programmer tool between PC and the PIC Development Board.
Using the MPLAB ICD 3, PC communicates with PIC Development Board, downloads
programs to it, and debugs programs while running it on the PIC microcontroller.
Programs can be executed in real-time or single step mode, watch variables estab-
lished, break points set, memory read/writes accomplished, and more. It is also used as a
development programmer for the microcontrollers to download and save the code in the
microcontroller memory.
Hardware development tools are:
1. The PC as the host for development tools.
2. The development board (PICDEM 2 Plus Demo board), which has the microcontroller
(PIC 18F452), its power supply, support circuits, and space for breadboard for custom
application specific hardware interface development.
3. The communication cable and in-circuit debugger hardware (MPLAB ICD 3) for
downloading and debugging programs.
Software development tools that run on a PC and are interfaced to the board via the
communication cable are:
1. MPLAB IDE V.6xx integrated development environment (IDE) which includes an
editor, assembler (MPASM), linker (MPLINK), debugger, and software simulator
(MPLAB SIM) for the PIC chip.
2. MPLAB C18 C-compiler (works under MPLAB IDE V.6xx).
There are two debugger tools:
1. A debugger in software MPLAB SIM, which simulates the target PIC microcontroller
on the PC, and allows debugging of the logic on the PC. This of course not a real-time
debugger.
2. A real-time hardware debugger using the ICD3. ICD3 is also used at the communi-
cation device between the PC and PIC board, and as a programmer to download the
executable code from the PC to PIC Board.
It is recommended that basic logic functionality be debugged using the MPLAB SIM
simulator (software debugger). Then, when the I/O verifications is needed, the application
program should be debugged on the target PIC board using the ICD3 hardware. Using
ICD3, we can run the application program on the target PIC microcontroller and run it in
real-time. However, during debugging we are most likely to run the program in sections,
put “break points” to stop the program, “Step by Step” execute the code, and examine
(“Watch”) variables.
The PIC microcontroller can be programmed in a number of ways, using both C-
language and assembly language. Our lab experiments require the use of the MPLAB IDE
together with the MPLAB C18 ANSI-compliant C compiler installed on a PC. The language
tool suite also consists of the MPASM assembly language interpreter, the MPLINK object