chipKIT Libraries

Quick Links:

chipKIT Specific Libraries:

chipKIT specific libraries are ones which will work only in chipKIT and they come along with the official distribution of MPIDE. Clicking on each of the chipKIT specific libraries will lead you to the complete documentation on them.

chipKIT Compatible Libraries:

chipKIT compatible libraries are those that support even ArduinoTM boards. They also come along with the official distribution of MPIDE.  To find more information on the compatible libraries, please visit the ArduinoTM website by clicking here.
  • EEPROM
  • Ethernet
  • Firmata
  • Liquid Crystal
  • SD
  • Servo
  • SoftPWMServo
  • SPI
  • Stepper
  • Wire

chipKIT Contributed Libraries:

Contributed libraries are created by users and are not part of the official distribution of the IDE (either Arduino or chipKIT). There is a great chance that a Arduino contributed library will not work on a chipKIT board without modification. If you are moving from Arduino and the contributed library you use has not been ported to work on chipKIT you may have to dig in and do a little work.
  • Communication
    • OneWire library
  • Motor Control
    • SoftPWMServo Library
    • Adafruit Motor Shield Library
  • Graphics and Display
    • CK_RGB_GLCD Library
    • CK_ITDB02_Graph Library
    • CK_ITDB02_Touch Library
    • dogm128 Library
    • Serial_LCD Library Suite for 4D Systems µOLED µLCD µVGA Screens
    • DisplayCore
    • GLCD
  • Real-Time Clock/Calendar
    • PIC32 RTCC Lib
    • RTCC
  • Interrupts
    • Change Notification
  • Miscellaneous
    • Streaming
    • MakeShift Servo Library (deprecated)

Communication

OneWire library

This OneWire library is a modified version of the Teensy OneWire library which reads the temperature from a ds18s20 using a chipKIT Uno32. #ifdefs allow the code to be compatible with both Arduino and chipKIT.

Motor Control

SoftPWMServo

A Software PWM and Servo output library is now installed with MPIDE. It can generate analogWrite() style output, as well as RC Servo output, on all pins simultaneously (up to 85 at once). It is easy to use and does not us any timers, but runs completely in the background by hooking into the CoreTimer interrupt. It is double buffered for glitchless transitions. The internal resolution of the PWM and Servo pulses is 25ns, although (obviously) this is not an accuracy and can’t be guaranteed because this is just a software implementation. However, you should be able to get your pulses to within about 500ns of where you want them worst case.

Five examples are included with the MPIDE install:

  • SimplePWM : this example shows the simplest way to set up PWM output on a pin
  • SimpleServo : this example shows the simplest way set up a pin for RC servo output
  • AllPinsPWM : this example has all I/O pins configured and running PWM output (85 at once)
  • AllPinsServ : this example has all I/O pins configured and running RC servo outputs (85 at once)
  • ChangeFrameTime : this example shows how to change the ‘frame time’ for RC servo outputs to get different amounts of motion out of an RC servo.

Because this library does not use any timers, it will not impact any other libraries that you may be running at the same time.

Even though it does not use any of the five PIC32 timers, it still operates completely in the background (during interrupts) so your sketch code still runs normally in the foreground.

This is a video of the library being used to run 10 servos at once – only 10 servos are hooked up, but all 85 outputs are being generated.

Read the README.TXT file in the hardware\pic32\libraries\SoftPWMServo folder. It explains a lot about how the library works, and what the timing restrictions are, and the jitter too.

Adafruit Motor Shield Library

Brian Schmalz ported the Adafruit Motor Shield library (AFMotor) to PIC32. This includes microstepping and PWM on all four DC motor outputs. Make sure to read the comment block at the top of AFMotor.h to understand how best to use the library with chipKIT boards. Tested with Uno32 and uC32 boards. Visit the GitHub repo for more details.

Graphics and Display

CK_ITDB02_Graph library

The CK_ITDB02_Graph library is made especially for the 2.4″ TFT LCD Screen Module: ITDB02-2.4(D) by ITead Studio. The library will work with both the old ITDB02-2.4 and the new ITDB02-2.4D. The chipKIT Uno32 and Max32 are both supported.

An ITDB02 is a TFT LCD Screen Module with a 40 pin interface. It is not just a LCD breakout but includes a Touchscreen, SD card slot and an integrated flash-chip.

CK_RGB_GLCD library

The CK_RGB_GLCD library has been made especially for the excellent RGB LCD Shield for the Arduino 65K colour KIT by NKC Electronics. The chipKIT Uno32 and Max32 are both supported.

