Microchip MPLAB IDE User Guide

Fairuz Abdullah
1. What is MPLAB IDE

It is a software develop by Microchip to help programmer develop software for application using their product. It consist of a text editor, a simulator, a cross assembler that support all microcontrollers and digital signal processor and a device driver made by Microchip.
2. Getting Started

To start, select Start Menu > Programs > Microchip > MPLAB IDE v8.10 > MPLAB IDE. Or you can simply click on the icon (icon fig) on your desktop. A splash screen appears for a while then followed by this MPLAB IDE desktop (Figure 1).

Figure 1: MPLAB IDE Desktop


Using MPLAB To start using MPLAB you have to create a new project. Create a new project 2. or ICD2. Enter source files 3.A. debug the project using the simulator. To do so. 1.3. Add source files into the project 4. Then click OK. you must configure the project and select the target device. Make sure the setting follows what is shown in Figure 2. Here are the steps to do such that. or ICE 3. complile and build the executable code 5. Creating simple project Before creating new project. go to Configure > settings menu and choose the Project tab. 2 .

you will use PIC18F452. we will use PIC18F452 throughout as the device. To select device go to Configure > Select Devices. by default. all this setting is already at what you want.. and the selection as shown in Figure 3. Click OK when you have make the necessary change. As an example. 3 .Figure 2: Configure the project Next is to select the right device. For this course. However. You can just open MPLAB IDE and straight away use it.. Meaning you don’t have to make any change. Make sure also the MPLAB SIM bubble is green.

Selece Project > New and the dialog box (Figure 4) opens. Figure 4: New project dialog 4 . whatever you like and select a place to save the file. click OK.Figure 3: Select device dialog Now it is time to create new project. Once finished. Type a file name.

Once you have created new project. menu. Make sure you select MPASM Toolsuite. Once a window shown in Figure 5 opens. you need to set language tools location so that MPLAB can assemble you file correctly.. Then click OK. Next is to select the language tool. and windows depicted in Figure 6 opens. select Project > Set Language Tools Locations.. Click Project > Select Language Tools. To do so. select MPASM Assembler as depicted in the figure.. Figure 5: Setting language tool location dialog 5 ..

Select File > New. you have to include the assembly file in the project. and select the assembly file you created previously as depicted in Figure 7. Type you program and save it with extension . To do that. Once you finished typing your program and save.asm..Figure 6: Dialog for selecting language tool suite Now you can create new file.. 6 . click Project > Add files to project.

the assembly file name is listed.Figure 7: Select input file dialog Select View > Project to open windows like in Figure 8. This mean that the file is already included in the project. 7 . Make sure under Source Files folder.

Once you finished building the assembly file.Figure 8: Project pane Next is to build the assembly file. Once you do that. it will appear in output window. MPLAB SIM text will appear in status bar as shown in Figure 9 (circled in red). Select Debugger > Select Tool > MPLAB SIM. Double click on the error list and MPLAB will show the error location in your assembly file. Select Project > Build All or press Ctrl+F10. 8 . Troubleshoot the program and rectify the error before you save and build again. The assembly will do its work now and if there is any error. it is time to simulate.

Click reset. 9 .Figure 9: MPLAB IDE window status change after selecting SIM On top right corner of the tool bar. In the assembly file window. you will see a green arrow appear at the start of you program as shown in Figure 10. yellow colored icon and this will make the simulator reset and go to the start on the program. you can see a set of new icons appear.

When you move your cursor over a variable in the source code.Figure 10: Source code window after Reset This indicates that the simulator (processor) is ready to run the program. 10 . To go one step or run one step at a time. which may be next line or few lines after. you can press F7 and you will notice that the green arrow jump to next instruction. MPLAB will display the current value the variable hold as depicted in Figure 11.

you want to watch WREG. any changes in the variable and register will be marked by red-coloured numbers. you can select View > Watch and it will open the window shown in Figure 12a where you can type the symbol name or variable name or the address you want to watch. For example. When you run the program. just type WREG in symbol name and press enter.Figure 11: Mouse over variable ”count” If you want to watch multiple variables and registers at the same time. 11 .

(a) Watch window for tutor1 (b) Watch window after step through the program Figure 12: Watch window 12 .

Sign up to vote on this title
UsefulNot useful