MPLAB® Code Configurator (MCC)
mccbanner.png

When starting out with a new project using Microchip 8-bit or 16-bit microcontrollers, setup of the configuration and all the peripherals can be time consuming, especially for new projects. The MPLAB® Code Configurator (MCC) is a plugin for the MPLAB® X IDE that simplifies this down to a series of simple selections from the menus within the MCC. The MCC generates driver code using a Graphical User Interface (GUI). The generated drivers control the peripherals on PIC® microcontrollers. The GUI provides an easy means for setting up the configuration of the peripherals.

Additionally, the MCC is used to configure and generate libraries, which allows the user to configure and generate code for software libraries and off-chip peripherals. The generated drivers or libraries can be used in any Microchip PIC device application program.

The MCC requires an MPLAB® X IDE project to be created, or an existing project opened, before launching the MCC plugin. This is necessary as the MCC needs to know the device used in the project, to have access to device-specific information like registers, bits and configurations and to set up the MCC GUI.

The MCC generates source and header files based on selections made in the GUI. The generated files are added to the active project of MPLAB X IDE.

mccscreen.png

MCC Installation (step by step)

The MCC Plugin can be installed from the Tools/Plugins menu in the MPLAB® X IDE

1) Select the 'Tools' menu, and click on 'Plugins'
2) In the MPLAB® X IDE Plugins window, click the 'Available Plugins' tab
3) Select MPLAB® Code Configurator and click 'Install'

Click here for more detailed information on installing MPLAB® X Plug-ins.

mccinstall.jpg

Getting Started with MCC

The first step of any project is to use the MPLAB X wizard tool to create a project. The wizard will step through selecting the microcontroller, development programmer/debugger and compiler to use. This should be done before launching the Microchip Code Configurator.

The MCC tool, once installed, can be launched from the the MPLAB® X Tools menu under the Embedded selection.

mcclaunch.png
The sections of the MCC tool are shown in the image below. We will refer to these sections by name throughout this training page. This highlight can be enabled over the MCC at any time by clicking on the information icon mccinfo.png.
mcclayout.png

Using MCC to Select Peripherals

The Code Configurator makes it easy to select the peripherals for a device. The Devices Resources area of the Code Configurator shows the peripherals available on the device.

mccperipherals.png

By clicking on the name of the peripheral, the list of associated options including multiple versions of the peripheral appears. There may be multiple Comparators on the device so the sub menu will show the list of all that are available.

Clicking on the specific peripheral will add that peripheral to the Project Resources area.

mccselected.png

Using MCC to Setup the Peripherals

The central composer area is where the peripherals are setup. When the peripheral is selected in the Project Resources area, the corresponding configuration GUI is displayed in the central composer area. There are three tabs, Easy Setup, Registers and Notifications. The Easy Setup is where the developer selects the settings for the peripheral through a variety of drop down selections and check boxes. The example shown is for the System Peripheral setup.

mccconfig.png

Register View

The Registers Tab shows the various registers for the particular peripheral. The configuration settings can also be viewed and modified under this tab.

Notifications

Any conflicts or recommendations that a setup would require will show up under the notifications tab. This may be a simple as an I/O pin is set to analog and is recommended to be set to digital for the peripheral setting selected.


Using MCC to Select I/O Pin Configuration

The Code Configurator allows the user to setup the I/O pin configurations using a graphical interface in the Pin Manager Area. The first step is to select the device package type to use and a representation of the device will appear. Then click on the chart below the graphical picture of the device to select the arrangement.

mcciosetup.png

A blue pin is unconnected and a green pin is connected to a peripheral or designated as a digital I/O pin. The menu of peripherals to connect the pin to can be positioned on the top (horizontal) or on the left side (vertical) by clicking on the horizontal or vertical selection.

The pin(s) associated to the peripheral will show up in the row or column of the peripheral name. This way it can be easily determined which pins to select for that particular peripheral. Once the pin is selected, the color will change to green and the lock symbol will close indicating the pin is locked into that arrangement. Clicking on the green lock will reset it back to a blue unused state.

There are several other colors that will appear as described below:

  1. Gray colored pin: 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. There are also grayed out locks on a white background that indicate pins that are locked out by selected system functions.
  2. Blue colored pin: indicates pins that are available to be allocated to a module.
  3. Green colored pin (with a lock): 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.
  4. Green color pin (with chain link): this combination indicates that the pin is shared between multiple functions.
  5. Yellow colored pin: indicates a possible alternate pin for an already allocated pin function.
  6. Grayed out locks on a white background indicates pins that are locked out by selected system functions.

Generating Code

The Code Configurator has a separate setup screen for each peripheral selected. After each peripheral is setup along with the configuration and I/O, then just click on the Generate Code button generate.png to have the MCC create all the peripheral driver code for the project.

The code will be placed into the project automatically. If its a new project then a main.c file will also be produced. If the project already has a main.c then the MCC will only produce the peripheral driver files. The code will show up in the project area of MPLAB® X.

projectcode.png

The code produced is fully open sourced and editable. It can be used as a base and modified for the projects needs. This also makes a great way to start a new project so initially a set of peripheral driver code with functions for each peripheral are automatically developed.


Example Projects

The self-paced online training Get Started with 8-Bit PIC® MCUs shows step by step directions of how to create simple projects using the PICDEM Lab II development board and the MCC.

sampleprojects.png

Documentation

The MCC User Guide can be downloaded for more detailed information on using MCC.

© 2016 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.