You are on page 1of 50

17006 PCG

Peripheral Initializer
(PI)
2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

Class Objectives
At the end of this class you will be able to:

Be able to open MPLAB X IDE, start a project and


install PI plug-in

Use PI to generate simple, readable, consistent


drivers and initializers.

Be able to modify, update or add drivers to an


existing project using PI

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

Agenda

Part 1:
What is PI
Why PI

Part 2:

Installing PI into MPLAB X IDE


Review the sections of PI

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

Agenda
Continued

Part 3:
Lab 1
Lab 2
Lab 3
Lab 4
Lab 5
Lab 6
Demo for 16-Bit Devices
Summary

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

What is PI?

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

What is PI?

What is PI?

PI is a completely new approach of


graphically configuring peripherals for a
project

Creates a separate, easily maintained list of


drivers and initializers for each peripheral

It utilizes an easy to use Java-based


Graphical User Interface

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

What is PI?

Unlike its predecessors, the modular


approach means its easy to modify, manage
and regenerate modules, add peripherals,
and change configurations.

Avoids pitfalls of Visual Device Initializer (VDI)

Avoids pitfalls of Application Maestro (AM)


which required a high degree of maintenance

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

What is PI?

You can quickly and easily

Add code using PI or the traditional way, its


your choice

Configure the entire device for you


application

Modify the generated code

Remove the generated code if you choose


not to use a module

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

Why PI?

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Why?

Slide

Why PI?

To help customers both new and


existing
To help speed up and simplify
development
To generate standardize drivers
between devices and families
Because it was asked for it via emails,
MASTERs and Forums

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

10

Installing PI

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

11

Install PI

Access Tools Plugins

Select the Available


Plugins Tab

Select Microchip PI

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

12

Install PI

Click Install

Install Wizard

Accept and Next


on License Agreement

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

13

Sections of PI

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

14

Sections of PI

Once opened PI has 3 main areas


Resource
Resource Area
Area

2013 Microchip Technology Incorporated. All Rights Reserved.

Composer
Composer Area
Area

Pin
Pin Manager
Manager Area
Area

17006 PCG

Slide

15

Sections of PI

In the center is PI Module Composer Area

It contains the Module Composer and the Modules,


Pin Manger, Generate Code and View Report
buttons

Pin
Pin Manager
Manager
Modules
Modules
Generate
Generate Code
Code
View
View Report
Report

PI
PI Module
Module
Composer
Composer Area
Area

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

16

Sections of PI

On the left is PI Resource Area

It contains two windows; The upper is the


Project Resources Area and the lower is the
Device Resources Area

PI
PI Resource
Resource
Area
Area

Project
Project Resources
Resources

Device
Device Resources
Resources

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

17

Sections of PI

Selecting a module
from Device Resources

Moves that module


to Project Resources

Selecting a module from


Project Resources
Invokes the
Pin Manager

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

18

Sections of PI

Pin Manger has


two sections

The upper is the


Package View

The lower is a Table


View

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

19

Sections of PI

Clicking on the open


lock on pin selects
that I/O for that module

When selected the


lock will close and
the color will turn
from blue to green.

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

20

Sections of PI

Selecting a module, like GPIO, from the


Project Resources will display the
configurations tab for that module into
the Module Composer Area
Selecting GPIO
displays the GPIO
configurations tab

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Select
Select
GPIO:GPIO
GPIO:GPIO

Slide

21

Sections of PI

The module configurations tab is


where the user will setup features of
the module

And will pop up in the center module


composer area once selected

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

22

Sections of PI

The module composer area is where the


user will setup features of the module

The GPIO configuration tab allows


the user to select
pin names, input,
output starting values
and enable pull-ups
if available

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

23

Sections of PI

Selecting Input, Output and Pull-ups


can be done individually

Or in parallel

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

24

Sections of PI

Unique pin names can used to identify pin


characteristics

For example lets rename IO_RB0 to led1

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

25

Sections of PI

Pin names are reflected in Pin Manger

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

26

Sections of PI

Selecting System or Module from the


Project Resources will display the available
configuration in the Module Composer Area.
Actively
Actively
shows
shows current
current
settings
settings

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

27

Lab 1:
Light an LED

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

28

Tools Used In This Class

PICDEM 2 Plus
Demonstration Board
Part Number:
163022-1
PIC16F1937
MCP2200 USB to RS232
Demo Board and cable
Speech Playback
PICtail Plus Daughter
Board

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

29

Lab 1 Objectives

Start a new project in MPLAB X IDE


If not already done, install PI Plug-in
Setup the configuration registers
and oscillator
Generate code to light an LED

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

30

Lab 2:
User Timer0 Overflow to Blink
an LED

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

31

Lab 2 Objectives

Open previous Lab 1 project or open


Lab 2
Set up Timer0 to overflow every
262ms
Use Timer0 overflow to blink an LED

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

32

Lab 3:
User Timer1 Interrupt to Blink
an LED

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

33

Lab 3 Objectives

Start from existing project from Lab


2 or open Lab 3

Set up Timer 1 and Timer 1 Interrupts

Blink another LED at a rate of ~1


second using Timer1 Interrupts

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

34

Lab 4:
Hello World

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

35

Lab 4 Objectives

Start from existing project from Lab 3


