MPLAB® Code Configurator (MCC)
mccbanner.png

When starting a new project using PIC16, PIC24, or PIC32 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 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 you to configure and generate code for software libraries and off-chip peripherals. The generated drivers or libraries can be used in any 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, then click on 'Plugins'.
2) In the MPLAB X IDE Plugins window, click the 'Available Plugins' tab.
3) Select 'MPLAB Code Configurator' and click Install.


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 walk through selecting the microcontroller, the development programmer/debugger and the compiler to use. This should be done before launching the MCC.

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

Getting Started with MCC Overview


Using MCC to Select and Setup Peripherals

MCC makes it easy to select the peripherals for a device. The Device Resources shows the peripherals available on the device.

mccperipherals.png

By clicking on the name of the peripheral, a list of associated options including multiple versions of the peripheral will appear. There may be multiple comparators on the device so the submenu will show the list of all that are available.

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

mccselected.png

Setup the Peripherals

The central composer area is where the peripherals are set up. When the peripheral is selected in the Project Resources, the corresponding configuration GUI is displayed in the central composer area. There are three tabs: 'Easy Setup', 'Registers', and 'Notifications'. 'Easy Setup' is where you select the settings for the peripheral through a variety of drop-down selections and checkboxes. 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

MCC allows you to set up the I/O pin configurations using a graphical interface in the Pin Manager. The first step is to select the device package type to use then 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 with 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 that appears on the pin is either the name of the pin in the module’s context or a custom name entered.
  4. Green colored 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

MCC has a separate setup screen for each peripheral selected. After each peripheral is set up 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 it is 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 is automatically developed.


Example Projects

The self-paced online training: "Get Started with 8-Bit PIC® MCUs" shows step-by-step directions on 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.

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
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.