Pages

CHAPTER 4 PIC microcontroller programming with MPLAB

CHAPTER 4

MPLAB

Introduction
4.1 Installing the MPLAB program package
4.2 Welcome to MPLAB
4.3 Designing a project
4.4 Designing new Assembler file
4.5 Writing a program
4.6 Toolbar icons
4.7 MPSIM simulator

Introduction

MPLAB is a Windows program package that makes writing and developing a program easier. It could best be described as developing environment for a standard program language that is intended for programming a PC. Some operations which were done from the instruction line with a large number of parameters until the discovery of IDE "Integrated Development Environment" are now made easier by using the MPLAB. Still, our tastes differ, so even today some programmers prefer the standard editors and compilers from instruction line. In any case, the written program is legible, and a well documented help is also available.

4.1 Installing the program -MPLAB

clip_image001

MPLAB consists of several parts:
- Grouping the projects files into one project (Project Manager)
- Generating and processing a program (Text Editor)
- Simulator of the written program used for simulating program function on the microcontroller.
Besides these, there are support systems for Microchip products such as PICStart Plus and ICD (In Circuit Debugger). As this book does not cover them , they will be mentioned as options only.
Minimal hardware requirements for starting the MPLAB are:
· PC compatible computer 486 or higher
· Microsoft Windows 3.1x or Windows 95 and new versions of the Windows operating system
· VGA graphic card
· 8MB memory (32MB recommended)
· 20MBs of free space on hard disk
· Mouse
In order to start the MPLAB we need to install it first. Installing is a process of copying MPLAB files from the CD onto a hard disc of your computer. There is an option on each new window which helps you return to a previous one, so errors should not present a problem or become a stressful experience. Installation itself works much the same as installation of most Windows programs. First you get the Welcome screen, then you can choose the options followed by installation itself, and, at the end, you get the message which says your installed program is ready to start.
Steps for installing MPLAB:
1. Start-up the Microsoft Windows
2. Place the Microchip CD into CD ROM drive
3. Click on START in the bottom left corner of the screen and choose the RUN option
4. Click on BROWSE and select CD ROM drive of your computer.
5. Find directory called MPLAB on your CD ROM
6. Click on MPLAB v6.31.EXE and then on OK .
7. Click again on OK in your RUN window
Installing begins after these seven steps. The following images explain specific installation stages. At the very beginning, small blue window will appear to notify you that the installation has begun.

clip_image002

Initializing Wise Installation Wizard

The following window will warn you to close all the running applications, or preferably run this installation program from a re-boot.

clip_image003

Welcome screen and an advice to re-boot prior to installation

Next is Software License Agreement window. In order to proceed with the installation, read the conditions, select the option "I Agree" and click on NEXT.

clip_image004

Software License Agreement window

The following window concerns the installation folder. Unless there is a specific reason for changing the default destination, you should leave it be.

clip_image005

Determining the destination directory for MPLAB

Next option is meant for users who owned previous version(s) of MPLAB. Purpose of the option is to backup all files that will replaced during the installation of the latest version. Assuming that this is our first installation of MPLAB, you should leave NO selected and click on NEXT.

clip_image005[1]

Option to backup old files from the previous version

Installation Wizard will ask you if you want to create shortcuts to access MPLAB from the start menu. Click on NEXT to proceed with installation.

clip_image006

Adding MPLAB to the Start Menu

It is certainly useful to have MPLAB icon on desktop if you will be using the program frequently. We suggest clicking on Yes. Then, click on NEXT to proceed with installation.

clip_image007

Adding MPLAB to the Start Menu

Ready to install! Click on NEXT to start copying the necessary files to your PC.

clip_image008

Screen prior to installation

Installation does not take long, and the installation flow can be monitored on a small window in the right corner of the screen.

clip_image009

Installation flow

After installation have been completed, there are two dialog screens, one for the last minute information regarding program versions and corrections, and the other is the welcome screen. If text files (Readme.txt) have opened, they would need to be closed.

clip_image010

View README files?

In order to install the USB device driver for MPLAB ICD2 you need to follow the instructions that will be displayed by executing Ddicd2XP.htm in the explorer window that has been opened during this installation. The installation is automatic when the MPLAB ICD2 is connected to the USB port. The instructions are for reference.

By clicking on Finish, installation of MPLAB is finished.

clip_image011