The LCD module in this kit is a 128×128 pixel 65k colour module with a LDS 183 LCD controller. It might be possible to adapt the library for other displays using this controller, but this is unverified.

CK_ITDB02_Touch library

The CK_ITDB02_Touch library is primarily an add-on to the CK_ITDB02_Graph library (above) for the ITDB02 modules by ITead Studio. The chipKIT Uno32 and Max32 are both supported.

An ITDB02 is a TFT LCD Screen Module with a 40 pin interface. It is not just a LCD breakout but includes a Touchscreen, SD card slot and an integrated flash-chip.

dogm128 library

The dogm128 library supports the Electronic Assembly DOGS102, DOGM128, DOGM132, DOGXL160 displays and the Adafruit ST7565 display . The Uno32 and Max32 implementation of these libraries uses software SPI which allow independent control of all SPI pins, no matter what SPI port is used. Library features:

  • Draw pixel, box, line, arcs, bitmaps and characters
  • Minimal RAM usage
  • Fast drawing functions
  • Fonts stored in program-memory
  • Font converter for the BDF format
  • Breakorino, Chess & Spacetrash: Small games for the graphics-display
  • Graphical user interface available

Serial_LCD Library Suite for 4D Systems µOLED µLCD µVGA Screens

The Serial_LCD Library Suite is made especially for the µOLED, µLCD and µVGA screens from 4D Systems.

The µOLED, µLCD and µVGA screens pack their own fast micro-controller to manage the screen, so the chipKIT micro-controller is free for other tasks.

Only a single serial port, either hardware, software or from an I2C bridge, is required.

The library handles text and graphic display, touch (resistive or capacitive), microSD-card read and write and sound.

It also provides high level functions for

  • hardware, software and I2C bridge serial port connection,
  • GUI as label, button, dialog box, menu and slider,
  • ready-to-use graphics as clock, histogram and gauge,
  • power-saving function,
  • and even a photo gallery!

The library has been tested on the chipKIT Uno32 at 115200 bps and is fully documented (PDF, HTML or docset for Xcode).

DisplayCore

DisplayCore builds on the success of the popular TFT library by Majenko Technologies. With a new, cleaner, modular design, DisplayCore boasts an increase in performance with a reduction in code size, better device support, simpler integration, and better display functionality than ever before. Designed from the ground up for the powerful chipKIT environment, DisplayCore leverages the advanced interfacing and connectivity facilities provided by the industry leading PIC32™ family of chips. Visit DisplayCore.org for details.

GLCD

Majenko Technologies also provides a double-buffered graphical LCD library (standalone) for the KS0108 and similar 128×64 LCD displays. This is also available in the DisplayCore library mentioned above. Visit the GitHub Repo for details.

Real-Time Clock/Calendar

PIC32 RTCC Lib

Visit the GitHub Repo for details.

RTCC

Majenko Technologies provides a Real-Time Clock and Calendar. Access the internal RTCC of the PIC32 chips using a simple object interface. Can also drive an interrupt when alarms occur. Visit the GitHub Repo for details.

Interrupts

Change Notification

Majenko Technologies provides access to the Change Notification pins as standard interrupts with attachInterrupt() and detachInterrupt(). Supports RISING, FALLING and CHANGE. It also has the ability to attach different interrupts to different edges. Visit the GitHub Repo for details.

Miscellaneous

Streaming

Note: This has not been ported: Streaming Lib Maintainer Page

Makeshift Servo library

WARNING: Deprecated. You should now use the official Servo library. Documentation preserved for those already using this library.

Nevertheless, you can download a quick-and-dirty “Makeshift” version of the Arduino Servo library that works like the original with the provisos that you can only use 8 servos and can’t use pin 3.

Additional Notes

– All the comments about the implementation in MakeshiftServo.h apply to the AVR original implementation of Servo, not MakeshiftServo, so just ignore them. This implementation uses Timer3 and OC1 only.

– The PIC32 PWM implementation uses the same OC1 as MakeshiftServo. On the UNO32 this is mapped to pin 3 so you will not be able to use pin 3 for PWM either. See wiring_analog.c and pins_arduino_pic32_uno.cxx in the PIC32 source.

– All the other PWM pins should still work, within current limits.

– There is no “keywords.txt” file in the MakeshiftServo.zip package (along with the MakeshiftServo.cpp and MakeShiftservo.h files). This file is used for the MPIDE highlighting. You can simply copy the keywords.txt from the existing Servo folder into the new MakeshiftServo folder.