LCDiesel: Yet another AVR HD44780 LCD library

I created an HD44780 LCD library for the AVR architecture today. There were a ton already, and mine is based off of one by Peter Fleury. I added a couple cool little features, and decided it needed to be on github to allow people to improve it and access it easier.

LCDiesel on Github

Here’s a quick code example using the library:

#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include "lcd.h"

// Include the chars we want
#include "chars.h"

int main(void)
    /* initialize display, cursor off */
    lcd_command(LCD_FUNCTION_4BIT_2LINES );

    // Testing if x,y are set wrong
    lcd_gotoxy(3, 1);

    // Load character
    lcd_custom_char_p(0x00, _char_open_rectangle);
    lcd_custom_char_p(0x01, _char_heart);

    // We better still be at 3, 1


See how easy it is to define custom characters? Cool, huh? I think so. The heart and rectangle bit vectors are in chars.h, and are only compiled in when they are defined, keeping code size down. Here’s how I have it hooked up on the breadboard (and the output of the program above):


2 thoughts on “LCDiesel: Yet another AVR HD44780 LCD library

  1. Joe Hance

    Nice library. I note that the Adruino LCD library has an option to NOT use the “RW” line. You wire RW to GND. You can get away with this if you have only a single LCD on the data lines.

    It saves an I/O line (always scarce). Have you considered add this as an option?


  2. Erik Post author

    I could probably do that. If you’re feeling frisky, you could clone my github repo, make the necessary changes, and send me a pull request and I’d be glad to roll it in. Or, you could send me a patch file. Otherwise, I’m not likely to get around to it any time soon. Thanks, though!

Leave a Reply

Your email address will not be published. Required fields are marked *