Close

Guide for Programming in C

A project log for Badge for Hackaday Conference 2018 in Belgrade

In the 1980's, you had to know programming to use computers. They were used for... guess what? Computing! Want to see how it looked?

mike-szczysMike Szczys 05/14/2018 at 21:462 Comments

Setting Up the Toolchain

You will need a PIC programmer to write your own HEX files onto the badge. PICkit 3 and PICkit 4 have both been tested to work as programmers via the pin header on the badge.

The BASIC badge is based around a PIC32MX370F512H. Software is compiled using MPLABX, XC32 compiler, and legacy peripheral libraries from Microchip.

  1. Download three packages:
    • Navigate to the Downloads" tab at the bottom of the Microchip Compilers page.
    • Download MPLAB® XC32/32++ Compiler v2.05 for your operating system
    • Download PIC32 Legacy Peripheral Libraries for your operating system
    • Navigate to the "Downloads" tab part way down the screen at the Microchip MPLAB X IDE page.
  2. Install the packages:
    • Install the XC32 compiler first
    • Install the peripheral libraries next. IMPORTANT: You must specify the same directory as the XC32 compiler. This will likely not be the default option during install. For Linux installation this director was: /opt/microchip/xc32/v2.05/
    • Install MPLABX IDE
  3. Open the MPLABX project from this repository
    • A PIC programmer like the PICKIT3 is required to program your badge
    • On the PIC programmer, pins 1-5 correspond to RES, V+, GND, B0, and B1 on the badge

User Examples for C Programming

The stock firmware includes an example program that has both a menu entry, and many of the commands that will commonly be needed to write your own C code.

Advanced

Discussions

Marcel van Kervinck wrote 11/03/2018 at 00:14 point

I couldn't get past "PIC32 Legacy Peripheral Libraries" for OSX. It gives a "Segmentation fault: 11" trying to run it. According to forum posts there's nothing to do about it. Neither apple nor microchip will support it.

  Are you sure? yes | no

Mohit wrote 10/23/2018 at 11:00 point

Hi guys, the Microchip compiler download page no longer has  XC32/32++ v2.05, but only v2.10 for Windows/Mac/Linux. Does this break anything in the process? Thanks

  Are you sure? yes | no