Getting Started with MCU Projects Using MPLAB® Code Configurator (MCC) Melody
Building an MCC Melody Project and Programing a Development Board
Downloading an MCC Melody Example Project | Editing an Existing MCC Melody Project |
You now have all the components you need to start developing your firmware project. You have MPLAB® X IDE and MPLAB XC8 compiler installed on your computer, you’ve procured a PIC18F56Q71 Curiosity Nano Demo Board, and you’ve downloaded the PIC18F56Q71 Basic Uart Comms demo project from the Microchip Discover website.
However, before you begin hacking the code to customize it for your application, you will want to build the demo project and program it into your demo board to verify that you are starting with a known working project. This will also familiarize you with the build process in MPLAB X IDE.
MPLAB X IDE Overview
If it is not already running, launch MPLAB X IDE. If this is your first time using the IDE, there are some things you will notice. First is the layout of the graphical user interface. Across the top are the menus and the main toolbar for quick access to the tools and tasks you’ll use most.
One important button in the toolbar that you will use later is the Make and Program Device button. You will use this button to build the project and program the device.
Below the toolbar are the interactive window groups, where the work gets done. There are four main window groups: the Project Group, the Editor Group, the Navigation Group, and the Output Group.
When you open the IDE for the first time, you may only see the Editor group or maybe the Project and Editor Groups. It depends on whether you had a previous version of MPLAB X IDE on your machine and allowed the new install to use the old settings. In any case, the Navigation Group and Output Group windows will open once you have opened a project to work on. If the Project window is visible, like the Navigation and Output windows, it will have nothing to show until you have opened a project.
The other tab in the Editor window is the MPLAB X IDE Store. Here you can browse through the extensive collection of hardware and software development tools that Microchip offers.
The page contains standard web browser controls at the top and a collapsible side menu on the left to help you navigate to find your desired tool.
Clicking a category on the left side menu brings up an illustrated list of tools on the right. Choose a tool and click on the Read More link to read the full description or click on the name of the tool to display the full Microchip webpage for that tool.
If you wish to purchase a tool, click on the Add To Cart button and it will pop up a window showing it has added the item to your cart. From that pop-up, you can choose Continue Shopping to close the pop-up, or you can click on Go To Cart to go to Microchip Direct and purchase the item.
Opening the Project in the IDE
Now that you have a feel for the support resources available through the IDE, you are ready to open the demo project and learn more about the working resources of the IDE.
You should now see the basicUARTcomms_Q71 project displayed in the Project window. As mentioned, all of the window groups are now open and populated with information. Notice there are three tabs in the Projects Window: Projects, Files, and Classes.
The Projects tab displays all the open projects, in this case just the demo project, but it could contain more. When there is only one project open, it is by default the Main Project. That means it is the project that all the tools like the Code Configurator, C compiler, or programmer/debugger will operate upon.
Examining the Project
The Navigation Group in the bottom left corner contains two tabs, the Project Dashboard and the Navigation Window.
Finally, the Output Group window can contain many tabs for communicating information about the various actions happening in the IDE. For instance, compiler output messages, debugging windows like watch variables and breakpoints, memory viewing windows, simulator stimulus and output data, and more. In this case, we see a configuration loading error. This message is because we have a newer version of the compiler than what was used when the demo project was saved in the Discover repository.
It is possible that the output window popped up with messages when you opened the demo project. One tab may be titled Configuration Loading Error and contain a message like:
Configuration “default” load error: PIC18F-Q_DFP 1.1x.xxx is used in the configuration and it is not installed. Resolution: Click on the below link to resolve the same version of DFP
This is also not a problem, it merely indicates that the project was created using a different Device Family Pack (DFP) than you have installed with your compiler version. If you have a newer version of the DFP, you can ignore this message and the project should build and operate fine. If for some reason it will not build correctly, resolve the DFP issue by downloading and installing the version of DFP that was used originally.
DFPs contain information on each supported device (microcontroller/microprocessor) grouped by family. This information includes data on device power requirements, programming methods, architecture, etc. The IDE uses this information to configure, build, program, and/or debug your project. For more information on DFPs, see the "Device and Tool Packs Used in MPLAB X IDE Projects" page.
Connecting the Evaluation Board to Your PC
Before you can build and program your target device, you must connect the Curiosity Nano board to your PC. The board has a built-in debugger/ programmer, so all you need to do is plug a USB cable (Standard-A to Micro-B or Micro-AB) between the PC and the debug port (Micro-USB connector) on the Curiosity Nano board.
If your demo board was connected successfully, you should see the Kit Window open in the Editor Group with the PIC18F56Q71 Curiosity Nano board displayed.
Configuring Project Properties
Building the Project and Programming the Board
To program the board, click on the Make and Program Device button on the main toolbar. MPLAB X IDE will build your project again and then program the board. If the firmware in the debugger chip on the board is out-of-date, the system will update this firmware first before programming the target device. This may take a minute or two, but eventually, it will program the device and you should see a "PROGRAMMING AND VERIFY SUCCESSFUL" message in the Output window.
Verifying Functionality with the Data Visualizer
Congratulations! Your board is now programmed. To verify it's working correctly, you will need to use the Data Visualizer tool as specified in the instructions provided with the PIC18F56Q71 Basic Uart Comms demo project on Microchip Discover.
To launch the Data Visualizer, click the DV button on the toolbar. The Visualizer will open in a new tab within the Editor window. The PIC18F56Q71 Curiosity Nano board is recognized by the Data Visualizer, as evidenced by the name of the board displayed at the top of the Connections tab on the left side of the display.
The other display contains the Terminal and XY Plot tabs. The Terminal displays data as text, either as raw values or ASCII-encoded characters. It is also capable of sending text-based data. The XY Plot visualizes incoming x vs y data as a plot.
The Terminal window will be the only one used for this exercise, so the other windows can be closed or simply ignored.
You should now see a red square and the word “Capturing” indicating that you are now communicating with the board and capturing the interactions in the terminal screen.
And that’s it! You have verified that the demo project is working. You can now begin customizing the code to meet the requirements of your project.