Custom characters on HD44780 display (Nerdkit)



It took me really a lot of time to turn my Nerdkit into a Pixel Art Machine.

Because of that I wanted to share my experience with the community.

The following code shows one custom character on your nerdkit display.


Main Program

View source
#define F_CPU 14745600
#include <stdio.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <inttypes.h>
#include <inttypes.h>
#include <string.h>
#include <util/delay.h>
#include "../libnerdkits/delay.h"
#include "../libnerdkits/lcd.h"
int main(void) {
  // fire up the LCD
lcd_set_type_command();     // Change into command mode
lcd_write_byte(0x40);       // Change to CGRAM to store custom character - at 0x00
lcd_set_type_data();        // Change into data mode
lcd_write_byte(0x00);       // Send Hexa Bytes of Custom Character Begin
lcd_write_byte(0x00);       // Send Hexa Bytes of Custom Character End
lcd_set_type_command();     // Change into command mode
lcd_write_byte(0x80);       // Change to DDRAM
lcd_write_byte(0x00);       // Show stored custom character on lcd screen
  // busy loop
  while(1) {
  // do nothing
  return 0;


This part was for a better understanding how things have to be written and read from the CGRAM.

Please check your makefile for this project.
You have to change from '-Os' to '-O0' in the makefile, or else your display writes anytime into the first line.

To get a clear declaration of the array, you also have to change the following code into your makefile:



View source
avr-objcopy -j .text -j .data -O ihex lnino_eval_board.o lnino_eval_board.hex


I have modified the original nerdkit LCD library to have a more comfortable use of custom characters.

char pattern01[8]={14,17,17,14,4,6,4,6}; // Key Pattern

lcd_createChar(0, pattern01); // Create Char on position 0x00
lcd_loadCharSingle(0x00); // Loads the Char 0x00 on the current Cursor Position
lcd_loadChar(0,19,0x00); // Loads the Char 0x00 on row 0, column 19


You can convert your Images to Numbers on the following Website:

The complete modified nerdkit lcd library is attached here:





Maybe you can use this little tutorial for your Nerdkit Projects.


Just a little hint:
You can only save a Maximum of 8 custom characters in the HD44780 display.
But of course you can overwrite and shift them anytime, so really can use a lot of custom characters and moving animations.

Have fun with your own Pixel Art on your Nerdkit.