You are on page 1of 2

PIC C Library

-------------

This is an ongoing attempt to produce a set of libraries for use with


C compilers used to generate code for low-resource microcontrollers.

For our purposes, a low resource microcontroller is one with as little


as 1K of Flash (program) RAM, perhaps 100 bytes of data RAM, and a
similar amount (or no) EEPROM. Examples of such devices are MicroChip's
PIC and Amtel's AVR ranges. The focus is currently upon PIC devices.

There are two ways in which a C program can vary for a given embedded
application: 1) due to the target's hardware, and 2) due to the C compiler
being used.

So far the only supported target is PIC and the only supported compiler
is Hi-Tech's PICC. Further, only the following devices have been used for
testing purposes: 16F84, 16F628, and for a subset of library code, 12F675.

However, the code has been written in such a way as to be easily adapted
to other C compilers and other targets. Free versions of many C compilers
exist, e.g. Hi-Tech's PICCLite, mikroC, gcc (e.g. for AVR, TI).

Header files in the include directory should be consulted re: the


functionality and usage of each library. The PATHS section of each
library's makefile should be customised as appropriate to your
environment, including the PART (target device) definition.

Device and compiler specific code (eg I/O, programming fuse configuration)
is isolated via conditional compilation.

Gnu makefiles permit the libraries to be built in a variety of environments


such as cygwin, Unix, Mac OS X.

Simple test programs are provided for some libraries. Example applications
are given in the examples directory.

picclib is covered by the MIT License (see http://www.opensource.org/licenses/mit-


license.php).

I developed the libraries based upon my own interests and practical needs,
and I make the code available in the belief that others may also find it
useful. Libraries for the following are included:

- Switch input
- Keypad input
- Dallas Semiconductor 1-wire protocol
- 2-line LCD (Hitachi controller)
- 7-segment LED array display
- LED grid display
- Timer driver
- State machines (fsm, stable)
- Sound output

My hope is that others will add their own library code to this project and/or
help to improve what is already there.

Enjoy.
David Benn
dbenn@computer.org
December 2004, May 2007

You might also like