,rwblinn.de
My Make Projects
Introduction

The goal of LCD Char Maker is to create custom LCD characters for Make Projects using LCD displays connected f.e. to Arduino, ESP or Raspberry Pi.
LCD Displays supported are 16x2 and 20x4 columns & rows. The code for a custom character generated is C and B4X.
Developed with B4J.

Functionality
  • Create custom LCD character with 5 pixel horizontal (cols), 8 pixel vertical (rows), total 40 pixel.
  • Each row is represented by a byte with 5 bits. A custom character has a total of 40 bits.
  • Save / open the character to / from a textfile located in the application folder.
  • Import 8 bytes array string in format 0xNN,0xNN... where NN is HEX value.
  • Create B4R Inline C code (binary string) with copy to clipboard option. Example code see screenshot Degree C Character.
  • Create B4J code (hex string) with copy to clipboard option. Example code see screenshot Degree C Character.
  • Added few example chars in the project objects folder.
  • Tool based on the LCD Char Maker tool I wrote for TinkerForge ( http://www.tinkerforge.org ).
  • Tool supports LCD display connected to Raspberry Pi - using HEX strings (B4J).
Download: B4J Source Code here. The jar file and sample custom characters are in the objects folder.
Published External: B4R Forum
Software
  • The application has been developed with B4J 4.7 or higher
  • To run LCD Char Maker, Java is required. Start LCD Char Maker from the command line or double click from a file explorer:
    Run from the objects folder: java -jar lcdcharmaker.jar
To-Do List
  • Create Python Code
Changelog
  • 20170227: v1.65: Import custom character, copy buttons
  • 20170226: v1.5: B4X Code
  • 20160614: v1.0
Additional specific information for B4R & B4J
B4R Code Snippet
InlineC Code is required to display the special characters.
#Example (can be used to be copy and paste in projects)
'Inline C to define the special characters
'Usage:
' Private CharArrowUp As Byte = 0
' Private CharArrowDown As Byte = 1
' Private CharArrowEq As Byte = 2
' RunNative("createChar", Null)
' lcd.SetCursor(0,0)
' RunNative("writeChar", CharArrowUp)
' lcd.SetCursor(5,0)
' RunNative("writeChar", CharArrowDown)
' lcd.SetCursor(10,0)
' RunNative("writeChar", CharArrowEq)
#if C
Byte arrowup[8] = {B00000,B00100,B01110,B11111,B00100,B00100,B00100,B00000};
Byte arrowdown[8] = {B00000,B00100,B00100,B00100,B11111,B01110,B00100,B00000};
Byte arroweq[8] = {B00000,B00000,B11111,B00000,B11111,B00000,B00000,B00000};

//Create the special chars:0=arrow up, 1=arrow down, 2=arrow equal
//Use:
//RunNative("createChar", Null)
void createChar(B4R::Object* o) {
b4r_main::_lcd->lc->createChar(0, arrowup);
b4r_main::_lcd->lc->createChar(1, arrowdown);
b4r_main::_lcd->lc->createChar(2, arroweq);
}

//Write a special character to the display: 0=arrow up, 1=arrow down, 2=arrow equal
//Use:
//lcd.SetCursor(0,1)
//RunNative("writeChar", 0)
void writeChar(B4R::Object* o) {
b4r_main::_lcd->lc->write((Byte)o->toULong());
}
#end if

Hint
To write a character from the character table of the LCD Display driver:
The LCD1602 uses the HD44780 Dot Matrix Liquid Crystal Display Controller/Driver.
The datasheet contains the character tables.
Example Degree Character (Reference page 17 of the data sheet):
The Degree Character is located at position upper 4 bits 1101 and lower 4 bits 1111.
The 8 bits 1101 1111 are HEX DF and DEC 223.
To write the character to the LCD use lcd.Write(Array As Byte(223)).

B4J Code Snippet
Note:For more samples download the example project with the jLCD_I2C library .

Public Sub Char_Batterie( ascii As Int) 'ignore
Dim chars(8) As Byte = Array As Byte (0x0e, 0x1b, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1f)
'Call the special routine to define the character. This is dependend if own routines or using the previous mention jLCD_I2C librar or other.
End Sub

Dim b as byte = 0
lcd.Char_Batterie(b)
lcd.PrintAt(2,1, Chr(b))

THime, 2017 by Robert W.B. Linn