or open Lab 4
Configure EUSART
9600 baud
Asynchronous mode
8 bit receive and 8 bit transmit
Send Hello World to the PC via a
Terminal Program

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

36

Lab 5:
Read the ADC using TMR2
interrupt and send to EUSART

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

37

Lab 5 Objectives

Start from existing project from Lab 4 or open


Lab 5
Configure ADC
Right Justify
Conversion Clock = 1/16
Rail to Rail
Configure Timer2
Prescaler = 16
Postscaler = 64
Reload Value = 42
Use Timer2 Interrupt

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

38

Lab 5 Objectives

Send measured ADC value to the PC via a


terminal program
Reopen PI
Set up the ADC to use the FVR (2 X Vref) for
Positive Vref instead of VDD
Regenerate the code
Send measure value to the PC via terminal
program
Verify the POT now has ~ the range

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

39

Lab 6:
Lets Play Some Music

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

40

Lab 6 Objectives

Open Lab 6
Configure and use the PWM to drive
various tones to the Speech Playback
PICtail Plus board
Configure the ADC the same was as Lab
5 with Vref equal to rail to rail
Use the measure ADC value to alter the
sound to the Speech Playback PICtail
Plus board

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

41

Lab 6 Objectives

Use the SPI to store/retrieve various


tones to and from the serial EEPROM
on the Speech Playback PICtail Plus
board

Display the frequency values on the


LCD

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

42

Summary

Today we covered:

Installing and using PI for generating


code in your projects
Displayed how easy it is to use and to
setup peripherals
Generated a projects using GPIO,
USART, ADC,SPI, Timers and PWM.
Had fun using a very cool and very usable
Tool

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

43

Summary

Version 1.0 supports the following


PIC16F19xx, 18xx, 17xx and 15xx
families except for CWG, COG, LCD and
mTouch sensing solution
Future version will be to support 16-bit
devices and additional 8-devices and
modules

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

44

Summary

Future support

October Release
February Release
July 2014

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

45

Questions?

Thank you!
2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

46

Additional Resources

PIC16(L)F1937 Data sheet


Weblinks
App notes
Magazines

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

47

Dev Tools For This Class

(AC002014) 9V 1.3A Universal Wall Mount


Power Supply

(CAB0019) USB Cable, A to Mini-BDM

(163022-1) PICDEM 2 Plus

(MCP2200EV-VCP) MCP2200 USB to


RS232 Demo Board

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

48

Dev Tools For This Class

(AC164125) Speech Playback Speech


Playback PICtail Plus board Plus
Daughter Board
MPLAB REAL ICE In-circuit emulator
PIC16F1937

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

49

LEGAL NOTICE
SOFTWARE:
You may use Microchip software exclusively with Microchip products. Further, use of Microchip software is subject to the copyright notices, disclaimers, and any license
terms accompanying such software, whether set forth at the install of each program or posted in a header or text file.
Notwithstanding the above, certain components of software offered by Microchip and 3rd parties may be covered by open source software licenses which include
licenses that require that the distributor make the software available in source code format. To the extent required by such open source software licenses, the terms of
such license will govern.
NOTICE & DISCLAIMER:
These materials and accompanying information (including, for example, any software, and references to 3 rd party companies and 3rd party websites) are for informational
purposes only and provided AS IS. Microchip assumes no responsibility for statements made by 3 rd party companies, or materials or information that such 3 rd parties
may provide.
MICROCHIP DISCLAIMS ALL WARRANTIES, WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY DIRECT OR INDIRECT, SPECIAL,
PUNITIVE, INCIDENTAL, OR CONSEQUENTIAL LOSS, DAMAGE, COST, OR EXPENSE OF ANY KIND RELATED TO THESE MATERIALS OR ACCOMPANYING
INFORMATION PROVIDED TO YOU BY MICROCHIP OR OTHER THIRD PARTIES, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE POSSIBLITY OF SUCH
DAMAGES OR THE DAMAGES ARE FORESEEABLE.
TRADEMARKS:
The Microchip name and logo, the Microchip logo, dsPIC, FlashFlex, KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART, PIC 32 logo, rfPIC, SST, SST Logo,
SuperFlash and UNI/O are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor, MTP, SEEVAL and The Embedded Control Solutions Company are registered trademarks of Microchip
Technology Incorporated in the U.S.A.
Silicon Storage Technology is a registered trademark of Microchip Technology Inc. in other countries.
Analog-for-the-Digital Age, Application Maestro, BodyCom, chipKIT, chipKIT logo, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN,
ECONOMONITOR, FanSense, HI-TIDE, InCircuit Serial Programming, ICSP, Mindi, MiWi, MPASM, MPF, MPLAB Certified logo, MPLIB, MPLINK, mTouch, Omniscient
Code Generation, PICC, PICC-18, PICDEM, PICDEM.net, PICkit, PICtail, REAL ICE, rfLAB, Select Mode, SQI, Serial Quad I/O, Total Endurance, TSHARC,
UniWinDriver, WiperLock, ZENA and Z-Scale are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.
GestIC and ULPP are registered trademarks of Microchip Technology Germany II GmbH & Co. KG, a subsidiary of Microchip Technology Inc., in other countries.
All other trademarks mentioned herein are property of their respective companies.

2013 Microchip Technology Incorporated. All Rights Reserved.

17006 PCG

Slide

50

You might also like