ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 14.06.2025

Просмотров: 973

Скачиваний: 0

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

Chapter 5 - MPLAB

installment steps.

Welcome screen at the beginning of MPLAB installment

At the very beginning, it is necessary to select those MPLAB components we will be working with. Since we don't have any original Microchip hardware components such as programmers or emulators, we will only install MPLAB environment, Assembler, Simulator and the instructions.

Chapter 5 - MPLAB

Selecting components of MPLAB developing environment

As it is assumed you will work in Windows 95 ( or a newer operating system), everything in connection with DOS operating system has been taken out during selection of assembler language. However, if you still wish to work in DOS, you need to deselect all options connected with Windows, and choose the components appropriate for DOS.

Chapter 5 - MPLAB

Selecting the assembler and the operating system

Like any other program, MPLAB should be installed into some directory. This option could be moved into any directory on any hard disc of your computer. If you didn't have a more pressing need, it should be left at selected place.

Chapter 5 - MPLAB

Choosing the directory where MPLAB will be installed

Users who have already had MPLAB (older version than this one) need the following option.

The purpose of this option is to save copies of all files which will be modified during a changeover to a new MPLAB version. In our case we should leave selected NO because of presumption that this is your first installment of MPLAB on your computer.

Chapter 5 - MPLAB

Option for users who are installing a new version over an already installed MPLAB

Start menu is a group of program pointers, and is selected by clicking on START option in the lower left corner of the screen. Since MPLAB will be started from here, we need to leave this option as it is.

Chapter 5 - MPLAB

Adding the MPLAB to the start menu

Location that will be mentioned from here on, has to do with a part of MPLAB whose explanation we don't need to get into. By selecting a special directory , MPLAB will keep all files in connection with the linker in a separate directory.

Chapter 5 - MPLAB

Determining a directory for linker files

Every Windows program has system files usually stored in a directory containing Windows program. After a number of different installments, the Windows directory becomes overcrowded and too big. Thus, some programs allow for their system files to be kept in same directories with programs. MPLAB is an example of such program, and the bottom option should be selected.

Chapter 5 - MPLAB

Selecting a directory for system files

After all of the above steps, installment begins by clicking on 'Next'.

Chapter 5 - MPLAB

Screen prior to installment

Installment doesn't take long, and the process of copying the files can be viewed on a small window in the right corner of the screen.

Chapter 5 - MPLAB

Installment flow

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

Chapter 5 - MPLAB

Last minute information regarding program versions and corrections.

By clicking on Finish, installment of MPLAB is finished.

Previous page

Table of contents

Chapter overview


Chapter 5 - MPLAB

Previous page

Table of contents

Chapter overview

Next page

5.2 MPLAB

Following the installment procedure, you will get a screen of the program itself. As you can see, MPLAB looks like most of the Windows programs. Near working area there is a "menu" (upper blue colored area with options File, Edit..etc.), "toolbar" (an area with illustrations the size of small squares), and status line on the bottom of the window. There is a rule in Windows of taking some of the most frequently used program options and placing them below the menu, too. Thus we can access them easier and speed up the work. In other words, what you have in the toolbar you also have in the menu.

The screen after starting the MPLAB

Chapter 5 - MPLAB

The purpose of this chapter is for you to become familiar with MPLAB developing environment and with basic elements of MPLAB such as:

Choosing a developing mode Designing a project

Designing a file for the original program

Writing an elementary program in assembler program language Translating a program into executive code

Starting the program

Opening a new window for a simulator

Opening a new window for variables whose values we watch (Watch Window) Saving a window with variables whose values we are watching

Setting the break points in a simulator (Break point)

Preparing a program to be read in a microcontroller can boil down to several basic steps:

Previous page

Table of contents

Chapter overview

webmaster.

Chapter 5 - MPLAB

Previous page

Table of contents

Chapter overview

Next page

5.3 Choosing the development mode

Setting a developing mode is necessary so that MPLAB can know what tools will be used to execute the written program. In our case, we need to set up the simulator as a tool that's being used. By clicking on OPTIONS---> DEVELOPMENT MODE, a new window will appear as in the picture below:

Setting a developing mode

We should select the 'MPLAB-SIM Simulator' option because that is where the program will be tried out. Beside this option, the 'Editor Only' option is also available. This option is used only if we want to write a program and by programmer write' hex file' in a microcontroller. Selection of the microcontroller model is done on the right hand side. Since this book is based on the PIC16F84, this model should be selected.

Usually when we start working with microcontrollers, we use a simulator. As the level of knowledge will have increased, program will be written in a microcontroller right after translation. Our advice is that you always use the simulator. Though program will seem to develop slower, it will pay off in the end.


Chapter 5 - MPLAB

Previous page

Table of contents

Chapter overview

webmaster.


Chapter 5 - MPLAB

Previous page

Table of contents

Chapter overview

Next page

5.4 Designing a project

In order to start writing a program you need to create a project first. By clicking on PROJECT --> NEW PROJECT you are able to name your project and store it in a directory of your choice. In the picture below, a project named 'test.pjt' is being created and stored in c:\PIC\PROJEKTS\ directory.

This directory is chosen because authors had such directory set up of on their computer. Generally speaking, directory with files is usually placed in a larger directory whose name is unmistakably associated with its contents.

Opening a new project

After naming the project, click on OK. New window comes up as in the next picture.

Chapter 5 - MPLAB

Adjusting project elements

Using a mouse click on "test [.hex]" which activates 'Node properties' option in the bottom right corner of a window. By clicking on it you get the following window.

Chapter 5 - MPLAB

Defining parameters of MPASM assembler

From the picture we see that there are many different parameters. Each kind corresponds to one parameter in "Command line" . As memorizing these parameters is very uncomfortable, even forbidding for beginners, graphic adjustment has been introduced. From the picture we see which options need to be turned on. By clicking on OK we go back to previous window where "Add node" is an active option. By clicking on it we get the following window where we name our assembler program. Let's name it "Test.asm" since this is our first program in MPLAB.

Chapter 5 - MPLAB

Opening a new project

By clicking on OK we go back to the starting window where we see added an assembler file.

Chapter 5 - MPLAB

Assembler file added

By clicking on OK we return to MPLAB environment.

Previous page

Table of contents

Chapter overview