Sei sulla pagina 1di 9

Getting Started with MPLAB Harmony Integrated Software Framework

1 de 9

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

English

Search Microchip
Search Data Sheets

PRODUCTS

APPLICATIONS

DESIGN SUPPORT

TRAINING

SAMPLE & BUY

ABOUT US

Contact Us
myMicrochip Login
[Signout, My Account]

Welcome, diego gachet


Home

Products Home Page

Helpful Links
Software Libraries
Application Notes
Code Examples
Data Sheets
Development Tools
MCU & DSC Overview
8-bit
16-bit
32-bit
Application Design Centers

16-bit PIC MCUs & dsPIC Digital Signal Controllers

Getting Started with MPLAB Harmony Integrated Software Framework

6.

MPLAB Harmony is a fully integrated firmware framework with associated libraries, example applications, and related collateral supporting features of PIC32
microcontrollers. Visit http://www.microchip.com/harmony for more information on this new framework.
Follow these steps to get started with MPLAB Harmony:
Download and Install MPLAB Harmony
Before You Start
Accessing MPLAB Harmony Documentation
Creating New Application
Configuring New Application

Download and Install MPLAB Harmony


MPLAB Harmony is a free download available at http://www.microchip.com/harmony. Download and follow the instruction in the installer.

Before You Start


Install MPLAB Harmony Help and MPLAB Harmony Configurator plugin modules for MPLAB X IDE (if not installed already). Adding these plugin modules allows
you to access the MPLAB Harmony Help and MPLAB Harmony Configurator from the MPLAB IDE menus.

Installing the Plugin Modules

1. Start MPLAB X
IDE and select
Plugins from the
Tools menu as
shown

2. Click the Add


Plugins button,
navigate to and open the
com-microchipharmony_help.nbm plug
in file as shown
. It can be found in the
installation directory
<install-dir>/doc

22/02/2014 17:42

Getting Started with MPLAB Harmony Integrated Software Framework

2 de 9

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

3. Click the "Add


Plugins..." button,
navigate to and open the
"com-microchipharmonyconfigurator.nbm"
plug in file as show
. It can be found in the
installation directory
<install-dir>/utilities
/configurator

4. Both check boxes for


MPLAB Harmony Help
and MPLAB Harnony
Configurator should be
checked. Ensure that they
are and click the Install
button.

5. Follow the prompts from the installation wizard and continue until the installation completes. Just click "continue"). Once the installation wizard has finished y
can close the "Plugins" dialog box.
You should now see a "MPLAB Harmony Configurator" option under the "Tools" menu. This indicates that the MPALB Harmony Configurator has been
successfully installed.

Accessing MPLAB Harmony Documentation


A comprehensive help is available for MPLAB Harmony which describes the purpose and interface for each framework component. You will need to
reference these sections as needed for integrating libraries in your application. It is recommended that you read all sections in Start Here. This will
provide key concepts to understanding MPLAB Harmony, the project layout and the structure and purpose of key source files. The Applications Help
section describes the demonstration projects and example applications included with the installation.
There are two help file options available:
1. MPLAB Harmony PDF file available in the installation directory <install-dir>/doc

2. MPLAB
Harmony Help can
also be accessed
from MPLAB X
IDE Help Menu as
shown

22/02/2014 17:42

Getting Started with MPLAB Harmony Integrated Software Framework

3 de 9

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

Creating New Application


There are two options for creating a new project: Using a supplied template or starting with a new project.

Use a Harmony Supplied Template


The basic_PIC32 template is located in the <install-dir>/apps/examples/templates/basic_pic32 directory. This template already contains a recommend
logical directory structure and has embedded TODO tags to help you to create your first Harmony Project. If you copy this template to a new location yo
will need to update the paths to libraries and directories to match your MPLAB Harmony installation directory. See read me file in the included with the
basic_pic32 project.

Use the MPLAB X IDE New Project Wizard

1. Open MPLAB X
IDE, and select
File > New Project
to open a project
wizard window. In
Categories, select
Microchip
Embedded and in
Projects, select
Standalone
Project. Click
Next.

2. Next, choose
the device. The
device you
choose will
determine what
peripheral libraries
are included in
your MPLAB
Harmony project

3. Continue in the
new project
Wizard, selecting
your hardware
and software
tools.

22/02/2014 17:42

Getting Started with MPLAB Harmony Integrated Software Framework

4 de 9

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

4. When you name and locate your project there are two choices. You can locate it in the apps folder of the MPLAB Harmony installation or you can
locate it outside of the Harmony installation. Placing the project in the apps folder of MPLAB Harmony will require you to copy it if you install a new
version of MPLAB Harmony. Installing your project outside of the MPLAB Harmony installation will require you to modify your include paths when a new
version of MPLAB Harmony is installed. It is recommend to use relative paths when installing in the apps folder in MPLAB Harmony. Make sure that yo
new project is set to the main (active) project.

5. Once the
MPLAB X IDE
project is created,
you should see a
screen similar to
the picture as
shown below.

Configuring New Application


There are three steps for configuring a new project: Determine and add required modules, as well as configure these modules.

Determine which MPLAB Harmony Modules are needed for your Application
Modules are divided into four categories; Peripheral Libraries, System Services, Device Drivers and other libraries (commonly called middleware). To
determine your needs, read the MPLAB Harmony Overview and the Introductory sections for the modules of interest in the help file. Some modules hav
dependencies while others do not. Peripheral Libraries have no dependencies. Drivers depend on peripheral libraries. System Services depend on
Peripheral Libraries and or Drivers. Your application or its middleware will typically use drivers or system services

