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

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.

Selecting user program will run void user_program_init(void) first.

This is where you should do all of your program setup. This is a good function to call from your program when you want it to start over again.

After the init function is called, void user_program_loop(void) will be called

This is where the main functionality of your program should be stored.

If this function returns, it will immediately be called again.

millis() is a 32-bit upcounting millisecond timer. Non-blocking delays are a matter of setting a variable as millis()+1000 and then polling millis() until it is larger than this variable.

Advanced

The screen defaults to scanning a 40x20 character array (screen will automatically update when array data changes). For direct control of the screen:

enable_display_scanning(0); //Turns off auto screen scanning, value of 1 turns back on

When directly controlling the screen, you will want to perform a screen refresh after badge wakes up from sleep

There is function pointer in hw.h that will call your screen refresh function on wake. Here is the example for setting which function will be executed (do this in the initialization function of your program):

Discussions

Become a member

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.