BoostC compiler libraries


On this page you can download some interface libraries to use with the BoostC compiler. After long years of assembly PIC programming, I finally moved on to a C compiler for faster development and easier code reuse.

Library overview

The libraries you find here can simply be included in your BoostC project by adding the appropriate source and header files to the project tab. Available libraries are:

  • DS1820 One-Wire interface: bit-bangs a one wire interface on any I/O of the PIC microcontroller.
  • PIC16F87X internal ADC lib: A simple interface to the internal ADC modules of the PIC16F87X.
  • PIC16/PIC18 internal UART lib: Blocking functions to write to read and write from the hardware UART in the PIC16F87X.
  • PIC16/PIC18 internal SPI lib: Non-blocking funtions that interface to the SPI hardware unit in the PIC. Uses a buffer that is loaded before the transaction, the transfer itself is handled through interrupts.
  • PIC16F87X internal FLASH memory access: Read and write the internal program memory of the controller from your user code.
  • PIC16/PIC18 internal EEPROM memory access: Easily read and write the EEPROM memory in the PIC device, using the same syntax as the FLASH lib.
  • MCP2515 CAN controller lib: Interface to the Microchip standalone CAN controller. Depends on the SPI library that is presented above.
  • LCD 4-bit interface: 4-bit data interface to an LCD. Reads the status of the LCD before sending a command, so the library is not depending on timing loops in the PIC.
  • Clock lib: Library that keeps track of the time. You’ll need to setup a timer that calls the update function every second.
  • PIC16F87X internal timer library: Let’s you easily setup and use one of the internal timers.
  • Nordic nrf2401 2.4 GHz transceiver library: no more wires, connect through the ether using these nifty devices from Nordic. The library puts the devices in Shockburst mode.
  • Nokia 3310 graphical LCD interface: why use a character-based display if you can get graphical? Interfacing a 3310 display is really easy…
  • 595 shift register: interfaces to a simple 595 shift register. I use this for expanding the number of output ports of a circuit.


Is my work useful for you? Show your appreciation!


All source files including test suites for the different libraries are available in the following zip-files: [download#1#size#nohits]


20060625: Version 1.3

  • Added Nordic nrf2401 2.4 GHz transceiver library
  • Added Nokia 3310 graphical lcd interface + characterset
  • Added 595 shift register interface
  • Update the OneWire lib: a bugfix in the bit TX routines, added CRC check, added more extensive support for the DS1820
  • Updated the serial lib: check for overrun error in the hardware UART, added a first version of a packet-based serial protocol.
  • Updated the EEPROM lib for support on PIC18F devices.

20060427: Version 1.2

  • Internal revision

20060115: Version 1.1

  • Major SPI lib update: added support for the first SPI port of PIC18F devices, added support for user-generated chip select signal, added an extra read function for devices that have a 2-pin SPI port (instead of the standard three pins)
  • Added the timer interface library
  • Added the clock library
  • Added the EEPROM library

8 thoughts on “BoostC compiler libraries”

  1. Have been using you LCD Demo on 16F887.

    LCD works, but I have a One Line LCD. So I have only 8 characters, and then I call line 2.
    I wish there was a selection of type of LCD?

    A selection for how many Lines a display has?

    Using RealTerm, I can’ get the Serial out to be readable? So my RS232 is bad.

    Can you discribe what Baudrate I should be trying?

    I am Using 8MHz crystal.
    Next I want to do One Wire!


  2. Hi,

    good to hear that the LCD routines also work on a 16F887.

    Concerning the line selection: I don’t really understand the problem you describe. If you only have a single-line LCD, I assume there is no sense in putting data on line 2? I don’t see how I could update the library for that. Why do you call line2?

    For the baudrate setting of the serial routines: depending on the hardware you have, the baudrate you want to obtain and the oscillator you use, you should pass a value to the ‘serial_init’ function. This value can be determined by getting the correct value from the datasheet of the device you’re using. The value you need is used for the baudrate generator in the UART block of the PIC.
    You will find 2 tables in the datasheet: one for BRGH = 0 and one for BRGH = 1. This is a bit that is set in the TXSTA register. In my library, it is set to ‘1’, so pick the correct table, or modify the library code if you need the other table.

    For the OneWire libs: those should work out of the box. I have a circuit using those libs running for several year now, so most bugs should already be ironed out 😉

    Best regard!

  3. Hello Lieven!

    im interested in interfacing an MCP2515 onto a PIC18F4550, but i did not find the following files in the package: mcp2515_test.c, mcp2515_test.h – although they are listed in mcp2515.__c

    can You pls add them to the package?

    this is a great package, N3310 LCD works fine on my digital pressure gauge project, thx!

  4. Hi,
    I modified your eeprom library to work with reading and writing on a PIC12f683.

    Here’s the code.

    * EEPROM data memory interface for PIC12f683 devices
    * Allows for read and write of the program memory.
    * Warning! Interrupts are disabled during write !
    * Based on code by
    * (c) Lieven Hollevoet
    #include “eeprom.h”

    // Read an EEPROM memory location. Takes the address as input
    // and returns the data at the memory location.
    // The function is based on the Microchip document DS41211D
    // page 75.
    char eeprom_read(char address){

    // Load address
    eeadr = address;

    // Read, data is available in eedata the next cycle.
    eecon1.RD = 1;

    // Return value
    return eedata;


    // Writes a byte to the data EEPROM.
    // Interrupts are disabled during this routine.
    // The function is based on the Microchip document DS41211D
    // page 75.
    void eeprom_write(char address, char data){

    // Wait for any other write to complete
    while (test_bit(eecon1, WR)){};

    // Load address and data
    eeadr = address;
    eedata = data;

    // Write enable
    set_bit(eecon1, WREN);
    // Disable interrupts
    clear_bit(intcon, GIE);

    // Required write sequence
    eecon2 = 0x55;
    eecon2 = 0xAA;
    set_bit(eecon1, WR);

    // Disable write
    clear_bit(eecon1, WREN);
    // Enable interrupts
    set_bit(intcon, GIE);

Comments are closed.