How To Import/Write MPLAB® X Examples in MPLAB

Creating unique and effective code is great, getting to share that with the world can be even better. MPLAB® Xpress allows you to upload your own projects and explanations online. This tutorial will show you how. If you are starting from an MPLAB X IDE project, then go to step 1. If you are starting from MPLAB Xpress, then you can move straight to step 3.

1

Packaging MPLAB® X Project

If you are starting from MPLAB X, then you will need your entire project in one ZIP file in order for Xpress to be able to read it. The easiest way to create this is from the MPLAB X IDE. Open the IDE and look at the top left corner of the default window screen. There are two tabs in the box, one titled 'Projects' and the other titled 'Files'.

Figure_1.png

Right-click on your project, which is named Test in this example. Navigate to the second section and click 'Package'. This will create a zipped file with your complete project wherever your MPLAB X project files are saved on your device. Remember this location.

2

Importing MPLAB X Project

Return to the MPLAB Xpress window and click on 'File' at the top left corner. In the drop-down menu, choose 'Import Project'.

Figure_2.PNG

Click Next in the window labeled Information which will take you to the Import Project window. Select Choose File and navigate back to the folder where your MPLAB X project was stored. Once you have found and selected the zipped file, the name of the project will appear in the dialog box named Project Name. Select Finish near the bottom of the window to import your project to MPLAB Xpress.

Once the project is imported, then you will see the Project window populated with the files from your MPLAB X project and the main.c window open.

Figure_3.PNG

You can continue to tweak or re-write the program using the Microchip Xpress IDE or, if you are ready, you can continue and upload the project.

3

Uploading the MPLAB Xpress Project as an Example

Open the 'File' menu once again and this time choose 'Create/Update an Example'.

Figure_4.PNG

Now you have two options. If you have already posted this example project, but you want to make changes to it, then you can choose 'Update Existing'. However, for the sake of this tutorial, choose 'Create New'. Give the example a title and a short description that will appear on the "MPLAB Xpress Code Examples" page then click Next.

Figure_5.PNG

The next window opens the Description of the project. This is the location to place the full tutorial for the project and to provide users any additional information necessary to use the project. We will cover how to use the description markdown language and features in the next step. To move forward, you need to add something, so write TBD and then click next.

The last window tells the rest of the online community what development tool you used to program and possibly debug this project. Choose the correct development tool and then click Finish.

This window provides confirmation that the project has successfully uploaded:

Figure_6.PNG

Choose Yes to open the example landing page.

4

Editing the MPLAB Xpress Example Project Landing Page

General Window

Figure_7.PNG

The only dialog not yet covered is 'Tags'. These are bigger concepts that can be used in the example search to help users narrow down the results. Please do not tag your example with every tag, but instead only the tags most pertinent to your example.

Description Window

Figure_8.PNG

The Description window works using a language called Markdown to post videos, images, text, and other word processing features. If you would like the full API, you can click the ? icon farthest right in the toolbar at the top of the window. You also have the option of selecting the majority of these features from the toolbar. For example, if you want bold text, click the B and then fill in the text that appears.

Images take an extra step. If you want to add images, you first add the images to an online repository by clicking the 'Images' tab. I chose to upload an image of a CLC.

Figure_9.PNG

Click Add Image which will open a browser for the local files on your computer. Choose the image or images you would like in your example and they will appear as a list under the button.

Figure_10.PNG

You have a few options for each image you have uploaded. First, the Show text box gives you the opportunity to display the image at the top of your written content in a carousel, as well as in the written content. Usually, I uncheck this box, but there are times such as showing one or more images of a demo where the carousel can be used effectively. Choose Copy to copy the link to a clipboard. This is important because it is necessary to have the correct link to add the image link to the written content. Copy your first image link and return to the 'Description' tab.

When you click the add image button ( Figure_11.PNG ) the following line of code will appear:
(http://){width=auto height=auto align=center}

Paste the link from the 'Images' tab into the section labeled "http://." You can also set the sizing and alignment using the other descriptors. For those who know HTML, this will begin to look familiar. For the full functionality, remember to click on the ? icon.

Links

This window lets you add links to external websites that can include information to increase the effectiveness of your example. 'Title' designates what words will appear as the link and the hyperlink defines where clicking on the title goes.

External Project

If you have already written the information for your code on a separate website, use External Project to link users to this page.

Finished Example

Figure_12.PNG

The final example page will look something like this. You can see my title and short description in the upper left-hand corner of the page. The top right-hand of the page gives you various options of what to do with the project including further editing, embedding it on another website, watching its popularity, liking it, downloading the example as an MPLAB X project, and opening the example in Xpress.

Next, I chose to link my test project to an external link and to include a CLC image at default width and height. The device, board, tag, and external links sections all auto-populate based upon the options you have picked in setting up the example.

© 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.