You need to log in to create posts and topics.

Custom characters on Hd44780

I made a video about SimulIDE

and stumble on a bug that custom characters did not work

It use this library https://github.com/pololu/pololu-hd44780-arduino

there 2 examples and one use loadCustomCharacters();

and with this function there nothing on display

Hi, great video.

Thank you very much for reporting, but I'm not sure there is any problem.
Custom characters works for me.

First note that pololu-hd44780-arduino library is quite old and not maintained.
That doesn't mean it should not work, but I see several problems.

I used the example provided in the library: Test.ino

1- Function wait()
This is supposed to send data and wait for data from the serial port.
Is seems to use a macro (or similar): SERIAL_PORT_MONITOR
But I don't find where it is defined and in any case Serial is not initialized.
So I don't see how this is supposed to work, if you know please tell me .

void wait(uint16_t id)
{
  SERIAL_PORT_MONITOR.println(id);
  SERIAL_PORT_MONITOR.flush();
  while(SERIAL_PORT_MONITOR.read() == -1);
}

Solution:
You can try replacing wait() by delay(500) for example, or initialize and use Serial to wait for data from the user.

 

2- After writing to CGRAM it does not return to DDRAM:

  loadCustomCharacters();

  // Test both overloads of write
  // Expected screen: "Hello   "
  //                  "        "
  lcd.clear();
  lcd.write('H');  // Here it tries to write to DDRAM, but LCD is still in CGRAM
  lcd.write("ello");

 

Solution:
Add a lcd.gotoXY before lcd.write:

  loadCustomCharacters();

  // Test both overloads of write
  // Expected screen: "Hello   "
  //                  "        "
  lcd.clear();
  lcd.gotoXY(0, 0); // This returns the LCD to DDRAM
  lcd.write('H');
  lcd.write("ello");

 

 

 

1- Function wait()

SERIAL_PORT_MONITOR is defined in pins_arduino.h
#define SERIAL_PORT_MONITOR Serial

but yes it missing

SERIAL_PORT_MONITOR.begin(9600);

2- After writing to CGRAM it does not return to DDRAM:

there also

 lcd.clear();

but yes with

lcd.gotoXY(0, 0); // This returns the LCD to DDRAM

it started to work

I will later try on real hardware and make another video 🙂

lcd.clear();

I will later try on real hardware and make another video

I was thinking about that...
In the datasheet seems that lcd.clear() only resets the DDRAM pointer, but could be that it also changes mode to write to DDRAM.
If you test it in real hardware it would be great!

If right after writing to CGRAM, lcd.clear() without lcd.gotoXY() works in real hardware then there is a bug in SimulIDE.
Please let me know what you find.

 

 

I can confirm that it works on real hardware.

lcd.clear() is also reset display position

OK, Thank you very much.
I will fix it.

I made video about custom characters

arcachofo has reacted to this post.
arcachofo