PILib is a C++ library that implements an interface for HD44780 based LCD displays for the Raspberry PI. It can be downloaded here. It handles almost all the technical details. Open the index.html file in the doc/html directory for more information. The source code is included. A “Hello World” program is as simple as:

#include "HD44780.h"

int main() {

    CTTPI::HD44780 module(1, 16);
                   // EN  RS RW  D4  D5  D6  D7
    module.initialize(17, 18, 0, 21, 23, 24, 25);
    module.writeString("Hello world!");
    return 0;
}