Using SUBLIBinal - PalouseRobosub/SUBLIBinal GitHub Wiki

Getting Started Guide

This wiki page will guide you through the process of implementing SUBLIBinal and MPLABX assuming that you have a fresh install of linux (or any other operating system) on your computer.

Steps:


Install MPLABX

The first thing you must to is install MPLABX development environment. MPLABX is used for programming PIC microcontrollers and has been developed by Microchip.

Install MPLABX from here.

It is also necessary to install the XC32 Compiler.

top


Download the Source Code

SUBLIBinal source code and library object file can be easily downloaded through GitHub releases! Simply download the release by downloading the source code. Place the source code and the project file into an easy to access directory, as you will include this directory in your MPLABX projects.

top


Clone SUBLIBinal

Clone the SUBLIBinal repository onto a directory in your computer using any git tool of your choice. The repository contains project files for MPLABX to use as configuration. On windows, Git Extensions can be a great tool for working with git repositories.

On Linux, navigate to your desired directory in the command line and type the command (git must be installed)

git clone [email protected]:PalouseRobosub/SUBLIBinal.git

This will create a repository of the code on your own local machine. The MPLABX project is available within the proj/ sub-folder.

top


Configure MPLABX Projects

The next step will walk through how to configure an MPLABX project to utilize the SUBLIBinal library. Create a new MPLABX project (File->New Project).

  1. Select Standalone Project -> Next.
  2. Select the PIC32MX250F128B for the Device parameter, then select Next.
  3. Select the Licensed Debugger, then select Next.
  4. Select the XC32 Compiler, then select next.
  5. Enter a project name and select Finish.

Now, configure the project for SUBLIBinal.

  1. Right click the project and select Project Properties.
  2. Navigate down to xc32-gcc and select (underneath Conf->XC32 sub-menus)
  3. Set Option categories to "Preprocessing and messages"
  4. Modify "Include directories" to include the include/ folder of the SUBLIBinal repository.
  5. Select Apply, then OK.

Now, you may either include the library project file or the binary file in your project. Right click the "library" folder in your project and select "Add Library Project" to add the project file included in the repository or select "Add Library/Object File" to add the object file included in the release. Either of these methods will add SUBLIBinal library functionality to your project.

Next, you will need to include one or two headers. The basic foundations of SUBLIBinal are provided within the header "sublibinal.h". By including this file, you can gain all of the functionality of SUBLIBinal. Optionally, you can include the headers of the modules that you would like to use to save on microcontroller space.

Additionally, SUBLIBinal offers a configuration header. This header configures the microcontroller from the factory to have programming pins specified using PGC1 and PGD1. It also configures the peripheral bus clock within the microcontroller to run at 15MHz. Within this header, there is also a the line #define PBLK 15000000, which allows you to easily apply the PB_CLK definition to a number of the modules that require it for configuration. To include this configuration within your source code, include the "sublibinal_config.h" file.

Your project should now be configured to properly use SUBLIBinal!

top


Verify Functionality

To verify the project configuration, copy one of the examples into a new source file within the project. The code should be 100% able to compile. Try loading on to a microcontroller and observe the pin toggling. Use a simpler example, such as a timer or external interrupt, to ensure the project is configured properly.

top


Get started using SUBLIBinal

Please refer to the library usage documentation for examples of basic implementation of SUBLIBinal.

top