When I want to use the LCD library I have to have a way of getting hold of the file which contains the prototypes for my functions. The standard way to do this in C is to create an include or ".h" (dot h) file. This holds just the prototypes, plus anything else which is needed to use the LCD functions.

I can then use the #include pre-processor directive to include the description file in my source file. Remember that the pre-processor is the very front of the compiler and does the job of actually fetching lines of text for the compiler to work on. I can give the pre-processor commands which will affect the text that it sends to the compiler. Pre-processor commands start with a # character and one of them is #include.

#include works like this:

When the compiler sees something like:

#include <lcdlib.h>

- in the source file it looks for a file with the name lcdlib.h. If it finds one it opens that file and passes it to the compiler. Once it reaches the end of the file it is including it will go back to reading the original source file. You can find more detail about the pre-processor in the C reference section of the course. I have created a file called "lcdlib.h" which contains the function prototypes for my lcd. the program on the right makes use of these.