Controlling a HD44780 LCD on a BeagleBone (Part 2)

On the previous post I described how a HD44780 can be integrated with a BeagleBone. For this post, I created a small HD44780 library for the BeagleBone that makes the process of writing text to a LCD as easy as it was on the Arduino.

First of all you need some files. Go to the github for this project (https://github.com/nunoalves/BeagleBone-HD44780) and place the following files into your BeagleBone:

  • beagle_gpio.c
  • beagle_gpio.h
  • beagle_hd44780.c
  • beagle_hd44780.h

    These files provide all the necessary LCD I/O. In this post we will be discussing the example_03.c and example_04.c files that are also available on that same repository.

    Once the files are on your BeagleBone, make all the appropriate connections, exactly as described on the previous post.

    Instead of describing every single function in detail, its probably easier if you look at the following code (example_03.c), which performs some very basic LCD operations.

    You can compile, and run, this code with the following commands:

    gcc -c beagle_gpio.c
    gcc -c beagle_hd44780.c
    gcc beagle_gpio.o beagle_hd44780.o example_03.c
    ./a.out

    This next sample code (example_04.c) shows how to write full strings and how to address a particular LCD position.



    Running the code from example_04.c on a BeagleBone with a HD44780 compatible LCD

    You can compile, and run, this code with the following commands:

    gcc -c beagle_gpio.c
    gcc -c beagle_hd44780.c
    gcc beagle_gpio.o beagle_hd44780.o example_04.c
    ./a.out

    Have fun!