![]() | MPLAB VERSIONS |
|
"Easy PIC'n" and "Easy Microcontrol'n" version 4.0 were based on MPLAB versions up to 5.70. With version 4.1 of "Easy Microcontrol'n", we changed to MPLAB 7.xx because we expected that MPLAB 5.70 would go away. Now it is gone. For "Easy PIC'n" and "Easy Microcontrol'n" version 4.0 readers who want to use MPLAB 7.xx, an overview is presented below. MPLAB 7.xx was initially developed for the high-end 18 series devices and has been upgraded backwards to support less sophisticated devices. Device support has been added for all 12 and 16 series devices. Both MPLAB versions are currently available. MPLAB 7.xx has a LOT of differences with respect to 5.xx.
MPLAB 5.xx MPLAB 7.xx
------------------------- -------------------------
Select tool, then device Select device, then tool
Use "modify" dialog boxes Edit values directly
to edit values in text windows
Has status boxes Has text windows
Configuration word Configuration word
ignored for ICD used for ICD 2, but
selections can be
changed on-screen
They are quite different in look and feel. If you purchase an ICD 2 and want it to work with the 14-bit core devices that have in-circuit debugging capability (F870, F818, etc.), you will need to use 7.xx. MPLAB 7.00 kick-start instructions follow for your use when the need arises. These instructions replace pages 40 through 44 in "Easy Microcontrol'n" Version 4.0 (or pages 37 through 42 in "Easy PIC'n").
MPLAB V. 7.00 OVERVIEW - GETTING STARTEDMPLAB 7.xx is easy to find on Microchip's website. MPLAB v7.00 is a large program with lots of whiz-bang features, so it would take a whole book to describe it completely. As with most computer programs these days, you will only need to know a little bit to get started using it. That's next. Microchip continually releases new versions of MPLAB. The following instructions will help get you started if you are using v7.00 or later. MPLAB v7.00 is the current version as this is being written. USING MPLAB - GETTING STARTED Using MPLAB may seem a bit strange at first because of the terminology. It will soon become familiar and will be easy to use. Having the text editor, MPASM assembler, and PICSTART Plus (if you use it) software open/accessible simultaneously and to be able to switch back and forth quickly at will is nice. We will assume the use of Windows 98 for the following example. We will assume that the assembly source files you create will be stored in the same folder as MPLAB 7.00. Open MPLAB by double-clicking the Microchip MPLAB icon. The MPLAB window will appear with a blank "document" at the left side of the screen labeled "Untitled Workspace". Close Untitled Workspace. MPLAB is ready for use. Text Editor A text editor is built into MPLAB. In the file menu, click "New". A window labeled "Untitled" will appear. Now you can type in some sample code. We will use PICT1.ASM from Easy Microcontrol'n, page 28. When you are finished, save the file (File>Save). In the "Save As" dialog box, edit the file name. Use the .ASM extension (PICT1.ASM). Save as type ".asm". Save in the same folder as MPLAB 7.00 (or the more recent version 7.xx you may be using). Click "Save". Project A principal new term you will need to know to use MPLAB is "project". A project is one or more files grouped together and used to make code for a PIC microcontroller. The best way to learn this stuff is by doing a simple example. Click "Project" in the menu bar. Click "Project Wizard" in the drop-down list (Project>Project Wizard). Welcome! Click "Next". In the Project Wizard Step 1 dialog box: Select the PIC16F84A. Click "Next". In the Project Wizard Step 2 dialog box: Use the default toolsuite (MPASM). Click "Next". In the Project Wizard Step 3 dialog box:
The Project Wizard Step 4 dialog box will appear. Scroll down and find the file name "PICT1.ASM". Highlight it. Click "Add". This associates the assembly source code file with the project. Click "Next". The Project Wizard Summary dialog box will appear. Click "Finish". The PICT1.PJT.mcw window will appear. You cannot close it. Assembler
Open your assembly source file (File>Open). Find and highlight "PICT1.ASM". To assemble your source code (with your project open and the source code on screen), click "Make Project" under the project menu (Project>Make). The terminology is a bit strange. Clicking "Make Project" causes the source code to be assembled by MPASM, the assembler which is built into MPLAB. The result is a file with your file name and the extension .HEX (dot hex file). The assembly process ends with the Build window being displayed. If your code assembles properly, the message "Build Succeeded" will appear. If there are errors or warnings, each error or warning in the list will have a source code line number associated with it. If you open the source code window's drop down list, you will see that the last item on the list is "Toggle line numbers". Clicking on this will cause line numbers to appear in the left margin of the source code. Clicking again causes the line numbers to go away. Ignore the warning message associated with use of the TRIS instruction. Close the Build window.
Last, save your project via Project>Save Project. Then close your project via Project>Close Project. Close MPLAB. MORE MPLAB OPERATIONS As you gain more experience, you may wish to perform certain tasks without using the Project Wizard or to perform some other tasks. Create a New Project Project>New. The New Project dialog box appears.
Select a directory for the new project by clicking on the"Browse" button and workingyour way to the MPLAB 7.00 folder (or the more recent version 7.xx you may be using). Click "OK". Select Device Type
Click "Configure" in the menu bar. In the Select Device dialog box:
The Select Device dialog box will close.
Add a File to a Project
Remove a File From a Project To View And Print A .LST File In the file menu, select "View". A dialog box will appear. Type in the name of the file you would like to view and print (example: PICT1.LST). Click "OK". The file will appear on screen. To print the file, select "Print" in the file menu. To Delete A Project Delete the project files using My Computer. It is the only way it can be done. Window Menu Status boxes do not pop up automatically with MPLAB version 7.00. It is necessary to select the window you want to view at any point in time by selecting Window>whatever. If you want to know the status of something MPLAB is (hopefully) doing for you, use Window>. Line Numbers Error messages generated on completion of assembly refer to source code line numbers. Line numbers may be displayed or not as you choose. To display line numbers, press the right mouse button with the .asm file of interest open. A list will appear. Click on Properties.
The Editor Options dialog box will appear. If you no longer wish to display line numbers, go through the procedure again and uncheck line numbers. Tab Size (Spacing) To change tab size (spacing), press the right mouse button with the .asm file of interest open. A list will appear.Click on Properties.The Editor Options dialog box will appear. Assembly Source Color Options With the .asm file of interest open, highlight some text. Press the right mouse button . A list will appear. Click on Properties. The Editor Options dialog box will appear.
The Editor Color Customization dialog box reappears. Click Ok. The Editor Options dialog box reappears. MPLAB V. 8.0 UPDATEPage 40 Near the bottom of the page, change the paragraph which begins with "Save in the same folder" to: Save in a folder wherever it is convenient for future access. In the Jump To: box, enter the directory where your folder will be. Page 41 The Project Wizard works a bit differently in MPLAB 8.x In the Project Wizard Step 3 dialog box:
Save Project As dialog box appears.
PICT1.mcp PICT1 is your project name .mcp means project The Project Wizard Step 3 dialog box is open. PROGRAMMING A DEVICEBy now you have had an opportunity to assemble the source code file PICT1.ASM and are ready to proceed with programming the .HEX file created by MPASM (the assembler included in MPLAB) into a PIC16F84A device. MPLAB The "make project" process in MPLAB creates a .HEX file (PICT1.HEX in this case). If you have a PICSTART Plus, the device programming instructions follow. If you have another programmer, you may need to close the MPLAB program and open the driver software for the device programmer. The driver software and the .HEX file should be in the same directory. Follow the device programmer manufacturer's instructions. USING PICSTART PLUS Begin by opening your existing project in MPLAB. Choose "Project Open" in the project menu followed by finding your way to the MPLAB 7.00 folder and selecting your project by name (PICT1.PJT). Choose "Open" in the file menu and select "PICT1.ASM". To Enable PICSTART Plus
Click on "Programmer" in menu bar. To Program A Device
Power-up the PICSTART Plus. Pass:1 Fail:0 Total:1 To Read A Device Programmer>Read. To Erase A Flash Device Programmer>Erase Flash Device. THE BIG TEST!
Insert the programmed PIC16F84A into the socket on your test board (power off!). Power up the test board. The LEDs connected to port B should be off/on as follows: -------------------------------- Bit 7 6 5 4 3 2 1 0 ![]()
If you have questions, contact us by eMail at sqone@pacific.net, telephone (208) 664-4115, fax (208) 772-8236. Dave & Wanda [Contact US ]
[TOP OF PAGE] |