Code Configurator User Guide 40001725b
Code Configurator User Guide 40001725b
User’s Guide
Note the following details of the code protection feature on Microchip devices:
• Microchip products meet the specification contained in their particular Microchip Data Sheet.
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
QUALITY MANAGEMENT SYSTEM Microchip received ISO/TS-16949:2009 certification for its worldwide
CERTIFIED BY DNV headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
== ISO/TS 16949 == are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
NOTICE TO CUSTOMERS
All documentation becomes dated, and this manual is no exception. Microchip tools and
documentation are constantly evolving to meet customer needs, so some actual dialogs
and/or tool descriptions may differ from those in this document. Please refer to our web site
(www.microchip.com) to obtain the latest documentation available.
Documents are identified with a “DS” number. This number is located on the bottom of each
page, in front of the page number. The numbering convention for the DS number is
“DSXXXXXA”, where “XXXXX” is the document number and “A” is the revision level of the
document.
For the most up-to-date information on development tools, see the MPLAB® IDE online help.
Select the Help menu, and then Topics to open a list of available online help files.
INTRODUCTION
This chapter contains general information that will be useful to know before using the
MPLAB® Code Configurator. Items discussed in this chapter include:
• Document Layout
• Conventions Used in this Guide
• Recommended Reading
• The Microchip Web Site
• Development Systems Customer Change Notification Service
• Customer Support
• Revision History
DOCUMENT LAYOUT
This document describes how to use the MPLAB® Code Configurator to generate
peripheral driver code. The document is organized as follows:
• Chapter 1. “Overview”
• Chapter 2. “Installation”
• Chapter 2. “Getting Familiar with the User Interface”
• Chapter 3. “Operating the MPLAB® Code Configurator”
• Appendix A. “Support ”
DOCUMENTATION CONVENTIONS
Description Represents Examples
Arial font:
Italic characters Referenced books MPLAB® IDE User’s Guide
Emphasized text ...is the only compiler...
Initial caps A window the Output window
A dialog the Settings dialog
A menu selection select Enable Programmer
Quotes A field name in a window or “Save project before build”
dialog
Underlined, italic text with A menu path File>Save
right angle bracket
Bold characters A dialog button Click OK
A tab Click the Power tab
N‘Rnnnn A number in verilog format, 4‘b0010, 2‘hF1
where N is the total number of
digits, R is the radix and n is a
digit.
Text in angle brackets < > A key on the keyboard Press <Enter>, <F1>
Courier New font:
Plain Courier New Sample source code #define START
Filenames autoexec.bat
File paths c:\mcc18\h
Keywords _asm, _endasm, static
Command-line options -Opa+, -Opa-
Bit values 0, 1
Constants 0xFF, ‘A’
Italic Courier New A variable argument file.o, where file can be
any valid filename
Square brackets [ ] Optional arguments mcc18 [options] file
[options]
Curly brackets and pipe Choice of mutually exclusive errorlevel {0|1}
character: { | } arguments; an OR selection
Ellipses... Replaces repeated text var_name [,
var_name...]
Represents code supplied by void main (void)
user { ...
}
RECOMMENDED READING
This user’s guide describes how to use MPLAB® Code Configurator. Other useful
documents are listed below. The following Microchip documents are available and
recommended as supplemental reference resources.
http://www.microchip.com/mcc
CUSTOMER SUPPORT
Users of Microchip products can receive assistance through several channels:
• Distributor or Representative
• Local Sales Office
• Field Application Engineer (FAE)
• Technical Support
Customers should contact their distributor, representative or field application engineer
(FAE) for support. Local sales offices are also available to help customers. A listing of
sales offices and locations is included in the back of this document.
Technical support is available through the web site at:
http://www.microchip.com/support.
REVISION HISTORY
Revision A (October 2013)
This is the initial release of this document.
Revision B (May 2014)
Updated Figures 3-7, 3-8, 4-3, 4-6, 4-7; Other minor corrections.
The device resources tree can also be navigated and handled by using the following
keys:
• Up and down arrow keys: For moving up and down in the tree, respectively.
• Right arrow key: For expanding a node.
• Left arrow key: For collapsing a node.
• Space key: For enabling a module if it is not a node or expanding or collapsing a
node.
A module in the Project Resources window can be disabled by right clicking it and
selecting the “Disable Module” option or by clicking the “x” button against it. Disabling
a module will remove it from the generated files and the respective module
configurations will be lost.
The following color combinations are associated with the pins in graphical view:
• Grey colored pin: It indicates that the pin is not usable in the selected
configuration and that there is no enabled module which has any functionality on
that pin.
• Blue colored pins: It indicates pins which can be allocated to a module for
configuration.
• Green colored pin: This combination indicates that the pin has been allocated
and selected for a module. The name displayed against the pin is either the name
of the pin in the module’s context or a custom name entered.
• Yellow colored pin: It indicates the pin currently being configured.
The Package button allows the user to select between various supported packages,
the selection made at which gets reflected in the graphical view of the pin manager.
The Reverse Pin Order button changes the port order of the I/O's. Clicking this button
will switch between port pin ordering 0-7 or 7-0.
The three columns in the table view which indicate module name, functionality name
and the port pin numbers, respectively, are movable and can be switched in between
them for easier access.
Hovering over a cell with a lock shows the pins functionality in that module while it is
not selected. However, when a pin is selected, it shows the name in that module or the
custom name entered. Clicking on the “PORTx” title cell expands/collapses all the pins
in that port. Also, right clicking anywhere in the “PORTx” row shows a menu to
collapse/expand all the ports.
More features of the pin manager:
Right clicking in the pin manager area pops up a menu with the following options:
• Invert split panes: It is used to invert the split panes between the graphical and
table views of the pin manager.
• Divider: It is used to change the divider between the graphical and table views of
the pin manager to either horizontal or vertical types.
• Print: It is used to print the graphical or table view of the pin manager. If the table
view is selected for printing, the currently selected table gets printed. Thus, for
printing both the horizontal and vertical tables, the user should switch and print
each view individually.
• Export: It is used to save the package or the table view to an image file. The
supported image formats are .jpg, .png, .gif and .bmp which along with the user
defined name can be provided in the dialog which appears when this option is
selected.
For example, if the EUSART peripheral is selected from the Project Resources area,
the EUSART Composer area gets invoked, see Figure 2-8. The EUSART Composer
area allows configuring different EUSART parameters related to transmission and
reception operations. It also has fields to use peripheral interrupts as well as standard
input-output (stdio) functions, which can be used depending upon the application
needs. Once setting up of required peripheral configurations is done, clicking Generate
Code will generate drivers for that particular peripheral. The Generate Code button
gets activated only when there is something that needs to be generated (e.g., a new
module) or when some changes have been done in an already generated module.
Hovering over the Generate Code button provides the list of modules which need to
be generated or regenerated.
“Resources” and “Pin manager” buttons provide a link to those particular areas. Thus,
if any of these areas are not in focus, they can be brought in focus by clicking these
respective buttons.
Configuration of the operation of MCC can be managed by using the “Options” panel
which can be invoked by clicking Tools -> Options -> Embedded -> MPLAB Code
Configurator in the menu bar of MPLAB® X IDE.
Follow the steps to generate peripheral drivers using MCC in MPLAB® X IDE:
1. Create a new MPLAB X IDE project or open an existing project. As an example,
a project for the PIC16F1937 device with the name example is created here, see
Figure 3-2.
4. Clicking the system module in the Project Resources area invokes the
Configuration bits setting GUI in the Composer area where device Configuration
bits can be set, see Figure 3-4. The Configuration bit settings will be included in
the generated code.
The Configuration bits tree can be navigated and handled by using following keys:
• Up and down arrow keys: For moving up and down in the tree, respectively.
• Right arrow key: For expanding a node.
• Left arrow key: For collapsing a node.
• Space key: For setting a bit if it is not a node or expanding or collapsing a node.
5. From the Device Resources area, select a peripheral to be enabled for code
generation. For example, EUSART asynchronous (NRZ) module has been
enabled here, see Figure 3-5. Once a peripheral is enabled, observe that the
peripheral now appears on the Project Resources area, see Figure 2-6. Also,
pins in the Pin Manager area get invoked based on the enabled peripherals.
6. In the Project Resource area, select the peripheral which needs to be configured
by clicking the peripheral name. Once a peripheral is selected for configuration,
the configuration GUI for that peripheral comes up in the Composer area. For
example, EUSART asynchronous (NRZ) module is selected for configuration
and hence, the respective module configuration GUI is displayed on the
Composer area, see Figure 3-6.
Note that when multiple initializers are used only the default initializer, denoted by the
small sprocket icon, will be automatically included in the global initializer function.
Additional initializers must be called by the application when they are required.
If interrupts are enabled for a peripheral in its Composer area, an interrupt symbol gets
prefixed to that peripheral’s name in the Project Resources showing the fact that
interrupts have been used in its configuration. Also, an extra module called “interrupt
manager” gets added in the project resources list which can be used to assign the
interrupt execution priority for multiple peripherals.
8. Configure the pins in the Pin Manager area depending upon the application
requirements. The table view can be displayed in either a vertical or horizontal.
The package view displays the respective pin configurations graphically. For
example, Figure 3-8 shows the 44-pin TQFP configurations for the EUSART
asynchronous (NRZ) module which was enabled for configuration.
9. When all of the enabled modules have been configured, clicking the Generate
Code button at the top of the Composer area will generate the drivers and
initializers.
Note: The user must enable the peripheral and global interrupts in the application
code using the respective macros defined in interrupt_manager.h file.
A.2 SUPPORT
• For more information about MPLAB X IDE, please refer to the following link:
http://www.microchip.com/mplabx
• For more information about MPLAB XC compilers, please refer to the following
link:
http://www.microchip.com/mplabxc