5.1 Software Development Tools
Software development tools are computer programs, usually run on personal computers, that allow the programmer (or system developer) to create, modify, and test applications programs. Some common software development tools are:
• Text editors
• Assemblers/compilers
• Simulators
• High-level language simulators
• Integrated development environments (IDEs)
5.1.1 Text Editors
A text editor is used to create or edit programs and text files. The Windows operating system comes with a text editor program called Notepad. Using Notepad, we can create a new program file, modify an existing file, or display or print the contents of a file. It is important to realize that programs used for word processing, such as Microsoft Word, cannot be used for this purpose, since they embed word formatting characters such as bold, italic, and underline within the text.
Most assemblers and compilers come with built-in text editors, making it possible to create a program and then assemble or compile it without having to exit from the editor. These editors provide additional features as well, such as automatic keyword highlighting, syntax checking, parenthesis matching, and comment line identification. Different parts of a program can be shown in different colors to make the program more readable (e.g., comments in one color and keywords in another). Such features help to eliminate syntax errors during the programming stage, thus speeding up the development process.
5.1.2 Assemblers and Compilers
Assemblers generate executable code from assembly language programs, and that generated code can then be loaded into the flash program memory of a PIC18-based microcontroller. Compilers generate executable code from high-level language programs. The compilers used most often for PIC18 microcontrollers are BASIC, C, and PASCAL.
Assembly language is used in applications where processing speed is critical and the microcontroller must respond to external and internal events in the shortest possible time. However, it is difficult to develop complex programs using assembly language, and assembly language programs are not easy to maintain.
High-level languages, on the other hand, are easier to learn, and complex programs can be developed and tested in a much shorter time. High-level programs are also maintained more easily than assembly language programs.
Discussions of programming in this book are limited to the C language. Many different C language compilers are available for developing PIC18 microcontroller-based programs. Some of the popular ones are:
• CCS C (http://www.ccsinfo.com)
• Hi-Tech C (http://htsoft.com)
• C18 C (http://www.microchip.com)
• mikroC C (http://www.mikroe.com)
• Wiz-C C (http://www.fored.co.uk)
Although most C compilers are essentially the same, each one has its own additions or modifications to the standard language. The C compiler used in this book is mikroC, developed by mikroElektronika.
5.1.3 Simulators
A simulator is a computer program that runs on a PC without the microcontroller hardware. It simulates the behavior of the target microcontroller by interpreting the user program instructions using the microcontroller instruction set. Simulators can display the contents of registers, memory, and the status of input-output ports as the user program is interpreted. Breakpoints can be set to stop the program and check the contents of various registers at desired locations. In addition, the user program can be executed in a single-step mode, so the memory and registers can be examined as the program executes one instruction at a time as a key is pressed.
Some assembler programs contain built-in simulators. Three popular PIC18 microcontroller assemblers with built-in simulators are:
• MPLAB IDE (http://www.microchip.com)
• Oshon Software PIC18 simulator (http://www.oshonsoft.com)
• Forest Electronics PIC18 assembler (http://www.fored.co.uk)
5.1.4 High-Level Language Simulators
High-level language simulators, also known as source-level debuggers, are programs that run on a PC and locate errors in high-level programs. The programmer can set breakpoints in high-level statements, execute the program up to a breakpoint, and then view the values of program variables, the contents of registers, and memory locations at that breakpoint.
A source-level debugger can also invoke hardware-based debugging using a hardware debugger device. For example, the user program on the target microcontroller can be stopped and the values of various variables and registers can be examined.
Some high-level language compilers, including the following three, have built-in source-level debuggers:
• C18 C
• Hi-Tech PIC18 C
• mikroC C
5.1.5 Integrated Development Environments (IDEs)
Integrated development environments (IDEs) are powerful PC-based programs which include everything to edit, assemble, compile, link, simulate, and source-level debug a program, and then download the generated executable code to the physical microcontroller chip using a programmer device. These programs are in graphical user interface (GUI), where the user can select various options from the program without having to exit it. IDEs can be extremely useful when developing microcontroller-based systems. Most PIC18 high-level language compilers are IDEs, thus enabling the programmer to do most tasks within a single software development tool.
5.2 Hardware Development Tools
Numerous hardware development tools are available for the PIC18 microcontrollers. Some of these products are manufactured by Microchip Inc., and some by third-party companies. The most ones are:
• Development boards
• Device programmers
• In-circuit debuggers
• In-circuit emulators
• Breadboards
5.2.1 Development Boards
Development boards are invaluable microcontroller development tools. Simple development boards contain just a microcontroller and the necessary clock circuitry. Some sophisticated development boards contain LEDs, LCD, push buttons, serial ports, USB port, power supply circuit, device programming hardware, and so on. This section is a survey of various commercially available PIC18 microcontroller development boards and their specifications.
The LAB-XUSB Experimenter board (see Figure 5.1), manufactured by microEngineering Labs Inc., can be used in 40-pin PIC18-based project development. The board is available either assembled or as a bare board.