Add the required Module Source Files to your Project


This can be accomplished by reading the help for each module to determine what source files you need and manually entering them into your project.
Alternatively, the MPLAB Harmony Configurator can be used to select the modules from a list or tree and it will automatically insert the source files into
your project and optionally generate a skeletal template for your project. Note that some modules have multiple implementations each optimized for
different purposes. Others may implement optional features in multiple files. Be sure to select the source file right for your implementation and be sure to

22/02/2014 17:42

Getting Started with MPLAB Harmony Integrated Software Framework

5 de 9

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

include the pre-built peripheral library binary .a file for the processor you selected in your project

Using MPLAB Harmony Project and MPLAB Harmony Configurator

1. The MPLAB
Harmony
Configurator can
be found in the
Tools menu of the
MPLAB IDE.

2. MPLAB
Harmony
Configurator will
open in a new
dialogue, as
shown below.

3. Browse to the
root directory path
under "MPLAB
Harmony Root
Directory" option.
This path is
remembered by
the Configurator
for subsequent
usage. Check or
uncheck the
"Relative Path"
check box as
required. Once
the path is set,
click "Next".

22/02/2014 17:42

Getting Started with MPLAB Harmony Integrated Software Framework

6 de 9

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

4. Now select the


required modules
for your project.
Peripheral Library
headers are
selected by
default by the tool.
Select the
required
configuration
modules using the
tree structure.
Click "Next" once
the selection is
complete.

5. If selected
library supports
configuration via
Configurator, the
Library
Configuration
Pane will appear.
As an example,
the TCP/IP Library
configuration is
shown.

Select the required configurable items of TCP/IP, and click next (Next button in Library configuration navigation pane)

7. Select to
Include MPLAB
Harmony
Application
template files.
Tool would add
template files
(main.c, app.c,
system_init.c,
system_tasks.c,
system_int.c,
system_config.h
and app.h) to
MPLAB X IDE
project. Click
"Finish".

Note: If you run the template again, for the purpose of adding the supporting files for other framework libraries, you will not want to check Include MPL
Harmony application template as it will overwrite your existing project files.

Configure the Modules


With the exceptions of the Peripheral Libraries, every MPLAB Harmony module will require some set of build time configuration options implemented us
c language macros #define. Descriptions of the supported options are available in the "Configuring the Library" section in the help document for every
MPLAB Harmony library. These options must be defined in the system_config.h header that is part of your project template generated by the MPLAB
Harmony Configurator. Every MPLAB Harmony source file that supports build time configuration options will include this header. As such, this file must b
part of every MPLAB Harmony Project.

22/02/2014 17:42

Getting Started with MPLAB Harmony Integrated Software Framework

7 de 9

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

Initialize System
This task involves completing the system_init.c file.

1. Add the
necessary
configuration bits
for your processor

These are defined


in the Special
Features section
of your device's
data sheet. In
MPLAB X, select
the Window menu,
then PIC Memory
Views and finally
Configuration Bits.
From this window
the configuration
bits can be set
and the code can
be generated to
add to your
system_init.c file.

22/02/2014 17:42

Getting Started with MPLAB Harmony Integrated Software Framework

8 de 9

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

2. Complete the SYS_Initialize function. Finish any necessary processor initialization (wait states, cache control, etc.) MPLAB Harmony may provide
services to accomplish this in the System Services Module. Initialize any features specific to the board that are not initialized by other modules such as
drivers or system services

3. Next, initialize all library modules selected to be used by your application. To do this you must first define the initialization data structure for each
module. This can be done statically in the system_init.c file and passed in by pointer to the appropriate initialization function for each library. Needed
initialization structures can be found in the help section for each module.

4. Add a call to the initialization function for each library module into the SYS_Initialize function. Each initialization function will return an object handle fo
the module instance. These should be captured so that they can be passed to the module task routine. Finally, add the call to APP_Initialize function int
the SYS_Initialize function.

Call System State Machine Tasks


The system must call the various task state machine functions at appropriate times. This is accomplished by either adding the call into the SYS_Tasks
function for polled modules or adding the call to the interrupt handler for interrupt driven modules. The object handle saved during the initialization
process is used as an argument for the various task state machine functions. The SYS_Tasks function is typically implemented in the system_tasks.c fi
while the interrupt handlers are defined in the system_int.c file. Both versions are shown below, however only one is used in your application for each ta
state machine

Develop Application State Machine


You are now ready to develop your application. Since Harmony is based on cooperative state machines, your application should also be state machine
driven.

22/02/2014 17:42

Getting Started with MPLAB Harmony Integrated Software Framework

9 de 9

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAG...

1. At minimum, the APP_Initialize function must put your application in its initial state. It may perform other initialization as long as it does not have to wa
for other modules. Any initialization that depends on other modules should be implemented as part of the application state machine.

2. Finally,
complete your
application
functionality by
implementing the
APP_Tasks state
machine function.

Downloads
No documents found. Please check back later

You have signed in as diego gachet.

Products Applications Design Support Training Sample & Buy About Us Contact Us

Copyright 1998-2012 Microchip Technology Inc. All rights reserved.


Shanghai ICP Recrdal No.09049794

22/02/2014 17:42

Potrebbero piacerti anche